Skip to content

fix(doctor): retire deferred receipts and track migration backups - #162771

Merged
steipete merged 8 commits into
mainfrom
upd/upd-doctor-artifact-receipts
Oct 1, 2026
Merged

steipete merged 8 commits into
mainfrom
upd/upd-doctor-artifact-receipts

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #162525
Closes #162622

What Problem This Solves

Doctor could retain a completed deferred plugin import receipt indefinitely and silently skip later legacy history. Its pre-startup-migration SQLite backups were also absent from update cleanup.

User Impact

Doctor retires completed or explicitly disabled/uninstalled plugin obligations after verified archival. An active receipt preserves new input and reports the receipt, plugin, and next command. Canonical SQLite edits and deletions remain authoritative. After receipt recovery and retirement, new history imports in the same pass.

Update cleanup lists migration backups. Recorded groups stay protected until Doctor verifies migration completion and a subsequent update succeeds. Existing confirmation and offline ownership checks then permit retirement; unrecorded historical backups stay protected. Keep these files with your pre-upgrade backups while the matching rollback generation is needed.

Why This Change Was Made

The receipt owner had no retirement path, and the backup producer never registered its artifacts with cleanup. Doctor's retained-source owner now uses the existing removed-source state, pending-generation check, receipt equality, and strict archive/database verification. Original sources and the index must be absent before and inside the retirement transaction. Receipt rebuilding finishes before retirement; diagnostic callbacks and cached verification cannot authorize it.

The backup producer records exact artifacts in the existing recovery manifest. Doctor's readiness owner records completion, excluding refused databases; cleanup reuses its dependency protection and fenced disposal. The rebase preserves main's asynchronous zero-byte transcript recovery and scalar-state migration/maintenance authority. A successful-rebuild notice is informational, so it does not suppress discovery of eligible new history. The regression requires same-pass import of a complete conversation after receipt rebinding and retirement.

The compression pass removed 24 net lines of duplicated lifecycle plumbing, plus three lines by reusing existing content comparison and manifest handling. Final LOC: production +557/−166 (+391 net); tests +451/−3 (+448 net); docs +21/−2. Remaining production growth supplies receipt retirement/diagnostics and backup registration/completion/inventory facts, with guarded data preservation. Existing archival publication moved to its existing owner to meet line caps. There is one cleanup/disposal implementation and no final baseline changes.

No SQLite schema, dependency, configuration option, or CLI option changes. Candidate Doctor consumes existing operator state; recoverable failures preserve originals and produce warnings. Release-note context is in this description. Thanks to @shadow-enthusiast and @islandpreneur007 for the reports.

Evidence

Pushed head: 253d558337db012cc5b19aaab502210d17fa0682. Rebased onto 750b253a246e667e759caf926947042c2ea7077e after actual conflicts appeared in the shared Doctor owners. The PR is ready for review, auto-merge off; no landing is requested.

The own CI failure on 250dca44f9f59d93a8b1c4db38570390c9cff95a was reproduced with the maintainer-authorized exact local command:

node scripts/run-vitest.mjs src/commands/doctor-session-sqlite.receipt-retirement.test.ts
Before: 7 passed, 1 failed; expected importedEntries 1, got 0; 88.93 s wall.
After: 8 passed; 59.03 s wall, 52.19 s Vitest, 30.261 s total test time.

Root cause was the replacement-database test fixture: its later JSONL contained only a session header. The existing primary-transcript reader intentionally requires at least one message for unregistered history. The fixture now supplies a complete header and user message, with stable timestamps and working directory. Assertions still require one imported session, now both events, exact persisted history, preserved canonical metadata/history, receipt retirement, and an idempotent second import. No production code changed for this correction. The earlier interpretation of this header-only input as lost conversation history was incorrect.

The failing rebinding case now passes in 2.533 s; the slowest case in the local file took 5.181 s. Shared compilation/setup accounts for the remainder of wall time. No assertion, timeout, retry, or skip was weakened or added.

