Skip to content

Classify Codex app-server chatgpt-auth-required as an auth error#8765

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/codex-usage-auth-required-classification
Jul 14, 2026
Merged

Classify Codex app-server chatgpt-auth-required as an auth error#8765
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/codex-usage-auth-required-classification

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Problem

When the Codex home's auth.json holds only an OPENAI_API_KEY (no ChatGPT tokens), the app-server RPC rejects account/rateLimits/read with:

chatgpt authentication required to read rate limits

That string matches none of CODEX_AUTH_ERROR_PATTERNS, so fetchCodexRateLimits treated it as a generic RPC failure and fell through to the hidden PTY /status probe — which cannot render usage for such accounts and burned the full 15s PTY timeout on every refresh cycle. The status bar showed a permanent "Refresh failed — PTY timeout" chip, and each background retry spawned a doomed hidden codex PTY for 15 seconds.

Repro

  1. Codex home with API-key-only auth.json (no ChatGPT sign-in).
  2. codex -s read-only -a untrusted app-server + initialize/initialized/account/rateLimits/read → the error above in ~0.2s.
  3. Orca's usage refresh: 15s hidden PTY per cycle → "PTY timeout".

Fix

Add the message to CODEX_AUTH_ERROR_PATTERNS so the existing auth-error short-circuit in fetchCodexRateLimits returns the RPC result directly: fast, accurate error copy, and no hidden PTY spawn.

Testing

  • New test: app-server chatgpt-auth-required error is returned verbatim and the PTY probe is never spawned.
  • vitest run src/main/rate-limits src/shared — 249 files / 2443 tests pass.

When auth.json holds only an OPENAI_API_KEY (no ChatGPT tokens), the
app-server RPC rejects account/rateLimits/read with "chatgpt
authentication required to read rate limits". That string matched none
of CODEX_AUTH_ERROR_PATTERNS, so fetchCodexRateLimits fell through to
the hidden PTY /status probe, which cannot render usage for such
accounts and burned the full 15s PTY timeout on every refresh cycle,
surfacing as a permanent "Refresh failed — PTY timeout" status chip.

Classify the message as an auth error so the RPC result is returned
directly (fast, accurate) and no PTY is spawned.
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c4b8e7f2-76aa-4210-a5dd-a236783db24d

📥 Commits

Reviewing files that changed from the base of the PR and between 7957fc7 and 98d4f19.

📒 Files selected for processing (2)
  • src/renderer/src/components/status-bar/tooltip.test.ts
  • src/renderer/src/components/status-bar/usage-error-copy.ts

📝 Walkthrough

Walkthrough

Added a case-insensitive Codex authentication error pattern for “chatgpt authentication required.” Added a rate-limit fetcher test covering the app-server chatgpt-auth-required RPC failure, including the returned error fields and confirmation that the PTY fallback probe is not invoked. Updated usage error classification and status-bar tests so authentication-required messages produce refresh-failure copy rather than rate-limit copy.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers problem/fix/testing, but it misses required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections, include the testing checklist items, and document AI review/security findings plus any platform-specific notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: adding a Codex auth error classification for app-server chatgpt-auth-required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…d label

The new Codex app-server error 'chatgpt authentication required to read
rate limits' mentions rate limits only as the object it failed to read,
but the status bar's rate-limit classifier matched the phrase and
labeled the chip 'Limited'. Classify authentication-required messages as
auth failures so they get the standard softened refresh copy instead.
@brennanb2025 brennanb2025 merged commit ba5fa7d into main Jul 14, 2026
1 check passed
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.

1 participant