Repository navigation
fix(update): allow SQLite readers during stopped database backups - #180827
Conversation
Ignore the transient WAL index and reader-created empty WAL files when fencing a stopped backup. Retain main, nonempty WAL, and rollback-journal change detection, with named journal diagnostics. Reuse coherent private snapshot capture and cover independent SQLite readers, writers, restored bytes, and committed WAL rows.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThe PR allows SQLite readers during stopped database backups while retaining detection of durable database changes. Example: A read-only SQLite probe recreates openclaw.sqlite-shm while a stopped backup captures two committed rows.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current stopped-backup failure with a focused change, and no concrete introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherUpdate and Doctor send discovered SQLite database families to the backup owner, which publishes verified standalone snapshots and recovery metadata. flowchart LR
A[Update or Doctor] --> B[Database backup owner]
C[SQLite database family] --> B
D[Independent SQLite reader] --> C
B --> E[Private snapshot owner]
E --> F[Verified recovery image]
Technical reviewBest possible solution: Retain the existing snapshot owner and distinguish transient reader bookkeeping from durable database changes. Do we have a high-confidence way to reproduce the issue? Current-main source treats reader-mutated SHM as backup state, and the supplied baseline results identify the corresponding failures; this review ran no target code. Is this the best way to solve the issue? The patch repairs both existing comparison owners, preserves durable-file checks, and introduces no competing snapshot path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e1f4e11918cd. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +128, Docs +8. Total +138 across 5 files. Added test files: 0. View PR surface stats
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 October 22, 2026, 1:43 PM ET / 17:43 UTC. |
…enclaw#180827) Ignore the transient WAL index and reader-created empty WAL files when fencing a stopped backup. Retain main, nonempty WAL, and rollback-journal change detection, with named journal diagnostics. Reuse coherent private snapshot capture and cover independent SQLite readers, writers, restored bytes, and committed WAL rows.
…80827) Ignore the transient WAL index and reader-created empty WAL files when fencing a stopped backup. Retain main, nonempty WAL, and rollback-journal change detection, with named journal diagnostics. Reuse coherent private snapshot capture and cover independent SQLite readers, writers, restored bytes, and committed WAL rows. Release adaptation: stable has no stopped-backup journal-set comparison, so only the -shm exclusion, empty-WAL normalization (number Stats size on stable), and the private-copy sidecar comparison apply. Stable's capture is online, so the ported regression keeps reader cases, adds recreated -shm/empty-WAL inode cases that fail without the fix, and accepts stable's existing writer outcome (changed-generation warning or identity refusal). (cherry picked from commit 082e55e)
…80827) Ignore the transient WAL index and reader-created empty WAL files when fencing a stopped backup. Retain main, nonempty WAL, and rollback-journal change detection, with named journal diagnostics. Reuse coherent private snapshot capture and cover independent SQLite readers, writers, restored bytes, and committed WAL rows. (cherry picked from commit 082e55e) Adapted for 2026.9.x: ported only the sqlite-readonly-location.ts sidecar check, so a reader-created -shm no longer forces a read-only copy retry. The update-database-backup.ts hunks are not ported: 9.x has no stopped-backup journal key-set comparison and its final inventory check compares dev/inode identity only, so -shm content changes and reader-created empty WAL files do not abort 9.x backups. The docs paragraph describes that main-only stopped-backup behavior and is omitted. The regression is a 9.x-native sync copy test that counts main-database opens with and without a mid-copy -shm creation.
What Problem This Solves
Update/Doctor's stopped database backup can abort when a read-only SQLite probe opens the WAL database during capture. SQLite readers update or recreate the transient
-shmWAL index, which was incorrectly treated as durable source data.User Impact
Read-only probes no longer block the stopped backup. Main database, nonempty WAL, and rollback-journal changes still fail closed; an empty WAL created by a reader counts as absent. No schema, configuration, or backup-format change.
Why This Change Was Made
Exclude
-shmfrom the stopped backup inventory and from the private copy's journal-presence comparison. The existing snapshot owner already copies and verifies the main database plus committed WAL frames, rebuilds its private index, and publishes a verified standalone database. Keep that owner instead of opening another source connection that could affect POSIX lock lifetime or source cleanup. Journal appearance/disappearance errors now name the changed file too.Production change: net +2 lines. Removed the redundant sidecar comparator; the necessary growth handles a real reader creating an empty WAL and identifies changed journal files. No extra snapshot path or cache. Simplification pass completed.
Evidence
Acceptance: a real independent SQLite reader during stopped capture must succeed without changing source main/WAL bytes; the published snapshot must restore byte-identically and retain both committed rows, including the uncheckpointed WAL row. Real independent writers must still fail closed.
Update database file changed during backup: ...-shm; a reader creating the index fails withUpdate database journal state changed during stopped backup.update-database-backup.test.tsandsqlite-readonly-location.copy.test.ts(66.82 s command wall time; backup test bodies 39.307 s, copy test bodies 1.421 s). The backup file exercises worker-backed original-state recovery contracts as well as the new sub-second reader/writer cases. The unchanged siblingsqlite-readonly-location.test.tsalso passed 25 tests with one platform skip.tsgo:core(tsrs) passed before the final empty-WAL addition; exact-head broad checks are delegated to PR CI.Limitations: no production access or load testing; no full installed-package upgrade campaign. The candidate-worker backup boundary and real SQLite subprocesses are exercised locally. The fix must be in the runtime performing capture. A completed external write has no reliable PID attribution in filesystem metadata, so errors identify the file rather than accusing an unrelated open-file holder.