Repository navigation
fix(doctor): avoid stale migration checks when archiving retained sessions - #149964
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: needs maintainer review before merge. Reviewed September 16, 2026, 8:10 AM ET / 12:10 UTC (Revision 3). ClawSweeper reviewWhat this changesDoctor checks pending plugin migrations through the active publication transaction before archiving retained session originals, with regression coverage and documentation. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main still uses the stale discovery reader. No blocking defect was found, and the completed published-updater evidence resolves the previous review’s proof gap. Priority: P2 Review scores
Verification
How this fits togetherDoctor imports legacy session history into SQLite and retains original files while plugins still need them. Its publication guard checks pending migration obligations before those originals can be archived. flowchart TD
A[Legacy session history] --> B[Doctor import and verification]
B --> C[Retained originals]
D[Pending plugin migrations] --> E[Current transaction check]
C --> E
E -->|Unchanged obligations| F[Verified archival]
E -->|Changed obligations| G[Preserve originals and warn]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +31, Docs +2. Total +33 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep discovery snapshots separate from publication checks, with archival decisions reading authoritative pending rows through the existing admitted transaction. Do we have a high-confidence way to reproduce the issue? Yes, source inspection establishes the stale-read path: change pending obligations inside the publication transaction, then assert either the prior or current generation. The supplied regression output demonstrates both failures; this read-only review did not execute them. Is this the best way to solve the issue? Yes. Reusing the existing transaction owner fixes the consistency boundary without weakening discovery isolation or adding another migration implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cf6f6d926fd8. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
243fb59 to
9223ec7
Compare
|
Merged via squash.
|
What Problem This Solves
Fixes Doctor accepting an old pending-plugin generation or rejecting the current one while archiving retained session migration inputs.
User Impact
Deferred-plugin completion checks the current publication transaction before removing original session files. Changed obligations still preserve those inputs and produce the existing repair warning. No configuration, CLI, dependency, schema, or public API change is required.
Why This Change Was Made
assertDeferredPluginMigrationsCurrentnow delegates to the existingwithDeferredPluginMigrationsCurrentowner. Its synchronous transaction rejoins the admitted connection and rereads authoritative pending rows. Ordinary discovery keeps its artifact-preserving committed-snapshot reader.The old assertion called that discovery reader from inside publication. The reader deliberately skips a transaction-held writer at
openclaw-state-db-readonly.ts:214and prepares a private snapshot atopenclaw-state-db-readonly.ts:260. That snapshot cannot see the transaction's current generation. The repair changes one production line, preserving the strict generation comparison and existing publication owner.This is a candidate-side Doctor correction over existing migration records. Backup, rollback, retained-source recovery, and the installed updater contract are unchanged.
Evidence
DeferredPluginMigrationConflictError.node scripts/check-changed.mjs: passed, including production/test typechecking, lint, export scans, database guards, and documentation checks.pnpm build: passed in 33m 9s, including CLI bootstrap, Doctor closure, SDK export, and UI size checks; zeroINEFFECTIVE_DYNAMIC_IMPORTdiagnostics.--mode branch --base origin/main, P1): scoped-clean, with no accepted/actionable P0/P1 finding. The exact local patch also passed its pre-commit P1 review.Red/green regression log excerpts
Before the fix:
After the fix:
Serial import-memory A/B
Same host, source base
5e27c4e4302ea0167b4c32ece076f84f734aec9a, exact test, alternating PRE/POST/PRE/POST. The three-file patch was saved, removed for PRE, and byte-verified after restoration for POST. Every run used one worker; no timeout or assertion was changed.UTC starts on 2026-09-16: 09:05:56, 09:10:24, 09:15:00, and 09:21:39. Total command time includes compilation, setup, and verified cleanup. Timeout values are censored observations, not completed import timings.
Each version passed once and timed out once. The successful POST test was 14.2% slower (14.9% total-command difference); the second pair both reached the same timeout, with POST taking less total command time. Under the agreed criterion of a repeatable >25% POST slowdown, these measurements classify the original timeout as host-load sensitive. No per-event workaround, retry, or timeout increase was added.
Sibling transaction audit
readStoredProposalreopens its cached writer; it does not use a private snapshot.No additional same-database stale-snapshot defect was found in these siblings, and no follow-up repair is proposed.
Volume cell — shipped-driver swap wall (classified)
Candidate
9223ec79e054f2e1fcba1e4c190433325ff0c6d5is the unchanged publication-guard patch rebased onto2ef2537cd0392bc825038936f244ecfc94457810, which includes #149956.git range-diffreports1 = 1; no code edits were made. The earlier unit/A/B/review evidence above was recorded at original head243fb59b1855c4a528400f8dedd88c3599a10790.This attempt does not qualify as a completed live migration/publication cell. The published updater failed during package installation/swap, before the post-core boundary. This is not the later F1 legacy-index assertion:
assert-automatic-migrationwas never reached.[email protected], resolved and installed from npm; registry tarball URL and integrity retained in the artifacts.25c26616786853411affb2af3b5d59089896b5712d1abec21fbb18161134256a.sqlite-volume; restart modemanual; command limit 1800s; Docker run limit 7200s. Image:openclaw-l448-cell.2026.9.4; 51.896sglobal update; 116.703sdoctor --fix --non-interactive --no-workspace-suggestions; 24.266sdoctor --lint --json --severity-min error; 14.115supdate-candidateoverallstatus=error,reason=global-install-failedThe failing step reports:
The before/after reported build IDs both identify the published baseline; the updater's final recovery object reports
serviceRestartSafe=true. These observations are retained as reported, not treated as proof of successful activation. Maintainer classification: this is the shipped 2026.9.3/2026.9.4 driver’s 30-second verification wall inside package swap, tracked by #146394. The unreleased main fixes include #144758 (continue after incomplete baseline fingerprints) and #144925 (allow full baseline fingerprints more time on slow disks). Both fixes are ancestors of this candidate and absent from the published 2026.9.4 source build3a9d69db306c. A candidate cannot retroactively change the installed driver’s first-hop budget. This volume-cell failure does not establish a defect in this PR’s publication guard.Archival/publication outcome: no live retained-session archival/publication result was established. The successful Doctor steps were candidate rehearsal/lint; the run failed before a post-core Doctor result or live migration/archive receipts were available. The passing base cell below now provides the completed published-driver × candidate migration/publication proof.
Artifacts are under
.local/l448-proof/cell/in the author worktree:cell-result.json,row-execution.json,raw/summary.json,raw/phases.jsonl,raw/update.json,raw/update.err,diagnostics/*/failure.json, package/registry manifests, build/pack logs, and the unchanged range-diff. The completed volume row’s disposable npm installation was removed after classification; its summaries, receipts, diagnostics, logs, tarball, and registry evidence remain. The owned container and image were removed. The lowest observed host free-space reading was 16.764 GiB, above the required floor.Base cell — passed: published driver × candidate migration/publication proof
Published
[email protected]updated to the unchanged candidate9223ec79e054f2e1fcba1e4c190433325ff0c6d5, using scenariobase, restart modemanual, command limit 1800s, and Docker run limit 7200s. The same validated tarball (sha256:25c26616786853411affb2af3b5d59089896b5712d1abec21fbb18161134256a) and candidate registry were reused. No code edit, rebase, fixture/assertion change, or timeout increase was made for this cell.Completed result: passed, exit 0, in 280.392s, on 2026-09-16 11:40:38–11:45:19 UTC. Updater JSON reports
status=ok,updateOutcome=success; the installed build changed from the published3a9d69db306crelease to9223ec79e054.[email protected]; baseline assertions passedok, exit 0ok, child exit 0ok, exit 0sessions.jsonabsent; all three canonical session identities, metadata and transcript history preservedRetained-source publication outcome: the first live Doctor explicitly reported
plugin_migration_source_retainedfor the imported index while Discord/WhatsApp work waited for the updating parent. Post-core convergence completed, a later Doctor receipt returnedokwith no pending-plugin warnings, and the automatic-migration assertion then verified that the original index was retired while all three sessions and their transcripts survived. This exercises the retained-source settlement/publication flow through the published updater. The base harness verifies retirement and canonical data preservation; it does not separately export an archive-file listing.Resource recovery: an earlier attempt of this same base cell was paused and resource-aborted during
update-candidatewhen host free space fell below the required floor. It exited 137 withOOMKilled=falseand produced no product verdict or completed migration proof. Its controller receipt, phase events and partial logs are preserved. Following scoped cleanup, free capacity recovered, and the identical cell was retried once. The completed attempt was not paused or resource-aborted; its minimum sampled free space was 33.97 GiB. Both attempts are disclosed here rather than treating the interrupted run as a pass.Artifacts:
.local/l448-proof/cell-base/completed-cell.jsonindexes the evidence. The passing run is under.local/l448-proof/cell-base/attempt-2/: nativeartifacts/summary.json,artifacts/phases.jsonl,artifacts/update.json, updater/Doctor observations, projected diagnostics,row.log, execution receipt and disk samples. The initial resource-aborted attempt remains at thecell-base/root. Owned containers/images and disposable runtime/npm-prefix trees were removed; summaries, phases, diagnostics and logs remain.