Repository navigation
fix(doctor): keep saved auth profiles aligned during migration - #143429
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 9, 2026, 11:41 PM ET / September 10, 2026, 03:41 UTC (Revision 6). ClawSweeper reviewWhat this changesDoctor migrates retired authentication identifiers while preserving credentials, account order, configuration references, and saved session selections across interrupted repairs. Merge readiness⛔ Blocked before merge - 4 items remain This remains a useful migration repair, and the prior code findings are resolved. Updated Doctor observations cover the previously missing recovery cases; the remaining blocker is an attributable acceptance record for the durable recovery contract. Priority: P2 Review scores
Verification
How this fits togetherDoctor repairs configuration and persisted state during upgrades. This migration connects shared and agent-local credentials to the account references that subsequent agent sessions use. flowchart TD
A[Legacy credentials and saved references] --> B[Doctor migration]
C[Shared and agent databases] --> B
B --> D[Verify account identity and collisions]
D --> E[Durable recovery receipts]
D --> F[Preserved credentials and updated selections]
D --> G[Unresolved accounts retained with warnings]
E --> B
Decision needed
Why: The body asserts authorization, but the repository requires an attributable acceptance record for this persistent recovery contract; source inspection cannot establish that intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource +823, Tests +1129, Docs +1, Other 0. Total +1953 across 15 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep account-preserving migration in Doctor, with the durable receipt and recovery behavior explicitly accepted by the storage owner. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes the narrower current-main migration path, and the supplied Doctor observations identify concrete interrupted-write and destination-collision scenarios; this reviewer did not execute them. Is this the best way to solve the issue? Yes, using one collision-aware mapping and the existing storage owners is a coherent repair; acceptance of its persistent recovery contract remains separate from code correctness. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5b6a23012177. LabelsLabel changes:
Label 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 (5 earlier review cycles)
|
|
landpr-approve-unrelated-red |
|
Landed as Doctor now keeps saved credentials, account orders, configuration references and session pins aligned during retired-identifier migration. It preserves unresolved accounts and continues independent safe work. The old arbitrary string replacement is removed.
Proof: Real CI exception: Run 34430052259 completed. Job 102723592487 failed six The exact main-parent comparison changes only this repair's 15 files. Discord's recording/fixture code is unchanged, and the failing synthetic voice path does not invoke Doctor. No matching main failure, underlying voice cause or introducing commit was established. The guarded merge used the recorded standing exception. All credentials were synthetic. Captured proof covers saved-state repair; it does not claim live provider authentication, process-kill behavior or cross-database atomic commits. Earlier failures, source/build identities, review limits and stop receipts remain retained. |
…law#143429) ## Problem `openclaw doctor --fix` could leave saved authentication references out of sync with renamed credentials, account order, or session pins. Interrupted repair could select a missing account, adopt a recreated credential, or choose an unrelated local account at a recovered destination. ## Repair Doctor applies one collision-aware mapping across existing shared and agent stores, legacy imports, config, rotation state, and session selections. It preserves credentials, explicit empty config orders, unresolved custom orders, and unsafe stores, and removes the old arbitrary string replacement. Recovery uses the existing migration receipts and authenticated archive reader. It retains source and destination-store provenance, combines separately verified imports of the same mapping, and rejects unverified destinations. SQLite inspection includes the main agent's distinct local store after shared-store relocation; legacy JSON keeps its shared import owner. Independent safe mappings can continue. This remains the authorized Doctor migration and recovery scope: no schema, separate store, runtime alias table, or login policy is added. Database commits retain their existing independent boundaries. ## Validation The current compiled build is `e58426c36aa0dd59f5bbb793bbc50ddbf7fbb8cb`, with candidate parent `026dce9de37f0685bfa800f04a263810233dec80`. Its artifact digest, complete file inventory, launcher manifest and dependency inputs were verified before use. The following observations use the real public Doctor command and persisted state readback: | Case | Observed result | | --- | --- | | Config write denied after flat credential import | Doctor reports `EACCES`; the original credential is committed while config and the user-selected session pin retain the old reference. | | Different local account occupies the recovered destination | Doctor warns that the old profile remains unresolved. The old config reference and user pin stay unchanged; both stored accounts remain intact. | | Independent safe account beside that conflict | The independent credential and config order migrate to their canonical identifier. | | Remove only the synthetic local conflict and retry | The original account is recovered, the saved user pin is updated, and `models auth list --agent main --json` lists it. | | Two legitimate stores import the same retired identifier | Shared and worker credentials remain distinct. Config and both saved user pins migrate coherently. A second Doctor invocation preserves the result. | The collision command reports: ```text Kept auth profile claude-cli:default unchanged because its provider realm or identity is unresolved. ``` Earlier real Doctor comparisons retain their original source/build identities and cover collisions, restricted orders, invalid stores, rotation state, public listing, session pins, config-write recovery, and rejection of a recreated source ID. The earlier failed main-local and two-import observations remain recorded. Only their missing corrected cases were run on the current build. Normal isolated pre-commit and syntax checks passed over all 15 candidate files. [Current CI](https://github.com/openclaw/openclaw/actions/runs/34430052259) is complete. The Doctor-auth shard passed 178 tests. The three new migration/preservation/import-recovery files also passed in [unit-fast-1](https://github.com/openclaw/openclaw/actions/runs/34430052259/job/102723592343) and [unit-fast-2](https://github.com/openclaw/openclaw/actions/runs/34430052259/job/102723592436), including main/worker destination collisions and two independently verified imports. The overall run is red because eight Discord voice recording tests failed in [changed-extensions-bundle-13](https://github.com/openclaw/openclaw/actions/runs/34430052259/job/102723592487), which also fails the aggregate. Those tests exercise an unchanged synthetic voice recording path and do not invoke Doctor; the exact main-parent comparison changes only this PR's 15 files. No matching main failure or underlying voice cause is claimed. All accounts are synthetic; no provider request or live credential is used. Missing fixtures were rebuilt through Doctor after the prior host ended; no old database continuity or fabricated recovery receipt is claimed. The captures establish the observed migration and recovery paths, not a process-kill or cross-database atomic-commit guarantee. The read-only control is `doctor --lint`, not an interactive decline capture. Fresh independent acceptance and exact-head review remain required before landing. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Doctor could leave saved authentication references out of sync after credential renaming. Interrupted repair could select a missing account, adopt a recreated credential, or use an unrelated local account.
Why This Change Was Made
Doctor applies one collision-aware mapping to credential stores, imports, configuration, rotation state, and session selections. Recovery retains verified source and destination provenance, combines legitimate imports, and refuses unverified destinations. Explicit empty orders, unresolved custom orders, and unsafe stores are preserved.
User Impact
Safe mappings repair without replacing unrelated credentials or user-selected session accounts. Conflicts remain unchanged with a warning and can be retried after correction. No schema, runtime alias table, or login-policy change is added.
Consumers: credential references, account order, and saved session selections now follow the same verified mapping.
Evidence
Public Doctor commands covered denied writes, destination collisions, safe mappings, recovery after conflict removal, and two legitimate imports. Repeat repair preserved results. The Doctor authentication suite passed 178 tests, and migration/recovery suites passed. Continuous integration had eight failures in unchanged voice-recording tests; no matching baseline failure was established. Accounts were synthetic, with no provider requests. Process-kill recovery and atomic commits across databases were not proved.