Checker gap on this head: the one authorized fresh Blacksmith lease tbx_01m3wnwfh6fs4fch1b62f7rqf4 remained queued without an IP or workflow run URL for 10m 41s (2026-10-01 21:28:18–21:38:59 UTC). It was stopped through the native lifecycle, verified completed, and its temporary SSH credentials were removed. No remote fetch/install/checker ran. No additional lease or provider fallback was used. The maintainer explicitly allowed pushing with this gap after ten minutes.

The prepared but unrun command was:

OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --base 750b253a246e667e759caf926947042c2ea7077e --timed

The local eight-test result above is current-head evidence; earlier remote results below retain their original head attribution.

Fresh direct-route Codex P1 review covered the complete rebased candidate, discovery/compression delta, and the latest fixture-only correction. Findings about archive identity, recreated indexes, and permissive diagnostic callbacks were fixed before the clean reviews.

autoreview scoped-clean: no accepted/actionable findings in the selected Git scope and priority

Earlier heavy proof used isolated Blacksmith Testboxes fetching pinned commits with frozen installs, without local-tree synchronization. The maintainer authorized only the exact receipt-retirement file as a local exception for this CI repair. Local formatting and git diff --check pass.

Completed proof

  • On rebased parent a49da13e72b7cd85921ae8f09fd9f6df4760e444, nine affected suites passed all 111 tests. Core production types passed in 41 s; Doctor test types passed in 33 s. Lease tbx_01m3wj58xeve786zehpxtg2q7c, run. This includes newly introduced scalar-state and retained-runtime callers found by comparing the caller inventory; an unrelated cron filename substring was verified not to import a changed owner.
  • That parent's eight-case retirement suite ran three times: seven passed and the replacement-database case failed each time. Test time was about 17 s per iteration, with no slow-test violation. Those runs used the header-only fixture described above and are failed historical evidence, not proof of importable history being lost. The latest local run uses a complete conversation and passes all eight cases.
  • The same parent checker and lint found 703 counted lines against a 700-line cap in deferred-plugin-session-sources.ts. No other lint error appeared. The final delta removes three source lines without changing limits or baselines; final-head checker confirmation is still required.
  • Negative controls on 614ebbdbb769f5a98fcd33c20a8a670c287f58cb failed for all three intended reasons: missing/changed archives incorrectly retired their receipt, and database replacement hit the stale identity check before rebinding. Wall 31 s; test time 6.941 s.
  • The unfinished original caller selection completed on 6df4acd1e4416149e5366d0051105afdac0aa840: 103 files passed, one platform-skipped; 1,447 tests passed, five skipped, in 1,187.19 s wall including shared compiler preparation. Lease tbx_01m3wa5wpbefxmbq8bjcs03n3z, run. Earlier caller batches had 1,194 passing tests, 14 skips, and the inherited config-capture failure below.
  • On original implementation head d5a3028b7a33ea2928bae691689ec443587383bc, all five touched suites passed three times: 68 tests per run, 204 executions. Before-fix controls on d5e94ecc0939907f18e5980ac6d7613c140387dd failed because the receipt-specific skip warning was absent and cleanup listed zero migration backups instead of two.
  • Published-driver Docker proof passed on that original implementation head: published 2026.9.7 updated to the pinned candidate, exited zero, recorded status: succeeded / phase: finished, restarted, returned /readyz=200, and verified the running build. Update time 308.258 s; full cell including package build 17m21s. This is prior-head update proof.

On intermediate 32065aaa7e8879166c7d4cc85d8be392fe30d496, check-changed passed its first 18 steps, then failed an inherited core graph budget: agents-other: 724 test roots exceeds the advisory 720 limit. The unchanged base 4e6eb74beb7681e2787e2077503b13e7c35ab5d0 reproduced the same count. All 15 remaining commands were run: 13 passed, including 27 core test-type shards in 1,038.540 s compiler time; two found a stale import subsequently removed. The corrected a2d6384b8e57257fa08de86a651aeb0a038d00af passed production types and changed-core lint (zero warnings/errors). Leases tbx_01m3wcmsngz93d2yxxdcgrvg16 (run) and tbx_01m3wejqwh83am030ak660z977 (run). These results do not establish the final head's checker status.

