Repository navigation
fix(codex): guide recovery from unimported agent auth - #116807
fuller-stack-dev merged 13 commits into
Conversation
Add agent-scoped Codex migration guidance and expose a validated --agent target so non-default credentials cannot be imported into the default agent store. Fixes openclaw#116763
|
Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 8:37 AM ET / 12:37 UTC. ClawSweeper reviewWhat this changesThe PR detects managed Codex agents whose legacy agent-scoped Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain Keep this PR open for maintainer review. The patch appears to address the linked upgrade failure with a narrow early diagnostic and explicit agent-scoped migration path, but this review cannot mark the Codex dependency proof or real-behavior gate sufficient because the repository-required sibling Priority: P1 Review scores
Verification
How this fits togetherThe Codex extension starts a managed local Codex app-server for an agent and supplies authentication from OpenClaw’s agent-scoped SQLite auth store. Migration commands import eligible legacy credentials into that owner store, after which the startup bridge launches the app-server with the resolved auth route. flowchart LR
A[Agent Codex request] --> B[Managed app-server startup]
B --> C[Resolve agent auth route]
C --> D{Canonical auth or API-key fallback?}
D -->|Yes| E[Launch with prepared ephemeral auth]
D -->|No, legacy auth file found| F[Show agent-scoped migration guidance]
F --> G[Explicit migration command]
G --> H[Agent SQLite auth store]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +134, Tests +250, Docs +42. Total +426 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the early, explicit migration guidance and agent-scoped import boundary, then re-run the exact-head review where sibling Codex source is available and verify fresh-install, upgrade, and both API-key fallback routes before merge. Do we have a high-confidence way to reproduce the issue? Unclear for an independently executed current-head run in this review: the PR body provides a redacted managed-agent before/after transcript and source clearly reaches the new preflight branch, but the required local sibling-Codex contract inspection is unavailable. Is this the best way to solve the issue? Unclear: the owner-boundary shape is sound because it preserves explicit secret-import consent and avoids reviving a legacy runtime fallback, but the direct Codex ephemeral-store contract and exact-head upgrade proof must be independently checked before calling it the best fix. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8738fe135461. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
Real-behavior proof is now recorded in the PR body. Here is the complete redacted result and its boundary. Environment identity
Pre-migration state
Plan and applyThe read-only plan targeted the named agent and completed with: The planned actions were the OpenAI auth import into the selected agent's canonical auth store and archival of the migrated Codex config. Cached plugin bundles were skipped. An unrelated plugin-list timeout warning did not prevent planning or applying the migration. The applied command was: docker exec <container> openclaw migrate apply codex \
--agent <non-default-agent> \
--from <agent-codex-home> \
--include-secrets --yesThe migration succeeded and populated both Post-migration behavior
Proof boundaryThis run proves the real upgrade recovery path from missing canonical auth, through explicit named-agent migration, to a successful managed Codex turn. It does not prove the new actionable pre-migration diagnostic text. At the time of the pre-migration failure, the container was loading an older globally installed Codex plugin ( Direct dependency contractI also inspected OpenAI Codex directly at
This confirms there is no dependency-level implicit fallback from managed ephemeral auth to the old agent-scoped @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Maintainer review on exact head 194c7d6: approved.
I accept the explicit recovery boundary and the public --agent/--item migration surface. This does not auto-import legacy Codex secrets: managed local stdio startup fails before a model request only when canonical agent auth and supported API-key fallbacks are absent, and the operator must explicitly run migrate --include-secrets --item auth:openai for the validated agent.
Direct dependency check at openai/codex d72d669ca727a26765315ffe03db3dd2594d9b91 confirmed ephemeral storage is memory-only (codex-rs/config/src/types.rs:87, codex-rs/login/src/auth/storage.rs:455, codex-rs/login/src/auth/manager.rs:1230). Exact-head Testbox run 30691298503 exercised the real named-agent CLI path and produced the scoped preflight commands without a downstream 401; CODEX_API_KEY and OPENAI_API_KEY fallback regressions pass. Hosted CI and CodeQL are green. ClawSweeper found no actionable code or security findings; its remaining proof warning is an access limitation in that reviewer environment, not an unmet product proof item.
|
@clawsweeper re-review |
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Maintainer approval refreshed on exact head f2806c5 after current-main integration. Direct Codex inspection at d72d669ca727a26765315ffe03db3dd2594d9b91 confirms ephemeral auth is memory-only (codex-rs/config/src/types.rs:87, codex-rs/login/src/auth/storage.rs:455, codex-rs/login/src/auth/manager.rs:1230). Exact-head Testbox run 30697086713 built OpenClaw f2806c5 and exercised a real named-agent turn: it failed before provider I/O with only the validated --agent research --include-secrets --item auth:openai commands, with no downstream 401 or secret disclosure. API-key fallback regressions pass. The public boundary is accepted: no automatic import and no runtime file fallback; SQLite stays canonical and secret migration requires explicit operator consent.
|
🦞🧹 I asked ClawSweeper to review this item again. |
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Owner decision on exact landing head 9968708: approved. ClawSweeper reports no findings and no security issues; its sole remaining rank-up move is satisfied by direct sibling ../codex inspection at d72d669ca727a26765315ffe03db3dd2594d9b91. Ephemeral storage is memory-only in codex-rs/config/src/types.rs:87-100 and codex-rs/login/src/auth/storage.rs:455-524; empty ephemeral auth has no persisted-file fallback in codex-rs/login/src/auth/manager.rs:1230-1277. Blacksmith Testbox proved the unchanged auth implementation at f2806c5 on a real named-agent turn. The only f2806c5..9968708 movement is upstream cron child-delivery commit e9e4023, with no Codex/auth/migration/CLI/config/shared-lifecycle overlap and an unchanged 17-file PR diff. I accept the explicit-consent boundary: no automatic secret import and no runtime auth-file fallback; SQLite remains canonical.
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Maintainer approval refreshed on exact head cb76775 after merging current upstream main through 142ad75. The intervening doctor auth refactor (#117361) does not touch this PR’s startup bridge, explicit migration CLI, or fixtures; 226 focused exact-head tests and a fresh clean autoreview (0.97, TruffleHog clean) confirm the unchanged 17-file diff. Direct Codex inspection at d72d669ca727a26765315ffe03db3dd2594d9b91 confirms ephemeral storage is memory-only in codex-rs/config/src/types.rs:87-100 and codex-rs/login/src/auth/storage.rs:455-524, with no persisted fallback from empty ephemeral auth in codex-rs/login/src/auth/manager.rs:1230-1277. Testbox run 30697086713 proves the explicit named-agent preflight boundary. I accept the consent boundary: no automatic secret import or runtime auth-file fallback; SQLite remains canonical.
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Maintainer approval refreshed on exact head 409d495. The 17-file auth/migration/docs change remains byte-for-byte unchanged from the Testbox-proven implementation; the only added line makes the dedicated TUI PTY Vitest config report per-test progress so the current low-core fork-PR path cannot kill valid work at its 120-second no-output watchdog. That CI failure reproduced three times, while the same tests passed with verbose progress; exact-head harness proof is 49/49. Fresh complete-branch autoreview is clean (0.98; TruffleHog clean). Direct Codex inspection at d72d669ca727a26765315ffe03db3dd2594d9b91 still confirms the accepted boundary: ephemeral auth is memory-only with no persisted fallback, and secret import remains explicit and agent-scoped.
fuller-stack-dev
left a comment
There was a problem hiding this comment.
Maintainer approval refreshed on exact head a6228bc. The only movement from reviewed head 409d495 is upstream main PR #117399 under extensions/xai; it does not touch or call the 18-file auth/migration/TUI-reporter diff, so the clean branch autoreview, 226 focused auth tests, 66/66 hosted built-CLI PTY proof, direct Codex contract inspection, and accepted explicit-consent boundary remain valid.
|
Merged via squash.
|
* fix(codex): diagnose unimported agent auth Add agent-scoped Codex migration guidance and expose a validated --agent target so non-default credentials cannot be imported into the default agent store. Fixes openclaw#116763 * fix(codex): surface auth migration before route planning * fix(codex): scope auth migration recovery * fix(codex): preserve API key auth fallback * test: repair memory importer routing expectation * test: drop superseded memory routing repair * test(tui): report PTY progress verbosely --------- Co-authored-by: fuller-stack-dev <[email protected]>
Closes #116763
What Problem This Solves
Managed agent-scoped Codex runs now use OpenClaw's canonical SQLite auth store and launch Codex with an ephemeral credential store. An installation that still has only
agents/<id>/agent/codex-home/auth.jsontherefore reaches a downstream authentication failure after upgrading.This PR detects that exact upgrade state before a model request and gives an agent-scoped, auth-only recovery command.
Boundary
This change does not automatically import OAuth material and does not restore a runtime fallback to Codex's file store.
CODEX_API_KEY/OPENAI_API_KEYfallback continue normally.--include-secretsand target both the validated agent (--agent <id>) and exact migration item (--item auth:openai).The durable invariant is: legacy Codex credentials remain inert until explicit secret-import consent, while a selected Codex route with neither canonical auth nor a supported fallback fails before a model request with an exact command for the owning agent.
Evidence
main(17 auth/migration/docs files plus one TUI test-reporting line required by the current fork-PR CI path).cb767758240e8279b3e39c1339cbaf941994243aacross CLI migration/context/item selection and Codex auth bridge/shared-client/startup behavior; the focused remote-WebSocket sibling passed 8/8 when rerun in isolation. Exact head409d495bd5c90494bb867f2eb4f787f470eb3d16also passed the progress-reporting PTY harness 49/49.researchand not default agentmain.CODEX_API_KEYandOPENAI_API_KEYfallback regressions pass.409d495bd5c90494bb867f2eb4f787f470eb3d16: clean, 0.98 confidence, no actionable findings; TruffleHog clean. Final heada6228bc98bdddbb67aec832ff84d135da039a175adds only upstream xAI lifecycle movement and leaves the reviewed 18-file diff unchanged.pnpm build, the full repository check gate, focused formatting, andgit diff --checkpassed. A local macOS full-suite attempt exercised the relevant Codex/OpenAI shards successfully; its remaining failures reproduced current-main/platform assumptions (for example/varvs/private/var, Bash 3, missing GNUtimeout, hostlaunchctl, and timing-sensitive QA shards), so Linux hosted CI remains the merge gate.Landing-head diagnostic proof
The exact auth implementation head
f2806c54a7a5c8d6da4fbb90b6315eeef79388eawas built on Blacksmith Testbox leasetbx_01kyyg4hca315k4q81vr7dk808(run). The built checkout reportedOpenClaw 2026.7.2 (f2806c5)and loaded the bundled Codex plugin. Final landing candidatea6228bc98bdddbb67aec832ff84d135da039a175merges current upstreammainthroughb830a658217a02154c66a713b6060010b3f3e069. The only intervening auth-adjacent change is doctor JSON-to-SQLite ownership refactor #117361; it does not touch the 17-file auth surface, Codex startup bridge, explicit migrate CLI, or their fixtures. Upstream #117331 moved the slow TUI PTY smoke intobuild-artifacts, but fork PRs use the low-core hosted path and its 120-second no-output watchdog killed the buffered reporter. An isolated exact-head diagnostic passed 16/16 in 325.5s with verbose progress, and the final one-line config repair passed its PTY harness 49/49. The auth diff and implementation remain byte-for-byte unchanged from the tested implementation head.A synthetic
researchagent had an agent-scopedcodex-home/auth.json, no OpenClaw auth profile, no fallback API-key environment variable, and a model-scoped Codex runtime. A real local agent turn returned:The proof asserted both exact commands, nonzero agent-turn exit, and absence of downstream
No API key found,401 Unauthorized, or synthetic credential values.Migration and post-migration behavior
Earlier container proof exercised the explicit migration against an existing non-default agent.
migrate planselected the agent's Codex home and auth item;migrate apply --include-secrets --yespopulated that agent's SQLiteauth_profile_storeandauth_profile_state; the default agent remained untouched. After restart, a real managed turn completed withpost-migration proof, and the container stayed healthy with zero restarts.Direct Codex contract check
Direct inspection of OpenAI Codex at
d72d669ca727a26765315ffe03db3dd2594d9b91confirms the dependency behavior:AuthCredentialsStoreMode::Ephemeralis process-memory-only.EphemeralAuthStorageuses the in-memory map rather thanauth.json.load_authreturns no persisted fallback when that ephemeral store is empty.That is why this PR keeps SQLite as the owner and stops with explicit migration guidance instead of silently reading or importing the legacy file.