-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: SecretRef migration silently drops OAuth profiles from auth-profiles.json #86756
Copy link
Copy link
Closed
Closed
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.ClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.Can lose, corrupt, or silently drop user/session/config data.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.Decent issue quality, but reproduction details are still incomplete.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
On OpenClaw 2026.5.22, a SecretRef/static-secret migration path silently removed OAuth profiles from auth-profiles.json.
This is related to existing OAuth/runtime snapshot issues, but the observed failure mode here is different: the OAuth profiles were not merely unavailable in an in-memory runtime snapshot; the profile entries disappeared from auth-profiles.json and had to be recreated by re-running OAuth login.
Environment
Observed behavior
After migrating static tokens to local-file SecretRefs, static-token auth was correctly externalized and openclaw secrets audit reported clean static SecretRefs.
Separately, OAuth profiles were silently dropped from auth-profiles.json. The affected setup lost at least:
There was no clear warning and no config-audit trail for the auth-profiles.json write. The gateway itself stayed up and local CLI commands still worked, but agent runs failed once they needed the missing OAuth profile.
The user-visible failure in a cron run was:
Re-authenticating restored the profile:
After reauth:
Expected behavior
SecretRef/static-token migration should preserve OAuth profiles, especially profiles represented by oauthRef/credential-sidecar entries.
If a migration intentionally cannot handle OAuth profiles, it should:
Suspected root cause
The doctor/auth OAuth-sidecar migration path appears to handle static-token profiles but not OAuth profiles whose auth data is represented by oauthRef / credential sidecar references.
For type=oauth profiles with oauthRef.id pointing into a credential sidecar, the migration appears to remove the profile entry instead of preserving it or warning.
Also, config-audit.jsonl tracks openclaw.json writes, but not auth-profiles.json writes, so there is no obvious audit trail for this destructive auth-profile change.
Impact
This breaks Codex/Claude OAuth-based agent runtimes after an otherwise successful static SecretRef migration.
The failure is easy to recover from once recognized, but it is silent and confusing:
Workaround
Run this after SecretRef migration / doctor --fix / configure / plugin work:
If the OAuth profile is missing:
Related issues
This may be related to OAuth auth-profile snapshot issues such as #85521, but #85521 describes a runtime snapshot clobber where the on-disk auth profile survives. This report is specifically about the profile being removed from auth-profiles.json during migration/config write behavior.