Repository navigation
fix(update): verify migrations across read-only WAL index rebuilds - #201307
roboclaw-bot wants to merge 1 commit into
Conversation
Co-authored-by: steipete <[email protected]>
|
🦞👀 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. What this changesThis PR accepts a read-only WAL-index rebuild when the database, WAL bytes, and committed-frame identity remain unchanged. Example: On Linux, a read-only SQLite process queries agent.sqlite while its retained WAL is being observed after a migration.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored draft contains a useful, focused repair for behavior current main still rejects; no concrete patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe updater’s database-generation reader observes SQLite database families and supplies verified fingerprints to Doctor migration attribution, backup, and restoration checks. flowchart TD
A[Update coordinator] --> B[Doctor migration attribution]
B --> C[Database generation reader]
D[Database and WAL files] --> C
E[Outside SQLite reader] --> F[WAL index rebuild]
F --> C
C --> G[Verified generation or refusal]
Technical reviewBest possible solution: Extend the existing publication predicate only for the demonstrated same-commit index rebuild while retaining database-family verification and outside-write refusal. Do we have a high-confidence way to reproduce the issue? The narrow failure is source-reproducible: main rejects the header transition produced by the supplied Linux real-SQLite fixture, although no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes the owning predicate directly and preserves the invariant that a benign index rebuild may pass only when durable bytes and committed-frame identity remain unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0aafe6691b81. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +14, Tests +86, Docs +4. Total +104 across 3 files. Added test files: 1. 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. 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 18, 2026, 10:47 AM ET / 15:47 UTC. |
|
Closing in favor of #201330, which fixes the same read-only WAL-index rebuild at the same owner ( Thanks again to @warm-cloth for the read-only monitoring trace that pinned this down. |
Related: #197083
Thanks to @warm-cloth for the read-only monitoring trace and @Staruy for the original report.
Work sessions
Linked for team reference; these sessions aren’t public.
What Problem This Solves
During an update, an outside process can read an agent database while the post-install Doctor verifies a migration. A read-only SQLite open over a non-empty WAL can rebuild the WAL index: it resets the index change counter (
iChange) and recomputes the header checksum, while the database and WAL bytes stay identical.sameWalCommitPublicationtreated any index change with WAL frames present as an unverifiable commit, so Doctor failed with "SQLite WAL commit publication could not be verified", rollback was then refused because the writer was unknown, recovery snapshots stayed on disk and plugin convergence was deferred.User Impact
Doctor can verify the migration when a read-only connection rebuilt the WAL index over the same committed frames. It still refuses verification when another process appends a commit, so the outside write is preserved and the updater's data-at-risk refusal is unchanged.
Why This Change Was Made
The generation reader accepts the index transition only when the existing database and WAL file checks pass and the new index header still names the same commit: identical version,
isInit, page size,mxFrame,nPage, frame checksums and salts, withiChangereset to zero. Anything else, including any new frame, still fails closed.Evidence
update-database-generations.retained-wal.test.ts). With the fix, verification completes with identical database and WAL bytes.git diff --checkpass; local autoreview scoped-clean at P2.