fix(auth): point Keychain-only legacy Codex OAuth users at doctor instead of auto-prompting#86220
Conversation
…acy Codex OAuth profiles
|
Codex review: needs maintainer review before merge. Reviewed May 24, 2026, 6:57 PM ET / 22:57 UTC. Summary PR surface: Source +30, Tests +142, Docs +1. Total +173 across 7 files. Reproducibility: yes. from source inspection: current main skips Keychain reads when 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 migration owned by doctor, and merge this warning path only if maintainers accept warning-only remediation as the right resolution for the remaining Keychain-only bucket; otherwise keep self-heal tracked separately. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main skips Keychain reads when Is this the best way to solve the issue? Mostly yes if the maintainer decision is warning-only remediation: the patch keeps migration in doctor and avoids startup prompts. It is not the original self-heal acceptance path, so the product decision should be explicit before merge. Codex review notes: model gpt-5.5, reasoning high; reviewed against 8ae997749d3a. Label changesLabel justifications:
Evidence reviewedPR surface: Source +30, Tests +142, Docs +1. Total +173 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 Clockwork Signal Puff Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
…acy Codex OAuth profiles (openclaw#86220)
Summary
Alternative to #85163 closing the same bucket from #85083 (macOS users whose legacy
oauthRefsidecar seed lives only in the Keychain), but without an auto-prompt startup hook.#85163 reuses the existing
maybeRepairLegacyOAuthSidecarProfilesdoctor flow as a pre-command hook inrunCli, so every non-skipped interactiveopenclawinvocation on darwin can fire a Keychain migration prompt. That works, but trades a wide and growing skip surface (five ClawSweeper rounds,--non-interactive/--yes/--no-input/--force/--json/channels remove --deleteand counting) for the auto-heal property — and it violates the AGENTS.md rule:This PR takes the inverse design: keep doctor as the only place that migrates, and make sure affected headless users see a single, actionable error pointing at it instead of a silent fall-through to
No API key found for provider "openai-codex".Approach
Three concrete pieces, ~40 lines net:
src/agents/auth-profiles/legacy-oauth-sidecar.ts— whenloadLegacyOAuthSidecarMaterialreturns null on darwin withallowKeychainPrompt: false(i.e., env/file seeds were tried and Keychain was blocked), emit a singlelog.warnper process namingopenclaw doctor --fixand macOS Keychain. Rate-limited so embedded turns log it once per gateway lifetime, not per attempt. Guarded by the same VITEST env signals as the keychain read so unrelated test runs don't surface it.src/commands/doctor-auth-oauth-sidecar.ts— drop the user-confusingsidecar-backedphrasing from the doctor prompt, notes, and changes (users don't know what a sidecar is); internal identifier names are left intact.docs/gateway/doctor.mdaccordion 5 to mention the new headless warning alongside the existing doctor-driven migration; add a single CHANGELOG bullet.What this deliberately doesn't do
runClipre-command hook. No new file insrc/cli/.openclaw doctor --fix. Users who upgrade into the Keychain-only state see one warning telling them what to run; doctor remains the single place that prompts.OPENCLAW_AUTO_MIGRATE_LEGACY_OAUTH_SIDECAR), no skip ladder. Nothing to bypass because nothing prompts.maybeRepairLegacyOAuthSidecarProfilessemantics. Doctor still migrates exactly the same way it has since Keep legacy Codex OAuth sidecar profiles usable #83312.Trade vs. #85163
openclaw doctor --fixopenclaw doctor --fix)channels remove --deletewas the latest)openclaw statuscan surprise-prompt the userAGENTS.md"Legacy config repair belongs in doctor"The cost of this design is honesty: we tell affected users they have one command to run instead of trying to auto-heal them silently. That cost is bounded — the headless warn is loud, actionable, and survives across restarts;
openclaw doctor --fixis the one-line remediation. The benefit is the entire ClawSweeper skip-rule treadmill plus the AGENTS.md tension go away.Regression tests
src/agents/auth-profiles/legacy-oauth-sidecar.test.ts(new) — exercises the headless warn path: emit once when blocked on darwin with no env/file seeds; never emit on non-darwin; rate-limited per process.Verification
node scripts/run-vitest.mjs src/agents/auth-profiles/legacy-oauth-sidecar.test.ts src/commands/doctor-auth-oauth-sidecar.test.ts src/commands/doctor/repair-sequencing.test.ts— 21/21 green (4 files; one is a co-resident sibling).node scripts/run-oxlint.mjsclean on all touched files;oxfmt --checkclean.Related