Measured affected-suite costs on the rebased parent

Measured with pnpm test <file> --maxWorkers=1. No case exceeded 30 s or file exceeded 120 s of test time; the largest case was 11.723 s. Real receipt, SQLite, archival, and cleanup boundaries are required here: the runtime regression caught behavior that the earlier source review missed.

Suite Cases Wall Test time
doctor-session-sqlite.receipt-recovery.test.ts 11 31 s 12.020 s
doctor-session-sqlite.retained-source-verification.test.ts 14 40 s 20.179 s
doctor-session-sqlite.shared-orphan.test.ts 3 24 s 4.090 s
doctor-session-sqlite.deferred-plugin.test.ts 31 107 s 87.535 s
doctor-session-entry-state.test.ts 12 34 s 13.505 s
doctor-session-transcripts.sqlite.test.ts 19 18 s 0.142 s
doctor-migration-backup.test.ts 11 22 s 5.965 s
doctor-config-preflight.container-upgrade.test.ts 4 46 s 26.516 s
doctor-retained-runtime.settlement.test.ts 6 28 s 8.382 s

Waived fixtures and inherited failures

The maintainer explicitly waived the slow-test STOP for these five pre-existing fixture follow-ups. All listed slow cases passed. The uncommitted planner-fixture optimization was dropped; none of these fixtures was changed, and no timeout, retry, skip, or weaker assertion was added.

File Sum of test times Slowest case
ci-changed-node-test-plan.source-owners.test.ts 133.111 s 26.203 s
doctor-health.test.ts 219.577 s 16.964 s
doctor-health.managed-admission.test.ts 135.460 s 41.340 s
doctor-health.managed-settlement.test.ts 220.979 s 59.905 s
doctor-health.managed-approvals.test.ts 144.266 s 52.593 s

doctor-health.fleet-preflight.test.ts → preserves original config bytes before Doctor relocates and repairs legacy state failed with Original configuration was not captured for legacy .clawdbot/openclaw.json. It reproduced on untouched parent d5e94ecc0939907f18e5980ac6d7613c140387dd (14.27 s Vitest, 34.09 s wrapper). The maintainer ruled it inherited and directed leaving it untouched.

doctor-health.nocow.test.ts:112 → joins Doctor's inspection child and database handles before rewriting both stores expected tools.exchanges 2 and got 0. It reproduced on untouched base 4e6eb74beb7681e2787e2077503b13e7c35ab5d0 (24.87 s Vitest, 26.44 s wrapper). It was left untouched; no passing replay is claimed as a fix.

GitHub Actions checks are attached to the final pushed head. Final hosted suite completion/timing is not claimed, and no CI wait or merge was requested.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations docker Docker and sandbox tooling size: L labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 5:48 PM ET / 21:48 UTC (Revision 13).

ClawSweeper review

What this changes

Doctor retires verified completed plugin-import receipts, explains skipped new history, and records migration backups for guarded update cleanup.

Merge readiness

✅ Ready for maintainer review

The fixes remain useful and absent from current main. The updated current-head regression resolves the earlier replacement-database compatibility blocker; no actionable introduced defect was found.

