-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: Codex OAuth relogin creates fresh named profile but lastGood keeps selecting stale default on 2026.5.18 #84386
Copy link
Copy link
Closed
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug type
Authentication / profile selection regression
Summary
This appears to be the same failure mode as #57286, but that issue is locked so I cannot add the requested current-build reproduction there.
On OpenClaw 2026.5.18, running
openclaw models auth login --provider openai-codexsuccessfully created a fresh named OAuth profile, andmodels auth order setwas used to put that fresh profile first. However,auth-state.jsonstill moved/keptlastGood.openai-codexon the olderopenai-codex:defaultprofile. Since the installed selection path preferslastGoodbefore the first ordered profile, runtime/status can continue selecting stale default credentials unless the operator manually edits/copies auth profiles.Environment
2026.5.18 (50a2481)codex-cli 0.130.0openclaw models auth login --provider openai-codexSteps to reproduce
Start with an existing
openai-codex:defaultOAuth profile near expiry.Run:
Complete OAuth. In this case the login wrote a fresh named profile:
Set provider auth order to prefer the fresh named profile:
Check
~/.openclaw/agents/main/agent/auth-state.json.Expected behavior
After successful reauth and explicit auth-order selection, OpenClaw should either:
lastGood.openai-codexto the fresh profile,lastGoodfor that provider,lastGoodwhen choosing an active profile.The fresh profile should be the effective profile without manual auth-store edits.
Actual behavior
After successful login, the agent had two profiles:
The order was set correctly:
{ "order": { "openai-codex": [ "openai-codex:<email>", "openai-codex:default" ] } }But
lastGoodstill selected the old default profile:{ "lastGood": { "openai-codex": "openai-codex:default" } }The installed 2026.5.18 bundle appears to prefer
lastGoodahead of the first ordered profile when the lastGood profile is present in the order and not currently marked unusable/cooldowned:Workaround
The robust local workaround was to copy the fresh named OAuth credential material into
openai-codex:defaultas well. After that, both profile ids reported the new expiry:Then this verification passed:
Why this is worth tracking
This is not only a UI/status issue. The operator-visible recovery path after OAuth renewal still required manual auth-store surgery, even after:
models auth login --provider openai-codex,models auth order set,The closest existing issue is #57286, but it is locked and cannot receive the requested current-build reproduction comment.
Redaction
No tokens, auth codes, account ids, hostnames, chat ids, or personal identifiers are included here. The email-bearing profile id is redacted as
openai-codex:<email>.