refactor(openai): centralize Codex OAuth flow#87411
Conversation
|
@codex re-review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex review: needs maintainer review before merge. Reviewed May 28, 2026, 1:30 AM ET / 05:30 UTC. Summary PR surface: Source -619, Tests -345. Total -964 across 7 files. Reproducibility: not applicable. this is a refactor PR rather than a standalone bug report. The review path is source inspection plus compatibility and proof evidence for the affected login/refresh surfaces. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep one plugin-owned OpenAI Codex OAuth implementation, with legacy wrappers delegating through a documented and owner-accepted bundled facade/activation contract after exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor PR rather than a standalone bug report. The review path is source inspection plus compatibility and proof evidence for the affected login/refresh surfaces. Is this the best way to solve the issue? Yes, with owner acceptance: centralizing on the plugin-owned OAuth runtime is the right boundary, but the plugin activation and facade-export behavior must be an intentional compatibility decision. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 44027e72d07e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source -619, Tests -345. Total -964 across 7 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg: ✨ hatched 🥚 common Brave Crabkin. Rarity: 🥚 common. Trait: sleeps inside passing CI. DetailsShare on X: post this hatch
About:
|
9b2f5d7 to
7066e38
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7066e38 to
e1ee393
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
e1ee393 to
f2829ef
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
f2829ef to
edf12de
Compare
Summary
src/llmlogin/refresh behavior, including abort propagation, immediate manual-code input, callback handling, credential refresh shape, provider-hook-unavailable fallback, and disabled-plugin failure behavior.bb46b79d3c14(refactor: internalize OpenClaw agent runtime, refactor: internalize OpenClaw agent runtime #85341).Compatibility Review
src/llmOpenAI Codex OAuth login/refresh entry points are preserved and covered by focused compatibility tests. The login wrapper still reports browser auth throughonAuth, still routes fallback prompts throughonPrompt, still startsonManualCodeInputin parallel with browser auth when supplied, and passes the callersignalinto the provider-owned OAuth hook.ProviderAuthContextfields are added. Legacy-only cancellation and manual-code hooks are carried through a private OpenAI Codex bridge context, so external provider auth consumers do not get a new API surface.extensions/openai/openai-codex-oauth*.runtime.ts/extensions/openai/openai-codex-provider.runtime.tsinstead of being copied back into core.openai-codexOAuth profile with anexpiresAtvalue. Raw auth URLs, temp paths, email/profile id, and credential material are intentionally omitted.Live Fix Proof Repro Matrix
Remote proof was rerun on pre-rebase head
f2829ef7f4with the same patch content through Crabbox using delegated Blacksmith Testbox. The branch was then rebased cleanly ontoorigin/main; current head isedf12deb57.blacksmith-testboxvia Crabboxtbx_01kspehjhah22npkb47p5g5tkghttps://github.com/openclaw/openclaw/actions/runs/26555293890Matrix covered:
oauth-runtimeextensions/openai/openai-codex-oauth-flow.runtime.test.tspassed: callback, manual-code, token exchange/refresh, timeout, cancellation coverageopenai-providerextensions/openai/openai-codex-provider.test.ts,extensions/openai/provider-auth.contract.test.ts, andextensions/openai/index.test.tspassed, including proxy dispatcher setup before Codex OAuth refreshlegacy-compatsrc/llm/utils/oauth/openai-codex.test.tspassed: legacy callback routing, immediate manual-code input, cancellation propagation, refresh shape, provider-runtime-unavailable fallback, and disabled-plugin failure pathprovider-bridgesrc/plugins/provider-openai-codex-oauth.test.tspassed: bridge delegates to OpenAI provider auth hook, falls back through the activated OpenAI plugin facade when the hook is unavailable, and preserves disabled-plugin failure behaviorrefresh-fallbacksrc/agents/auth-profiles/oauth.openai-codex-refresh-fallback.test.tspassed in both agents-core and agents-support projectslintnode scripts/run-oxlint.mjs ...andgit diff --checkpassedbuildpnpm buildpassed on remote Linux/TestboxCredentialed OpenAI browser OAuth was also run locally against pre-rebase head
f2829efwith the same patch content using an isolated temporaryHOME,OPENCLAW_HOME, andOPENCLAW_STATE_DIR. The browser login completed through the localhost callback path andmodels auth list --provider openai-codex --jsonshowed one redactedopenai-codexOAuth profile withexpiresAtpresent. The remote matrix above still covers mocked refresh/fallback/proxy/activation paths on Linux.Verification
node scripts/run-vitest.mjs run extensions/openai/openai-codex-oauth-flow.runtime.test.tsnode scripts/run-vitest.mjs run extensions/openai/openai-codex-provider.test.tsnode scripts/run-vitest.mjs run extensions/openai/provider-auth.contract.test.tsnode scripts/run-vitest.mjs run extensions/openai/index.test.ts --reporter=verbose --testTimeout=5000node scripts/run-vitest.mjs run src/plugins/provider-openai-codex-oauth.test.ts --reporter=verbose --testTimeout=5000node scripts/run-vitest.mjs run src/llm/utils/oauth/openai-codex.test.ts --reporter=verbose --testTimeout=5000node scripts/run-vitest.mjs run src/agents/auth-profiles/oauth.openai-codex-refresh-fallback.test.tsnode scripts/run-oxlint.mjs extensions/openai/api.ts src/plugins/provider-openai-codex-oauth.ts src/plugins/provider-openai-codex-oauth.test.ts src/llm/utils/oauth/openai-codex.ts src/llm/utils/oauth/openai-codex.test.ts extensions/openai/openai-codex-oauth.runtime.ts extensions/openai/openai-codex-provider.tsgit diff --checkpnpm build.agents/skills/autoreview/scripts/autoreview --mode localinitially found proxy/activation fallback issues; after fixes, rerun was clean: no accepted/actionable findings.node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --blacksmith-org openclaw --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --idle-timeout 90m --ttl 240m --timing-json --shell -- "...matrix..."passed ontbx_01kspehjhah22npkb47p5g5tkg.f2829efwith the same patch content in an isolated temp OpenClaw home:pnpm openclaw models auth login --provider openai-codex --method oauth, followed bynode scripts/run-node.mjs models auth list --provider openai-codex --json. Login completed and auth list showed one redactedopenai-codexOAuth profile withexpiresAtpresent. Manual redirect paste: no.Real behavior proof
Behavior addressed: OpenAI Codex OAuth implementation duplication between the bundled OpenAI plugin and legacy core OAuth helpers; no user-visible OAuth behavior change is intended.
Real environment tested: Local macOS worktree with installed repo dependencies and live OpenAI browser OAuth, plus remote Linux Blacksmith Testbox through Crabbox.
Exact steps or command run after this patch: The commands listed in Verification were run after the final code changes.
Evidence after fix: Focused OpenAI Codex OAuth, provider auth, provider runtime, compatibility, refresh fallback tests passed locally and in Crabbox/Testbox remote proof; focused oxlint and
git diff --checkpassed;pnpm buildpassed locally and remotely; autoreview reported no accepted/actionable findings after the compatibility fallback fixes; live OpenAI browser OAuth login completed locally and saved a redactedopenai-codexOAuth profile withexpiresAtpresent.Observed result after fix: Legacy compatibility surfaces now delegate to the existing provider-owned OpenAI Codex OAuth implementation while preserving cancellation, parallel manual-code input, provider-hook-unavailable fallback, proxy-aware refresh, and disabled-plugin failure behavior. The duplicated core browser/token implementation is removed without adding exported provider-auth context fields.
What was not tested: A real token refresh after expiry and a real OpenAI Codex model request were not run; refresh/fallback/proxy paths are covered by focused tests and Testbox proof.