Priority: P2
Reviewed head: 253d558337db012cc5b19aaab502210d17fa0682

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-based repair with meaningful preservation coverage and no supported correctness finding; final scoped validation remains transparently incomplete.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied trusted-author classification exempts ordinary contributor proof. Prior-head published-driver Docker proof remains prior-head evidence; the reported current-head production-owner regression verifies receipt rebinding, same-pass import, canonical-history preservation, and idempotence. Existing-schema backup cleanup coverage supports stored-state compatibility independently; the final scoped checker remains unrun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied trusted-author classification exempts ordinary contributor proof. Prior-head published-driver Docker proof remains prior-head evidence; the reported current-head production-owner regression verifies receipt rebinding, same-pass import, canonical-history preservation, and idempotence. Existing-schema backup cleanup coverage supports stored-state compatibility independently; the final scoped checker remains unrun.
Evidence reviewed 9 items Pinned introduced changes: Reviewed the merge-base-to-head changes, separately from base-branch drift. The supplied test merge is stale and was not used to infer removal of current-main behavior.
Receipt retirement preserves verification: Retirement checks pending plugin obligations, absence of original sources and index, receipt equality, and fresh strict archive/database verification inside the state transaction before marking the source removed.
Earlier compatibility blocker resolved: The corrected replacement-database regression supplies a header and user message, calls the production Doctor import owner, and asserts same-pass import of both events, receipt retirement, unchanged canonical metadata/history, exact imported bytes, and idempotence. The captured body reports all eight cases passing on this head, including this case in 2.533 seconds.
Findings None None.
Security None None.

How this fits together

Doctor migrates legacy session files into OpenClaw’s SQLite databases while preserving recovery originals. Update cleanup consumes Doctor’s recorded evidence to identify originals that operators can safely retire.

