Repository navigation
fix: doctor loops forever on legacy OAuth profiles with missing sidecars - #123093
Conversation
Persist missing-sidecar OAuth profiles as cold SQLite rows and make startup migration warnings deterministic.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 13, 2026, 5:16 AM ET / 09:16 UTC. ClawSweeper reviewWhat this changesThe PR migrates legacy OAuth profiles with missing sidecars into unavailable SQLite rows and makes Gateway startup migration warnings consistently block readiness. Merge readiness⛔ Blocked by patch quality or review findings - 5 items remain Keep open: the new archive path can discard a usable shared OAuth credential while retaining an ineligible legacy reference for the same profile, leaving the operator unable to authenticate after Doctor completes. Priority: P1 Review scores
Verification
How this fits togetherDoctor migrates legacy auth JSON and OAuth files into OpenClaw’s canonical SQLite auth-profile store. Gateway startup preflight then consumes migration warnings and the stored profile eligibility to decide whether startup can proceed. flowchart LR
A[Legacy auth profile JSON] --> B[Doctor migration]
C[Shared OAuth file] --> B
B --> D[SQLite auth profile store]
D --> E[Profile eligibility]
E --> F[Gateway startup and provider access]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -82, Tests +51. Total -31 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Make the shared OAuth import replace an existing unusable OAuth ref with usable OAuth material for the same profile, then prove the final canonical profile is eligible before archiving either source. Do we have a high-confidence way to reproduce the issue? Yes, from source: use the changed fixture’s unresolved legacy openai:default ref plus its usable shared OAuth entry, then inspect eligibility after Doctor migration. The read-only review did not execute the test. Is this the best way to solve the issue? No. Archiving both files is only safe after the canonical profile contains usable OAuth material; the current merge preserves the unusable ref and drops the usable collision candidate. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ed9bc2bd296. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…ars (openclaw#123093) * fix(doctor): converge missing OAuth sidecar migration Persist missing-sidecar OAuth profiles as cold SQLite rows and make startup migration warnings deterministic. * test(doctor): restore OAuth sidecar fixture id
What Problem This Solves
Fixes an operator dead-end loop: a legacy
auth-profiles.jsoncontaining an OAuth profile whose sidecar state is missing made the gateway refuse startup with "runopenclaw doctor --fix" — while doctor completed successfully, deliberately left that profile in the legacy file, and told the operator to rerun doctor. The instruction loop never terminated; the gateway never started. Hit in practice when restoring partial backups or copying an agent directory between installs.Also fixes boot-to-boot inconsistency where the same startup-migration warning was non-fatal on one boot and blocked readiness on the next (fatality depended on whether the startup checkpoint needed renewal).
Why This Change Was Made
Doctor pruned unresolved OAuth profiles before SQLite import and retained the legacy JSON, so the gateway's migration preflight kept demanding doctor forever. Doctor now migrates ref-only OAuth profiles into SQLite as configured-unavailable rows carrying no credential material (they can never authorize anything; re-authentication is the terminating action, and the warning says so), then archives the legacy JSON so the preflight stops firing. The whole pre-import pruning machinery became dead and was deleted. Migration warnings now deterministically block readiness whenever gateway startup migrations run, instead of depending on checkpoint state.
User Impact
openclaw doctor --fixalways converges: after one run the gateway starts, cold profiles are visible as needing re-authentication, and no instruction loop remains. Startup behavior is the same on every boot given the same state.Evidence