Repository navigation
routes: workhorse-weighted Luna #xhigh seat switches to Terra #low - #8162
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 47 minutes. View limit details
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Closes #1818 (renewal half; the sign-in half landed in #1861 / #1852).
Problem
The claude-code provider read only
accessToken+expiresAtfrom~/.claude/.credentials.jsonand failed loudly on expiry — even though a valid single-use refresh token sat in the same file. The provider's liveness silently depended on the real CLI being run every ~8h.Change
An expired credentials-file credential carrying a refresh token now:
grant_type=refresh_tokenexchange against the Claude Code token endpoint (client_id9d1c250a-…, the CLI's own identity);writeCredentialhelper (atomic temp+rename, 0600, unrelated fields preserved) before the new access token is used.Anthropic rotates the refresh token on every exchange, so the exchange and its write-back are one operation:
ClaudeCodeRefreshErroris raised. No in-memory-only credential exists (an unpersisted rotated token would burn the login).invalid_grant, transport, non-200) → the fail-loud floor is kept, with a named message pointing at the in-product sign-in.CLAUDE_CODE_OAUTH_TOKENenv fall-through (nixos: bring Grist, Kaneo, Pad, ready-for-agent in as flake services — the last hand-run PM servers #1752) and explicit config/accessTokenoverrides are unchanged; an expired file with no refresh token still fails loudly exactly as before.Tests
packages/ai/test/provider/claude-code-auth.test.tsadds renewal coverage: refresh + write-back round-trip (rotated pair persisted, next resolution reads the new token), write-failure injection (tokens discarded, file byte-identical, named error),invalid_grant(named re-login error, no write), concurrent single-flight (verified to fail with 5 exchanges when coalescing is removed), the env-token path (no exchange), and tokens-never-logged.bun test test/provider/claude-code-auth.test.ts— 42 passbun test test/provider/claude-code.test.ts— 11 passbun test test/quota.test.ts— 188 passbun typecheck(packages/ai) — clean; oxlint 0; prettier appliedLive interop against a real claude.ai login is out of scope (cannot run in CI); the mocked-endpoint tests cover the contract.
Queue task 12945 · worker repo-worker-opencode · lane 3fe37e8a-c61b-419c-9e97-769ecd264d5d.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.