Repository navigation
fix(doctor): surface the resume failure cause for interrupted auth-profile archives - #123459
Conversation
…ofile archives maybeMigrateAuthProfileJsonStoresToSqlite discarded the error from resumePendingAuthProfileMigrationArchives entirely, so the warning was always the same generic string regardless of which of 5 distinct causes fired (invalid receipt, target verification failure, lock failure, SQLite failure, corrupt JSON). PR openclaw#123164 fixed the identical defect class in the sibling shared-OAuth catch block 20 lines below in this same function, explicitly modeling the fix on the third, already-correct sibling. This was the unaddressed third catch block in that same family.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 8:54 PM ET / August 26, 2026, 00:54 UTC. ClawSweeper reviewWhat this changesAdds the caught failure cause to Doctor’s interrupted auth-profile archive warning and covers that operator-visible diagnostic with a regression test. Merge readinessKeep open for routine merge review: current main still drops the resume error cause, while this narrow PR restores it with focused regression coverage and no actionable patch defect found. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherDoctor runs auth-profile migration recovery before inspecting and repairing legacy credential stores. A failed archive resume stops further migration to preserve recovery state, and its warning is returned to Doctor’s operator output. flowchart TD
A[Doctor run] --> B[Auth-profile migration recovery]
B --> C[Pending archive receipts]
C --> D{Resume succeeds?}
D -->|Yes| E[Continue migration]
D -->|No| F[Preserve recovery state]
F --> G[Warning with failure cause]
G --> H[Operator output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +44. Total +43 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk options
Maintainer options:
Technical reviewBest possible solution: Land this caller-boundary diagnostic repair after exact-head checks pass, retaining the recovery-preserving early return and the existing sibling warning convention. Do we have a high-confidence way to reproduce the issue? Yes—source establishes a current-main path: an invalid pending receipt throws during resume, and the caller converts it to a generic warning. The branch’s real SQLite before/after capture exercises that path, though this review did not execute it. Is this the best way to solve the issue? Yes. The caller that turns recovery failures into Doctor warnings is the narrowest owner for preserving the cause, and the change matches the two existing sibling handlers without altering migration or archive semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0036788055b5. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
Reopening to re-trigger CI attach (known pull_request-open race). |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…ofile archives (openclaw#123459) maybeMigrateAuthProfileJsonStoresToSqlite discarded the error from resumePendingAuthProfileMigrationArchives entirely, so the warning was always the same generic string regardless of which of 5 distinct causes fired (invalid receipt, target verification failure, lock failure, SQLite failure, corrupt JSON). PR openclaw#123164 fixed the identical defect class in the sibling shared-OAuth catch block 20 lines below in this same function, explicitly modeling the fix on the third, already-correct sibling. This was the unaddressed third catch block in that same family.
Related: #123164
What Problem This Solves
Resolves a problem where
openclaw doctor/openclaw doctor --fixusers whose interruptedauth-profile archive fails again on a later resume attempt cannot tell why it failed — the warning is
always the same generic sentence no matter which underlying cause fired.
Why This Change Was Made
maybeMigrateAuthProfileJsonStoresToSqlite(src/commands/doctor-auth-flat-profiles.ts) has threesibling
catchblocks around auth-profile migration steps. #123164 fixed the identical defect in thesibling catch block that migrates shared legacy OAuth credentials, changing it from a bare
catch {}that dropped the error to
catch (err)with`: ${String(err)}`appended. This PR fixes theone remaining sibling — the catch block wrapping
resumePendingAuthProfileMigrationArchives, whichcan throw for several distinct reasons (invalid receipt shape, target verification failure, lock
contention, SQLite failure, corrupt receipt JSON) — the same way. Migration behavior is unchanged;
only the diagnostic text changes.
Real behavior proof
Behavior addressed:
maybeMigrateAuthProfileJsonStoresToSqlite's resume-pending-archivecatchblock discards the caught error instead of surfacing its cause in the user-visible warning.
Real environment tested: real Node process, real SQLite state DB (via
createOpenClawTestState,layout: "state-only"), real function under test (maybeMigrateAuthProfileJsonStoresToSqlite)driven with no mocking of the code path being proved. Not a full end-to-end reproduction: the
pending-migration-receipt row is seeded directly via the existing test-only helper
(
recordAuthProfileMigrationImported, exposed bysrc/commands/doctor-auth-migration-receipts.tsunder
globalThis[Symbol.for("openclaw.authProfileMigrationReceiptsTestApi")]whenNODE_ENV=test—the same seeding pattern
src/commands/doctor-auth-migration-receipts.test.tsuses for thisfunction's other resume paths) rather than produced by killing a real
doctorprocessmid-migration.
Exact steps or command run after this patch: a standalone script sets
NODE_ENV=test, seeds onepending migration receipt with
targetTableset to a value outside its 3-member union (soresumePendingAuthProfileMigrationArchives's row-shape check throws"invalid pending auth profile migration receipt"), calls the realmaybeMigrateAuthProfileJsonStoresToSqlite, and printsresult.warnings— run once against the basecommit and once against this PR's head to produce the before/after captures below.
Before evidence (base
c66d5d84db4d473bbbfb51cc6f14e82d61623ee6, production code exactly as it was before this PR's diff):Evidence after fix (head
aa58e5d08463f19ad95f642383b5992945a26231):Observed result after fix: the warning string now ends with
: Error: invalid pending auth profile migration receiptinstead of a bare period.What was not tested: the other 4 real throw causes inside
resumePendingAuthProfileMigrationArchiveswere not individually reproduced — the fix (
${String(err)}on whatever was caught) is cause-agnostic,so this one cause is representative, not exhaustive.
Proof limitations or environment constraints: temporary SQLite state dir under the OS temp directory,
not a real user state directory.
Evidence
Changed files:
src/commands/doctor-auth-flat-profiles.ts(production, +2/-3, no new imports, nologic change) and
src/commands/doctor-auth-flat-profiles.test.ts(+44, one new regression test usingthe same receipt-seeding approach as the proof above, inside
vitest). Confirmed the test fails onpre-fix code (matches the raw "before" capture above) and passes after the fix.
node scripts/run-vitest.mjs src/commands/doctor-auth-flat-profiles.test.ts— 52/52 pass (full file)../node_modules/.bin/oxfmt --check src/commands/doctor-auth-flat-profiles.ts src/commands/doctor-auth-flat-profiles.test.ts—All matched files use the correct format.node scripts/run-oxlint.mjs src/commands/doctor-auth-flat-profiles.ts src/commands/doctor-auth-flat-profiles.test.ts— exit 0, no output.pnpm tsgo:core— exit 0.--mode local) —autoreview clean: no accepted/actionable findings reported.Non-Scope
resumePendingAuthProfileMigrationArchivesitself — not touched, only the caller'scatch.Failed to migrate auth profile JSON for ...) —no change needed.