flowchart TD
  A[Legacy session files] --> B[Doctor import and recovery]
  C[Plugin migration obligations] --> B
  B --> D[Verified SQLite history]
  B --> E[Recovery receipts and backups]
  E --> F[Completion and later update checks]
  F --> G[Confirmed guarded cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +391, Tests +448, Docs +19. Total +858 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 12 557 166 +391
Tests 5 451 3 +448
Docs 3 21 2 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 1029 171 +858

Review metrics

Metric Value Why it matters
Production versus regression coverage production +557/−166; tests +451/−3 The body justifies production growth through guarded receipt retirement and backup lifecycle records; the tests cover preservation and retirement contracts.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-maintenance-inspection.ts, migration/backfill/repair: src/commands/doctor-migration-backup-artifacts.ts, migration/backfill/repair: src/commands/doctor-migration-backup.ts, migration/backfill/repair: src/commands/doctor-session-sqlite-archive.ts, migration/backfill/repair: src/commands/doctor-session-sqlite-recovery-inventory.ts, migration/backfill/repair: src/commands/doctor-session-sqlite-retained.ts, and 7 more. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep receipt retirement and backup eligibility with their existing Doctor owners, preserving canonical history and explicit, fenced cleanup of rollback originals.

Do we have a high-confidence way to reproduce the issue?

Yes, source inspection supports both reported mechanisms: completed receipts remain active on main, and migration backups lack cleanup registration. This read-only review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes, the patch extends the existing receipt, backup, readiness, and disposal owners rather than creating parallel cleanup behavior; the corrected regression now validates the intended importable conversation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 3ee29f3b82c3.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 session-state: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This repairs bounded Doctor import and recovery-cleanup defects affecting existing operator state.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied trusted-author classification exempts ordinary contributor proof. Prior-head published-driver Docker proof remains prior-head evidence; the reported current-head production-owner regression verifies receipt rebinding, same-pass import, canonical-history preservation, and idempotence. Existing-schema backup cleanup coverage supports stored-state compatibility independently; the final scoped checker remains unrun.

Evidence

What I checked:

  • Pinned introduced changes: Reviewed the merge-base-to-head changes, separately from base-branch drift. The supplied test merge is stale and was not used to infer removal of current-main behavior. (253d558337db)
  • Receipt retirement preserves verification: Retirement checks pending plugin obligations, absence of original sources and index, receipt equality, and fresh strict archive/database verification inside the state transaction before marking the source removed. (src/commands/doctor-session-sqlite-retained.ts:70, 253d558337db)
  • Earlier compatibility blocker resolved: The corrected replacement-database regression supplies a header and user message, calls the production Doctor import owner, and asserts same-pass import of both events, receipt retirement, unchanged canonical metadata/history, exact imported bytes, and idempotence. The captured body reports all eight cases passing on this head, including this case in 2.533 seconds. (src/commands/doctor-session-sqlite.receipt-retirement.test.ts:142, 253d558337db)
  • Fixture correction matches the existing contract: The primary-transcript reader requires a message for unregistered history. GitHub’s exact-head commit patch confirms the latest correction changes only the test fixture and associated event assertions; it does not weaken the production import contract. (src/infra/session-sqlite-migration-readers.ts:79, 253d558337db)
  • Existing-state backup cleanup coverage: The container-upgrade test exercises released schema-19 state through Doctor, verifies preserved backup contents and migrated session identity, requires a later successful update before eligibility, performs confirmed retirement through the existing disposal owner, and preserves an unrecorded historical backup. (src/commands/doctor-config-preflight.container-upgrade.test.ts:119, 253d558337db)
  • Cleanup retains its final-effect fences: Inventory eligibility remains separate from deletion authority. Cleanup reacquires maintenance ownership, rechecks selection after confirmation, verifies destination and artifact identities, claims the entire selection, and revalidates before synchronous unlinks; backup targets use recorded physical database identities. (src/commands/doctor-session-sqlite-retirement.ts:176, 253d558337db)

Likely related people:

  • Peter Steinberger: Raw commit e25e244 adds src/commands/doctor-migration-backup.ts:77 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e25e244b68e9; files: src/commands/doctor-migration-backup.ts)
  • Jason (Json): Raw commit d417b52 adds src/commands/doctor-migration-backup.ts:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d417b5202305; files: src/commands/doctor-migration-backup.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-01T18:27:46.609Z sha 6df4acd1e4416149e5366d0051105afdac0aa840 :: needs changes before merge. :: none
  • reviewed 2026-10-01T18:53:00.724Z sha 32065aaa7e8879166c7d4cc85d8be392fe30d496 :: needs changes before merge. :: none
  • reviewed 2026-10-01T19:23:55.224Z sha a2d6384b8e57257fa08de86a651aeb0a038d00af :: needs changes before merge. :: none
  • reviewed 2026-10-01T19:43:31.299Z sha a2d6384b8e57257fa08de86a651aeb0a038d00af :: needs changes before merge. :: none
  • reviewed 2026-10-01T20:29:22.232Z sha a49da13 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T20:51:34.268Z sha 250dca4 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T21:11:57.763Z sha 250dca4 :: blocked before merge. :: none
  • reviewed 2026-10-01T21:33:26.574Z sha 253d558 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Oct 1, 2026
@steipete
steipete force-pushed the upd/upd-doctor-artifact-receipts branch from d5a3028 to 2391df9 Compare October 1, 2026 17:29
@steipete
steipete marked this pull request as ready for review October 1, 2026 19:35
Retire completed or disabled plugin session import obligations after verified source archival, and explain retained inputs without moving newly supplied transcripts. Register startup migration backups with recovery cleanup, protect groups until verified migration completion and a later successful update, and retain unrecorded originals.
Reuse the recovery dependency walk for backup groups, combine duplicate target validation and completion scans, and remove redundant receipt predicates and an unused return value while preserving transaction rechecks.
Preserve the migration fences while placing receipt retirement in its sibling, legacy index publication in the archive owner, and backup completion in readiness. Move receipt regression cases without changing their inputs or assertions.
All retirement entrypoints are Doctor one-shots. Reuse the retained-source command owner, remove the extra infra module, and preserve the write transaction and source-verification guards without changing the SQLite inventory policy.
@steipete
steipete force-pushed the upd/upd-doctor-artifact-receipts branch from a2d6384 to a49da13 Compare October 1, 2026 20:21
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Oct 1, 2026
@steipete
steipete merged commit 6ced196 into main Oct 1, 2026
122 of 141 checks passed
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed (squash 6ced196f957fef52040ed0f91a32a738b939ae4f, head 253d558337db): lead review r2 scoped-clean (0.87); the delta since the previously reviewed head 250dca4 is fixture-only (later-history transcript gained a session header + user message; assertions unchanged). Exact-head CI was cancelled at 21:27Z; the one job that had failed before the cancel, checks-ui-e2e-real-gateway (1/2) (model-catalog-partial-refresh.real-gateway.e2e), is a UI e2e this PR does not touch (no ui/ changes). Admin-merged per the unrelated-red rule rather than re-running CI.

