[codex] Fix Codex app-server OAuth harness auth#79877
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. The current-main source path lacks the external Codex CLI OAuth overlay, and the PR discussion includes before/after live proof showing the pre-fix 401 and post-fix Codex harness turns. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the Codex OAuth routing approach, but repair the SDK runtime export mismatch before merge and then rerun the focused Codex auth tests plus the extension lint/build surface. Do we have a high-confidence way to reproduce the issue? Yes. The current-main source path lacks the external Codex CLI OAuth overlay, and the PR discussion includes before/after live proof showing the pre-fix 401 and post-fix Codex harness turns. Is this the best way to solve the issue? No, not yet. The functional direction is narrow and appropriate, but the current patch must either export Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against adc3ba45cac0. |
15a78df to
f7050a4
Compare
pashpashpash
left a comment
There was a problem hiding this comment.
Please provide actual screen recordings of the problematic behavior before and the fixed behavior after your patch.
|
Added screen recordings here: Before: https://github.com/jeffjhunter/pr-79877-recordings/blob/main/pr-79877-before-prefix-oauth-profile-missing-repro.mp4 The before recording is a focused pre-fix repro with scoped Codex CLI OAuth profile loading disabled, showing the plugin-owned app-server harness failing because |
f7050a4 to
164d00a
Compare
164d00a to
4ac0387
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ac0387250
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| import path from "node:path"; | ||
| import { | ||
| ensureAuthProfileStore, | ||
| ensureAuthProfileStoreWithoutExternalProfiles, |
There was a problem hiding this comment.
Stop importing a non-exported SDK runtime symbol
openclaw/plugin-sdk/agent-runtime does not export ensureAuthProfileStoreWithoutExternalProfiles (its export list in src/plugin-sdk/agent-runtime.ts only includes ensureAuthProfileStore and loadAuthProfileStoreWithoutExternalProfiles), so this new named import is unresolved for plugin consumers and can break module load/runtime auth bridging as soon as auth-bridge.ts is imported. Please switch to an exported symbol from the SDK barrel (or add the export there) so the Codex app-server auth path can initialize reliably.
Useful? React with 👍 / 👎.
4ac0387 to
c3fab3b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3fab3b056
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| import path from "node:path"; | ||
| import { | ||
| ensureAuthProfileStore, | ||
| ensureAuthProfileStoreWithoutExternalProfiles, |
There was a problem hiding this comment.
Import only symbols that agent-runtime exports
This adds a named import that is not exported by openclaw/plugin-sdk/agent-runtime, so ESM module loading will fail as soon as this file is evaluated (SyntaxError for missing export), breaking the Codex app-server auth path at runtime. Fresh evidence in this commit: src/plugin-sdk/agent-runtime.ts’s export list (lines 46-72) still does not include ensureAuthProfileStoreWithoutExternalProfiles, while this file now imports it.
Useful? React with 👍 / 👎.
c3fab3b to
8f74532
Compare
|
Pushed maintainer fixups + changelog on top of the PR. Final head: Proof:
Thanks @jeffjhunter. |
|
Rebased on current Additional proof on rebased head:
|
8f74532 to
ff6260c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff6260cda6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| import path from "node:path"; | ||
| import { | ||
| ensureAuthProfileStore, | ||
| ensureAuthProfileStoreWithoutExternalProfiles, |
There was a problem hiding this comment.
Remove unresolved SDK import from auth bridge
This file now imports ensureAuthProfileStoreWithoutExternalProfiles from openclaw/plugin-sdk/agent-runtime, but that barrel still does not export it, so ESM module evaluation will throw before the auth bridge can run. Fresh evidence in this commit: src/plugin-sdk/agent-runtime.ts adds refreshOAuthCredentialForRuntime but its export list (around lines 34-72) still omits ensureAuthProfileStoreWithoutExternalProfiles, leaving this named import unresolved at runtime.
Useful? React with 👍 / 👎.
|
CI fixup pushed as final head The new extra change is lint-only: Additional local proof:
|
ff6260c to
700e89f
Compare
|
Rebased again on current The browser lint fix that tripped CI is now already in Proof on this rebased head:
|
700e89f to
65c7c97
Compare
Summary
Fixes the Codex app-server OAuth path used by plugin-owned harnesses. The app-server auth bridge now resolves the scoped Codex CLI OAuth provider IDs that the harness creates, and the embedded runner forwards harness auth profile context where plugin-owned transports need it.
The live harness command probe is now opt-in so the OAuth acceptance path can validate auth routing without requiring command-routing behavior in the same run.
Root cause
Plugin-owned Codex harnesses created scoped OAuth profile state, but the Codex app-server auth bridge only looked through the default app-server provider path. That meant the live OAuth harness could have a valid CLI OAuth profile while the app-server side still failed to resolve it.
Real behavior proof
~/.codex/auth.jsonand~/.codex/config.toml; modelcodex/gpt-5.5; command probe disabled to isolate app-server OAuth turn execution.OPENCLAW_LIVE_CODEX_HARNESS_COMMAND_PROBE=0andOPENCLAW_LIVE_CODEX_HARNESS_AUTH=codex-auth.Full local evidence paths:
/home/beau/openclaw-codex-acceptance-20260509-071249/logs/live-codex-harness-local-oauth-command-probe-disabled.log/home/beau/openclaw-codex-acceptance-20260509-071249/logs/live-codex-harness-docker-oauth-command-probe-disabled.logObserved result after fix: Both real app-server OAuth harness runs completed two Codex-backed turns, emitted the expected
CODEX-HARNESS-*andCODEX-HARNESS-RESUME-*assistant tokens, and passed the OAuth turn assertions with1 passed | 1 skipped.What was not tested: The Codex command probe path was intentionally disabled in these proof runs; this PR isolates OAuth profile routing and app-server turn execution.
Validation
git diff --check upstream/main..HEADpnpm vitest run src/gateway/gateway-codex-harness.live-helpers.test.ts/home/beau/openclaw-codex-acceptance-20260509-071249/logs/Note: after rebasing onto current
upstream/main, the focused vitest command stayed in rolldown build timing output for several minutes and was terminated without reaching test execution. No test failure was observed.