Repository navigation
fix: recovery originals stay retirable after a doctor NOCOW rewrite - #169893
Conversation
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
|
🦞👀 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 real behavior proof before merge. What this changesDoctor refreshes recorded recovery-original and destination-database identities after a verified NOCOW rewrite. Example: Doctor rewrites a btrfs store containing a recorded 10,076,160-byte migration backup, followed by a successful update.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR addresses a reported current-main cleanup defect with a focused producer-side fix, and no actionable code finding remains. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherOffline Doctor maintenance copies and exchanges SQLite store directories; recovery manifests carry their identity evidence into update cleanup, which verifies ownership, destination generation, content, and consent before deleting originals. flowchart TD
A[Offline Doctor ownership] --> B[Store inventory]
B --> C[Verified NOCOW rewrite]
C --> D[Recovery manifest reconciliation]
D --> E[Later successful update]
E --> F[Cleanup verification and consent]
F --> G[Retire eligible originals]
Technical reviewBest possible solution: Refresh only verified rewritten generations in Doctor while preserving the existing cleanup ownership, consent, and content checks. Do we have a high-confidence way to reproduce the issue? The linked report supplies an official affected version and cleanup output, and current source confirms that NOCOW copying changes identities rejected by recovery inventory; no runtime reproduction was executed during this review. Is this the best way to solve the issue? Updating evidence at the verified rewrite producer addresses the cause without weakening retirement checks or introducing a competing cleanup policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 79e11a6b4b1b. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +106, Tests +180, Docs +4. Total +290 across 6 files. Added test files: 1. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 13, 2026, 9:38 AM ET / 13:38 UTC (Revision 4). |
…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.
|
Addressed the review on head
Local gates on @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
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]>
|
Merged via squash.
|
…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]>
…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]>
Fixes #169674
What Problem This Solves
Fixes
openclaw update cleanuppermanently blocking verified pre-migration recovery originals afteropenclaw doctor --fixrewrites their btrfs store with NOCOW.User Impact
Recovery originals remain eligible for the existing cleanup process after a verified NOCOW rewrite and a later successful update. Unproven or replaced originals and destination databases remain protected. Cleanup still requires offline ownership, verified migration completion, a later completed update, content verification, and consent.
Why This Change Was Made
The directory exchange changes file identities. Doctor now updates the existing migration manifest only when its pre-rewrite inventory matches the recorded generation. Backups must also match their recorded pre-copy timestamp/size and copied SHA-256. Destination databases retain their generation binding while allowing normal in-place migration. Reconciliation failures produce warnings and leave cleanup conservative; the original directory and WAL-aware snapshots remain retained.
Original fix by @xydigitLybnnnn; maintainer cleanup consolidates identity reconciliation, removes duplicate helper-only tests, and exercises actual retirement and refusal through the existing owners. No schema, persisted format, configuration, retention policy, or cleanup safety change. No new state store.
Evidence
doctor-sqlite-nocow.recovery-identity.test.tscoversretires a recorded recovery original after a NOCOW rewrite without changing live dataandkeeps the original protected after changing %sfor destination replacement, backup replacement, changed backup metadata, and corrupted copied bytes. Existing NOCOW/Doctor/cleanup tests run in the applicable CI shards.eslint-plugin-solid; the static fallback retained the root lint rules and removed only the unrelatedui/**/*.tsxplugin override. Changed-file oxfmt andgit diff --checkpassed. No dependency installation or shared-install changes.8d810fa7117dbd4e0fc939cb782dfa0e03e8b326: run 38404907293, 41 successful jobs and 28 skipped, including production/test typechecks, lint, tests, andopenclaw/ci-gate. Currentorigin/mainwas merged immediately before pushing. The first attempt on this head hit a 300-second plugin-SDK declaration-preparation timeout after core lint had passed; one retry of only the failed jobs succeeded. This was not classified as inherited: the latest scheduled main run passed the corresponding lint job. First run 38403059533, job 115316218790, exposed a test-fixture defect: its subprocess mock rejected the real ownership-inspection Node worker. The fixture now delegates Node calls while keeping btrfs tools mocked. The existing NOCOW suite passed 26/26 on that first run. This was introduced test setup, not an inherited failure.Exact diff versus merged main: production +106 / -0, tests +180 / -0, docs +4 / -0; total +290 / -0 across six files (down from +484 across seven). The remaining positive production delta is the required producer-side identity bookkeeping; eliminating it would leave stale identities or weaken cleanup. No unrelated safety code was removed to meet a line target.