Skip to content

fix: clearer labels for upstream 403 permission failures - #145

Closed
Wibias wants to merge 1 commit into
lidge-jun:mainfrom
Wibias:fix/gui-upstream-403-error-labels
Closed

Wibias wants to merge 1 commit into
lidge-jun:mainfrom
Wibias:fix/gui-upstream-403-error-labels

Conversation

@Wibias

@Wibias Wibias commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Upstream 403s (e.g. Ollama Cloud plan/model gates) no longer classify as invalid_api_key.
  • New codes: permission_denied (default 403) and subscription_required when the upstream text mentions subscription/upgrade.
  • Request logs use the upstream message when classifying 403s; GUI Forbidden copy mentions plan/subscription gates.
  • Fixes confusing Details UI reported in [Bug]: Oolama api #142.

Test plan

  • bun test tests/error-fidelity.test.ts tests/errors-adapter-failure.test.ts tests/request-log.test.ts
  • Reproduce an Ollama Cloud Pro-gated model → Logs Details shows permission_denied or subscription_required, not invalid_api_key
  • Confirm real 401 / bad-key failures still show invalid_api_key

Map permission and subscription gates to permission_denied / subscription_required so Logs Details match Forbidden, not a bad key.
@lidge-jun

Copy link
Copy Markdown
Owner

Thanks for the fix — the direction (clearer 403 labels) was right, and we've landed it on dev with your authorship preserved plus maintainer repairs on top:

  • 5292b98f — your PR fix: clearer labels for upstream 403 permission failures #145 checkpoint, absorbed as-is (author: @Wibias, source head fa4ca86).
  • 4d285585 — maintainer repairs (Co-authored-by: @Wibias) closing three review findings:
    1. a real 401 carrying subscription phrasing could be reclassified as 403/subscription_required (401 signals now take precedence);
    2. generic 403 "Access denied" still classified as invalid_api_key (now permission_denied, with the Kiro/AWS credential-cue exception scoped);
    3. tests only injected the desired text manually — added tests/server-403-permission-e2e.test.ts driving an Ollama-shaped error body through the real server → adapter → classifier → log path, plus negative 401 regressions.

Full suite green (2,929 tests). Closing this PR in favor of the dev-landed commits; the change will ship with the next release.

@lidge-jun lidge-jun closed this Jul 18, 2026
@lidge-jun lidge-jun mentioned this pull request Jul 18, 2026
2 tasks done
lidge-jun pushed a commit that referenced this pull request Jul 18, 2026
Apply the contributor-owned 403 permission/subscription labeling checkpoint unchanged before the separately attributed maintainer repairs.

Source: community PR #145
Source-head: fa4ca86
lidge-jun added a commit that referenced this pull request Jul 18, 2026
Repair auth/permission precedence, scope subscription labels to permission contexts, and cover the real Ollama HTTP body plus bare-403 behavior.

Source: community PR #145
Source-head: fa4ca86

Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com>
kartikkabadi added a commit to kartikkabadi/opencodex that referenced this pull request Aug 14, 2026
Port codex-router PR lidge-jun#145: a 200 that completes with no output text and no
tool call is a failure the client cannot see (it silently records the turn
as done). Hold pre-content adapter events, suppress the terminal of an empty
turn, retry the IDENTICAL request once, and surface empty_completion_retry_failed
when the retry is also empty or fails upstream. Usage is merged across both
attempts so the request log meters the whole turn.

Kill switch: OCX_EMPTY_COMPLETION_RETRY=0 restores the previous behavior.
Compaction turns and combo attempts are excluded.
yansigit referenced this pull request in yansigit/opencodex Aug 15, 2026
Port codex-router PR #145: a 200 that completes with no output text and no
tool call is a failure the client cannot see (it silently records the turn
as done). Hold pre-content adapter events, suppress the terminal of an empty
turn, retry the IDENTICAL request once, and surface empty_completion_retry_failed
when the retry is also empty or fails upstream. Usage is merged across both
attempts so the request log meters the whole turn.

Kill switch: OCX_EMPTY_COMPLETION_RETRY=0 restores the previous behavior.
Compaction turns and combo attempts are excluded.
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Apply the contributor-owned 403 permission/subscription labeling checkpoint unchanged before the separately attributed maintainer repairs.

Source: community PR lidge-jun#145
Source-head: fa4ca86
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Repair auth/permission precedence, scope subscription labels to permission contexts, and cover the real Ollama HTTP body plus bare-403 behavior.

Source: community PR lidge-jun#145
Source-head: fa4ca86

Co-authored-by: Wibias <37517432+Wibias@users.noreply.github.com>
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
Port codex-router PR lidge-jun#145: a 200 that completes with no output text and no
tool call is a failure the client cannot see (it silently records the turn
as done). Hold pre-content adapter events, suppress the terminal of an empty
turn, retry the IDENTICAL request once, and surface empty_completion_retry_failed
when the retry is also empty or fails upstream. Usage is merged across both
attempts so the request log meters the whole turn.

Kill switch: OCX_EMPTY_COMPLETION_RETRY=0 restores the previous behavior.
Compaction turns and combo attempts are excluded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants