Repository navigation
fix: release live WAL readers before backup verification - #204907
Conversation
- Acquire the private image through the existing online backup owner before verification. - Keep raw pages unnormalized until their integrity check, then preserve publication checks. - Prove live checkpoint progress and physical corruption refusal.
- Exercise publication mutation against the published file instead of staging internals. - Require raw acquired corruption and native diagnostics to survive until consumer verification.
|
🦞👀 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 changes before merge. What this changesThis PR releases the live SQLite reader after copying and verifies the raw private image before normalization and compaction. Example: A writer commits another row while backup integrity verification runs.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it addresses a source-confirmed WAL-pinning problem, but removing acquisition-time normalization leaves a sibling diagnostic test failing in CI. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe shared SQLite snapshot owner receives database paths and validation callbacks from backup and recovery callers, acquires a consistent private image, and produces a verified, durable snapshot. flowchart LR
A[Backup and recovery callers] --> B[Snapshot owner]
C[Live SQLite database] --> D[Online copy owner]
B --> D
D --> E[Raw private image]
E --> F[Integrity and normalization]
F --> G[Verified publication]
Technical reviewBest possible solution: Keep the existing copy owner, verify raw private pages before rewriting them, and remove the obsolete diagnostic test case for the eliminated normalization open. Do we have a high-confidence way to reproduce the issue? Current-main source holds the live read transaction across integrity scanning and copying; the contributor reports a base checkpoint reproduction, but no target code was executed during this read-only review. Is this the best way to solve the issue? The approach fixes the lifetime at its existing owner while retaining consistent acquisition, pre-rewrite corruption checks, final publication checks, and cleanup. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7cf1dadebcae. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource -7, Tests +108, Docs +3. Total +104 across 6 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel 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 Reviewed November 24, 2026, 4:46 PM ET / 21:46 UTC. |
- Count pinned SQLite pages rather than accumulated historical WAL frames. - Keep conservative recovery-family accounting for raw copies. - Remove the retired normalization-open test and preserve native corruption diagnostics.
- Keep native page probes in the existing SQLite primitive module. - Preserve logical-image admission without expanding SQL classifications. - Targeted capacity/error tests and the dialect ratchet pass.
|
Landed. A user backup taken while the Gateway runs no longer keeps the live database snapshot open during source verification: it verifies its own private copy instead, so WAL checkpoints are not blocked for the length of the verification on large stores. Proof: owner tests (116 passed) and a held-reader case on AWS (run_39e14deb). The background startup verifier part follows in #204943. |
## What Problem This Solves A background integrity reader can retain an old SQLite snapshot while checkpoints are blocked. The native writer already observes checkpoint pressure, but ordinary worker replies did not carry that observation back to the Gateway that owns the background reader. Builds on merged #204907. This PR is retargeted to `main` and contains only the verifier/worker-observation slice. ## User Impact Background integrity checks release their own reader under excessive blocked-WAL pressure. User reads and writes continue unchanged. Interrupted verification stays inconclusive: no verification receipt, clean-close seal, or corruption refusal is invented. This is not a hard WAL size cap. ## Why This Change Was Made The existing checkpoint owner computes byte pressure once: blocked, with WAL bytes greater than both twice the database size and 64 MiB. Newly recorded observations travel on the existing settled worker reply, qualified by the original actor's physical identity and current custody. Optional fast-grant authority keeps its stronger incarnation check. The verifier subscribes only during its native integrity promise, aborts and joins its own child, and unregisters before verdict processing. Explicit maintenance retains its existing publication route. There is no new channel, registry, scheduler, retry loop, or writer-admission policy. Existing backend validation and reply contracts move to their existing loader/type owners to keep the implementation local and bounded. The lifecycle-file change is type imports only. ## Evidence - Real native scheduled tick → ordinary session command → host observation regression was **red** with the owned SQLite child still alive, then **green** with joined cancellation and subsequent checkpoint progress. It does not inject a host checkpoint fact or issue an explicit WAL-maintenance command for the positive case. - **54 local tests passed** across six targeted files, including healthy/corrupt verification, native loss, quarantine, ordinary replies, checkpoint handling, and cleanup. **36 tests passed on AWS/Linux** across the five transport/checkpoint suites in parallel with the backup proof. - Stale physical identity, birthtime, path, incarnation, custody, and owner observations cannot publish through the reply boundary. Warning-only and unrelated-store pressure do not cancel the scan. - Targeted Oxlint: 0 warnings/errors; changed-file formatting passed. The exact state-logging compiler leaf passes after the test-only optional-promise correction; its focused native regression passes too. Canonical compiler/breadth validation belongs to PR CI. - Local reviews of `8ff498ec` and `eafdcfb3` found no actionable correctness/security defects. The later merge from `main` introduces no additional verifier runtime changes. - Exact-head PR CI is **green on `7afef14b9c12`**, including PostgreSQL conformance and Docker seed E2E. The last repairs changed test fixtures only. Production delta: **+157 lines**; test/support/routing delta: **+460**; docs: **+8**. The additional transport is required by the real native-flow regression; the smaller main-thread-only implementation was not shipped. The regression allocation records the native process/worker harness above the normal test budget. Registration fixtures preserve real unrelated broker exports, and their retired full-mock exception is removed. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Backup verification held a read transaction on the live SQLite store while scanning the whole database. Concurrent writes could therefore keep accumulating in the WAL even after the actual backup copy had finished. ## User Impact Backups release their live reader before integrity verification and compaction. Writers keep running, and corrupt source pages still prevent publication. The consistent-copy read transaction remains; this is not a hard WAL size cap. ## Why This Change Was Made Use the existing online-copy owner to acquire a raw private image, then verify that image before journal normalization, caller validation, transforms, or VACUUM. Delete the second live-source verification/copy path. Acquisition no longer normalizes pages before their corruption check, and a copied image does not certify a concurrently changing canonical source. Native capacity admission counts logical SQLite pages through the existing header owner; raw copies still reserve the full recovery family. ## Evidence - Test-first reproduction: a concurrent PASSIVE checkpoint copied **0 of 2 frames** during verification on the base. The regression now requires complete checkpoint progress and checks the backup's original rows against the source's later committed row. - **116 tests passed, 2 existing conditional skips on AWS/Linux**, across six owning snapshot/acquisition suites on `bd5521c7bc98`. The held-reader case, overwrite-WAL and WAL-only-growth sizing, physical corruption, publication mutation, and cleanup contracts passed. - Local owning checks passed, with 3 platform-conditional skips; targeted Oxlint found 0 warnings/errors. The full build with declarations and installed packed-CLI smoke passed on the initial copy-path revision. - Exact-head PR CI is green on `bd5521c7bc98`. The SQLite dialect ratchet decreased engine-maintenance constructs from 9 to 8, without a classification change. - The broader consumer run reached its 25-minute limit. Changed-check guards/formatting ran, but its test type graph reached the 15-minute local limit; canonical compiler/breadth proof remains with PR CI. Production delta: **+6 lines**; tests: **+181**; docs: **+3**. Background-verifier pressure handling is separate in #204943 and is not included here. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit a5bf129) Co-authored-by: RomneyDa <[email protected]>
…4907) ## What Problem This Solves Backup verification held a read transaction on the live SQLite store while scanning the whole database. Concurrent writes could therefore keep accumulating in the WAL even after the actual backup copy had finished. ## User Impact Backups release their live reader before integrity verification and compaction. Writers keep running, and corrupt source pages still prevent publication. The consistent-copy read transaction remains; this is not a hard WAL size cap. ## Why This Change Was Made Use the existing online-copy owner to acquire a raw private image, then verify that image before journal normalization, caller validation, transforms, or VACUUM. Delete the second live-source verification/copy path. Acquisition no longer normalizes pages before their corruption check, and a copied image does not certify a concurrently changing canonical source. Native capacity admission counts logical SQLite pages through the existing header owner; raw copies still reserve the full recovery family. ## Evidence - Test-first reproduction: a concurrent PASSIVE checkpoint copied **0 of 2 frames** during verification on the base. The regression now requires complete checkpoint progress and checks the backup's original rows against the source's later committed row. - **116 tests passed, 2 existing conditional skips on AWS/Linux**, across six owning snapshot/acquisition suites on `bd5521c7bc98`. The held-reader case, overwrite-WAL and WAL-only-growth sizing, physical corruption, publication mutation, and cleanup contracts passed. - Local owning checks passed, with 3 platform-conditional skips; targeted Oxlint found 0 warnings/errors. The full build with declarations and installed packed-CLI smoke passed on the initial copy-path revision. - Exact-head PR CI is green on `bd5521c7bc98`. The SQLite dialect ratchet decreased engine-maintenance constructs from 9 to 8, without a classification change. - The broader consumer run reached its 25-minute limit. Changed-check guards/formatting ran, but its test type graph reached the 15-minute local limit; canonical compiler/breadth proof remains with PR CI. Production delta: **+6 lines**; tests: **+181**; docs: **+3**. Background-verifier pressure handling is separate in openclaw#204943 and is not included here. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves A background integrity reader can retain an old SQLite snapshot while checkpoints are blocked. The native writer already observes checkpoint pressure, but ordinary worker replies did not carry that observation back to the Gateway that owns the background reader. Builds on merged openclaw#204907. This PR is retargeted to `main` and contains only the verifier/worker-observation slice. ## User Impact Background integrity checks release their own reader under excessive blocked-WAL pressure. User reads and writes continue unchanged. Interrupted verification stays inconclusive: no verification receipt, clean-close seal, or corruption refusal is invented. This is not a hard WAL size cap. ## Why This Change Was Made The existing checkpoint owner computes byte pressure once: blocked, with WAL bytes greater than both twice the database size and 64 MiB. Newly recorded observations travel on the existing settled worker reply, qualified by the original actor's physical identity and current custody. Optional fast-grant authority keeps its stronger incarnation check. The verifier subscribes only during its native integrity promise, aborts and joins its own child, and unregisters before verdict processing. Explicit maintenance retains its existing publication route. There is no new channel, registry, scheduler, retry loop, or writer-admission policy. Existing backend validation and reply contracts move to their existing loader/type owners to keep the implementation local and bounded. The lifecycle-file change is type imports only. ## Evidence - Real native scheduled tick → ordinary session command → host observation regression was **red** with the owned SQLite child still alive, then **green** with joined cancellation and subsequent checkpoint progress. It does not inject a host checkpoint fact or issue an explicit WAL-maintenance command for the positive case. - **54 local tests passed** across six targeted files, including healthy/corrupt verification, native loss, quarantine, ordinary replies, checkpoint handling, and cleanup. **36 tests passed on AWS/Linux** across the five transport/checkpoint suites in parallel with the backup proof. - Stale physical identity, birthtime, path, incarnation, custody, and owner observations cannot publish through the reply boundary. Warning-only and unrelated-store pressure do not cancel the scan. - Targeted Oxlint: 0 warnings/errors; changed-file formatting passed. The exact state-logging compiler leaf passes after the test-only optional-promise correction; its focused native regression passes too. Canonical compiler/breadth validation belongs to PR CI. - Local reviews of `8ff498ec` and `eafdcfb3` found no actionable correctness/security defects. The later merge from `main` introduces no additional verifier runtime changes. - Exact-head PR CI is **green on `7afef14b9c12`**, including PostgreSQL conformance and Docker seed E2E. The last repairs changed test fixtures only. Production delta: **+157 lines**; test/support/routing delta: **+460**; docs: **+8**. The additional transport is required by the real native-flow regression; the smaller main-thread-only implementation was not shipped. The regression allocation records the native process/worker harness above the normal test budget. Registration fixtures preserve real unrelated broker exports, and their retired full-mock exception is removed. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves Backup verification held a read transaction on the live SQLite store while scanning the whole database. Concurrent writes could therefore keep accumulating in the WAL even after the actual backup copy had finished. ## User Impact Backups release their live reader before integrity verification and compaction. Writers keep running, and corrupt source pages still prevent publication. The consistent-copy read transaction remains; this is not a hard WAL size cap. ## Why This Change Was Made Use the existing online-copy owner to acquire a raw private image, then verify that image before journal normalization, caller validation, transforms, or VACUUM. Delete the second live-source verification/copy path. Acquisition no longer normalizes pages before their corruption check, and a copied image does not certify a concurrently changing canonical source. Native capacity admission counts logical SQLite pages through the existing header owner; raw copies still reserve the full recovery family. ## Evidence - Test-first reproduction: a concurrent PASSIVE checkpoint copied **0 of 2 frames** during verification on the base. The regression now requires complete checkpoint progress and checks the backup's original rows against the source's later committed row. - **116 tests passed, 2 existing conditional skips on AWS/Linux**, across six owning snapshot/acquisition suites on `bd5521c7bc98`. The held-reader case, overwrite-WAL and WAL-only-growth sizing, physical corruption, publication mutation, and cleanup contracts passed. - Local owning checks passed, with 3 platform-conditional skips; targeted Oxlint found 0 warnings/errors. The full build with declarations and installed packed-CLI smoke passed on the initial copy-path revision. - Exact-head PR CI is green on `bd5521c7bc98`. The SQLite dialect ratchet decreased engine-maintenance constructs from 9 to 8, without a classification change. - The broader consumer run reached its 25-minute limit. Changed-check guards/formatting ran, but its test type graph reached the 15-minute local limit; canonical compiler/breadth proof remains with PR CI. Production delta: **+6 lines**; tests: **+181**; docs: **+3**. Background-verifier pressure handling is separate in #204943 and is not included here. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit a5bf129) Release adaptation for 2026.11.11: resolved import-only conflicts (kept pathEntryExists, dropped imports the fix retires) and kept the existing capacity allocation test beside the new logical-image budget test. Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]>
## What Problem This Solves A background integrity reader can retain an old SQLite snapshot while checkpoints are blocked. The native writer already observes checkpoint pressure, but ordinary worker replies did not carry that observation back to the Gateway that owns the background reader. Builds on merged #204907. This PR is retargeted to `main` and contains only the verifier/worker-observation slice. ## User Impact Background integrity checks release their own reader under excessive blocked-WAL pressure. User reads and writes continue unchanged. Interrupted verification stays inconclusive: no verification receipt, clean-close seal, or corruption refusal is invented. This is not a hard WAL size cap. ## Why This Change Was Made The existing checkpoint owner computes byte pressure once: blocked, with WAL bytes greater than both twice the database size and 64 MiB. Newly recorded observations travel on the existing settled worker reply, qualified by the original actor's physical identity and current custody. Optional fast-grant authority keeps its stronger incarnation check. The verifier subscribes only during its native integrity promise, aborts and joins its own child, and unregisters before verdict processing. Explicit maintenance retains its existing publication route. There is no new channel, registry, scheduler, retry loop, or writer-admission policy. Existing backend validation and reply contracts move to their existing loader/type owners to keep the implementation local and bounded. The lifecycle-file change is type imports only. ## Evidence - Real native scheduled tick → ordinary session command → host observation regression was **red** with the owned SQLite child still alive, then **green** with joined cancellation and subsequent checkpoint progress. It does not inject a host checkpoint fact or issue an explicit WAL-maintenance command for the positive case. - **54 local tests passed** across six targeted files, including healthy/corrupt verification, native loss, quarantine, ordinary replies, checkpoint handling, and cleanup. **36 tests passed on AWS/Linux** across the five transport/checkpoint suites in parallel with the backup proof. - Stale physical identity, birthtime, path, incarnation, custody, and owner observations cannot publish through the reply boundary. Warning-only and unrelated-store pressure do not cancel the scan. - Targeted Oxlint: 0 warnings/errors; changed-file formatting passed. The exact state-logging compiler leaf passes after the test-only optional-promise correction; its focused native regression passes too. Canonical compiler/breadth validation belongs to PR CI. - Local reviews of `8ff498ec` and `eafdcfb3` found no actionable correctness/security defects. The later merge from `main` introduces no additional verifier runtime changes. - Exact-head PR CI is **green on `7afef14b9c12`**, including PostgreSQL conformance and Docker seed E2E. The last repairs changed test fixtures only. Production delta: **+157 lines**; test/support/routing delta: **+460**; docs: **+8**. The additional transport is required by the real native-flow regression; the smaller main-thread-only implementation was not shipped. The regression allocation records the native process/worker harness above the normal test budget. Registration fixtures preserve real unrelated broker exports, and their retired full-mock exception is removed. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit c635b05)
What Problem This Solves
Backup verification held a read transaction on the live SQLite store while scanning the whole database. Concurrent writes could therefore keep accumulating in the WAL even after the actual backup copy had finished.
User Impact
Backups release their live reader before integrity verification and compaction. Writers keep running, and corrupt source pages still prevent publication. The consistent-copy read transaction remains; this is not a hard WAL size cap.
Why This Change Was Made
Use the existing online-copy owner to acquire a raw private image, then verify that image before journal normalization, caller validation, transforms, or VACUUM. Delete the second live-source verification/copy path. Acquisition no longer normalizes pages before their corruption check, and a copied image does not certify a concurrently changing canonical source. Native capacity admission counts logical SQLite pages through the existing header owner; raw copies still reserve the full recovery family.
Evidence
bd5521c7bc98. The held-reader case, overwrite-WAL and WAL-only-growth sizing, physical corruption, publication mutation, and cleanup contracts passed.bd5521c7bc98. The SQLite dialect ratchet decreased engine-maintenance constructs from 9 to 8, without a classification change.Production delta: +6 lines; tests: +181; docs: +3. Background-verifier pressure handling is separate in #204943 and is not included here.