Repository navigation
[codex] Fix Codex OAuth refresh fallback - #82117
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: no. high-confidence live reproduction here: the linked issue has strong reporter logs, and source inspection confirms current main lacks a post-refresh-failure Codex CLI fallback, but I did not run a real OpenAI Codex OAuth account through the failing runtime path. Real behavior proof Next step before merge Security Review detailsBest possible solution: Keep this PR open for maintainer review, reconcile the proof/run status, and land the fallback only after confirming it preserves OpenClaw as the canonical token sink while recovering the Codex app-server refresh-failure path. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction here: the linked issue has strong reporter logs, and source inspection confirms current main lacks a post-refresh-failure Codex CLI fallback, but I did not run a real OpenAI Codex OAuth account through the failing runtime path. Is this the best way to solve the issue? Unclear but plausible: a tightly gated runtime-only fallback at the OAuth manager refresh-failure boundary matches the reported failure better than changing the Codex harness flag. The PI-route follow-up and proof-link mismatch mean maintainer verification is still needed before landing. Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against cd9b2c0af4f5. |
f6f0d07 to
3f0a061
Compare
|
Verification before merge:
Known proof gap: exact reporter machine/keychain state not available; keychain-only Codex CLI tokens still fail closed because runtime fallback is non-prompting. |
* fix: fall back to Codex CLI OAuth after refresh failure * fix: support Codex CLI fallback for named profiles
* fix: fall back to Codex CLI OAuth after refresh failure * fix: support Codex CLI fallback for named profiles
* fix: fall back to Codex CLI OAuth after refresh failure * fix: support Codex CLI fallback for named profiles
Summary
Fixes #82069 by adding a narrow runtime recovery path for OpenAI Codex OAuth refresh failures:
openai-codexauth profile canonical during normal bootstrap/refreshopenai-codex:defaultand named profiles such asopenai-codex:[email protected]auth-profiles.jsonVerification
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/agents/auth-profiles/oauth.openai-codex-refresh-fallback.test.ts src/agents/auth-profiles.external-cli-sync.test.ts src/agents/auth-profiles/external-oauth.test.ts src/agents/auth-profiles/oauth-manager.test.ts extensions/codex/src/app-server/auth-bridge.test.ts- 9 files, 150 tests passedOPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/agents/auth-profiles/oauth.openai-codex-refresh-fallback.test.ts src/agents/auth-profiles.external-cli-sync.test.ts- 4 files, 74 tests passed after named-profile fixpnpm check:changed- Blacksmith Testboxtbx_01krnp642m5neh6rhw1g9hjnnp, GitHub Actions run https://github.com/openclaw/openclaw/actions/runs/25915319488, exit 0/Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --base origin/main --full-access- found named-profile fallback gap, fixed/Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode local --full-access- clean after fix, no accepted/actionable findingsReal behavior proof
Behavior addressed: OpenClaw can recover a stale local OpenAI Codex OAuth refresh token by using same-account Codex CLI OAuth tokens at runtime only.
Real environment tested: Local OpenClaw auth-profile unit/integration tests plus Blacksmith Testbox changed gate.
Exact steps or command run after this patch:
pnpm check:changedon Blacksmith Testbox leasetbx_01krnp642m5neh6rhw1g9hjnnp.Evidence after fix: Regression tests cover default and named Codex profiles, mismatched-account rejection, identity-less rejection, unchanged-token forced-refresh rejection, and no persistence of Codex CLI token material.
Observed result after fix: Focused tests and Testbox changed gate passed; PR checks for SHA
3f0a0614226e2202516eb3bdd73d484c289a315care clean/skipped as expected.What was not tested: Reporter's exact machine state and keychain-only Codex CLI credentials; the fallback intentionally uses
allowKeychainPrompt: false, so unavailable keychain-only tokens still fail closed.