@steipete
steipete deleted the upd/upd-doctor-artifact-receipts branch October 1, 2026 21:54
steipete added a commit that referenced this pull request Oct 1, 2026
…s test plan (#163071)

#162771 added src/commands/doctor-session-sqlite.receipt-retirement.test.ts without extending the commands test plan expectation; main hourly 36935459406 was red on the owner count.

Refs #162771
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
… backups (openclaw#162771)

Doctor left verified session-SQLite migration receipts and migration backups behind forever: every later Doctor or update run re-verified retired sources, and backup directories were never inventoried for protected cleanup. Doctor now retires a receipt only after re-checking receipt equality, pending obligations, source/index absence and archive/database verification inside one synchronous transaction, preserves history written after a database replacement, and registers migration backups so cleanup can only remove them after a recorded completion plus a later successful update.

Refs openclaw#161949
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…s test plan (openclaw#163071)

openclaw#162771 added src/commands/doctor-session-sqlite.receipt-retirement.test.ts without extending the commands test plan expectation; main hourly 36935459406 was red on the owner count.

Refs openclaw#162771
xydigitLybnnnn added a commit to xydigitLybnnnn/openclaw that referenced this pull request Oct 13, 2026
…generation

The earlier reconciliation refreshed whichever file occupied a recorded path, so
a valid database that replaced the recorded destination before the rewrite was
adopted and cleanup could then retire the original against the wrong generation.
Bind each refresh to the rewrite's pre-exchange dev/ino: an artifact must still
match its recorded identity and carry the recorded size and sha256, and a
destination must still be the generation whose migration was verified. Mismatches
stay protected and are reported, preserving PR openclaw#162771's destination binding.

Fixes the P1 review finding on openclaw#169893.
steipete added a commit that referenced this pull request Oct 13, 2026
…169893)

* fix(doctor): keep recovery originals retirable across a NOCOW rewrite

Doctor's btrfs NOCOW repair copies every store file into a fresh directory, so
the inode and mtime recorded in the migration manifest no longer match the live
file. `update cleanup` then classifies a verified recovery original as
blocked/artifact-metadata-changed, and its destination-database check rejects
the rewritten database, permanently disabling a documented retirement path for
operators who followed the NOCOW guidance.

After a successful directory exchange the rewrite now re-records the relocated
identity of the recovery originals and destination databases it exchanged,
only after proving the copy still carries the recorded content (size and
sha256). Anything that cannot be proven keeps its original record and stays
protected, so no cleanup safeguard is weakened.

Fixes #169674

* fix(doctor): refresh NOCOW recovery identities only for the recorded generation

The earlier reconciliation refreshed whichever file occupied a recorded path, so
a valid database that replaced the recorded destination before the rewrite was
adopted and cleanup could then retire the original against the wrong generation.
Bind each refresh to the rewrite's pre-exchange dev/ino: an artifact must still
match its recorded identity and carry the recorded size and sha256, and a
destination must still be the generation whose migration was verified. Mismatches
stay protected and are reported, preserving PR #162771's destination binding.

Fixes the P1 review finding on #169893.

* fix(doctor): preserve exact recovery identity across NOCOW rewrites

Consolidate the verified rewrite identity handoff and preserve the pre-copy metadata check. Exercise actual cleanup and refusal for replaced destinations, originals, metadata, and changed bytes.

Co-authored-by: xydigitLybnnnn <[email protected]>

* test(doctor): allow cleanup ownership workers in NOCOW fixture

---------

Co-authored-by: xydigitLybnnnn <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…penclaw#169893)

* fix(doctor): keep recovery originals retirable across a NOCOW rewrite

Doctor's btrfs NOCOW repair copies every store file into a fresh directory, so
the inode and mtime recorded in the migration manifest no longer match the live
file. `update cleanup` then classifies a verified recovery original as
blocked/artifact-metadata-changed, and its destination-database check rejects
the rewritten database, permanently disabling a documented retirement path for
operators who followed the NOCOW guidance.

After a successful directory exchange the rewrite now re-records the relocated
identity of the recovery originals and destination databases it exchanged,
only after proving the copy still carries the recorded content (size and
sha256). Anything that cannot be proven keeps its original record and stays
protected, so no cleanup safeguard is weakened.

Fixes openclaw#169674

* fix(doctor): refresh NOCOW recovery identities only for the recorded generation

The earlier reconciliation refreshed whichever file occupied a recorded path, so
a valid database that replaced the recorded destination before the rewrite was
adopted and cleanup could then retire the original against the wrong generation.
Bind each refresh to the rewrite's pre-exchange dev/ino: an artifact must still
match its recorded identity and carry the recorded size and sha256, and a
destination must still be the generation whose migration was verified. Mismatches
stay protected and are reported, preserving PR openclaw#162771's destination binding.

Fixes the P1 review finding on openclaw#169893.

* fix(doctor): preserve exact recovery identity across NOCOW rewrites

Consolidate the verified rewrite identity handoff and preserve the pre-copy metadata check. Exercise actual cleanup and refusal for replaced destinations, originals, metadata, and changed bytes.

Co-authored-by: xydigitLybnnnn <[email protected]>

* test(doctor): allow cleanup ownership workers in NOCOW fixture

---------

Co-authored-by: xydigitLybnnnn <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
hilsbos pushed a commit to hilsbos/openclaw that referenced this pull request Oct 22, 2026
…penclaw#169893)

* fix(doctor): keep recovery originals retirable across a NOCOW rewrite

Doctor's btrfs NOCOW repair copies every store file into a fresh directory, so
the inode and mtime recorded in the migration manifest no longer match the live
file. `update cleanup` then classifies a verified recovery original as
blocked/artifact-metadata-changed, and its destination-database check rejects
the rewritten database, permanently disabling a documented retirement path for
operators who followed the NOCOW guidance.

After a successful directory exchange the rewrite now re-records the relocated
identity of the recovery originals and destination databases it exchanged,
only after proving the copy still carries the recorded content (size and
sha256). Anything that cannot be proven keeps its original record and stays
protected, so no cleanup safeguard is weakened.

Fixes openclaw#169674

* fix(doctor): refresh NOCOW recovery identities only for the recorded generation

The earlier reconciliation refreshed whichever file occupied a recorded path, so
a valid database that replaced the recorded destination before the rewrite was
adopted and cleanup could then retire the original against the wrong generation.
Bind each refresh to the rewrite's pre-exchange dev/ino: an artifact must still
match its recorded identity and carry the recorded size and sha256, and a
destination must still be the generation whose migration was verified. Mismatches
stay protected and are reported, preserving PR openclaw#162771's destination binding.

Fixes the P1 review finding on openclaw#169893.

* fix(doctor): preserve exact recovery identity across NOCOW rewrites

Consolidate the verified rewrite identity handoff and preserve the pre-copy metadata check. Exercise actual cleanup and refusal for replaced destinations, originals, metadata, and changed bytes.

Co-authored-by: xydigitLybnnnn <[email protected]>

* test(doctor): allow cleanup ownership workers in NOCOW fixture

---------

Co-authored-by: xydigitLybnnnn <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
(cherry picked from commit 29fb33a)
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant