Repository navigation
fix: report blocked SQLite WAL checkpoints in status and doctor - #146775
Conversation
Classify incomplete passive checkpoint frame progress and retain the last maintenance observation on the existing WAL owner. Report sustained or oversized blocked WALs and checkpoint errors through the status RPC, with a graceful restart and status-report hint. Completed observations clear the warning; storage lifecycle and checkpoint scheduling stay unchanged. Fixes #146744 Reported by @thegizmopro (#146719).
|
🦞👀 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: blocked before merge. Reviewed September 13, 2026, 2:33 AM ET / 06:33 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR detects incomplete SQLite write-ahead log checkpoints and reports sustained blockage or errors through status and Doctor, with recovery guidance. Merge readiness⛔ Blocked before merge - 1 item remains The PR remains useful: current main and the latest release retain the busy-only checkpoint check. No blocking defect was found. The previous migration-proof blocker does not apply because the new observations are process-local and introduce no persisted-format change. Priority: P2 Review scores
Verification
How this fits togetherSQLite maintenance checkpoints committed writes from the write-ahead log into OpenClaw’s databases. This change records the existing maintenance results and exposes shared-state warnings through the Gateway’s status RPC to diagnostic commands. flowchart LR
A[Gateway state writes] --> B[SQLite database and WAL]
B --> C[Existing checkpoint maintenance]
C --> D[Handle-local health observation]
D --> E[Gateway status RPC]
E --> F[Status and Doctor warnings]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +213, Tests +321, Docs +29, Other 0. Total +563 across 25 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep checkpoint classification and observations with the existing maintenance owner, with status and Doctor consuming those facts without triggering database work. Do we have a high-confidence way to reproduce the issue? Yes: hold a SQLite read transaction, commit another write, and invoke a PASSIVE checkpoint; current main treats busy=0 as success despite incomplete frames. Source and captured runtime observations establish the mechanism; this review did not execute it. Is this the best way to solve the issue? Yes: the patch repairs result interpretation at the existing owner and shares one warning formatter across diagnostic consumers, without introducing persistence or forced checkpoints. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 32074f6a75b4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Keep the checkpoint PRAGMA in the existing SQLite owner and pass its result to the observation helper. Treat file-size observation failures as advisory: record and log them without refusing an otherwise completed checkpoint or ownership handoff. Refs #146744
|
Merged via squash.
|
* commit '2acbeee461474b6ba41f5186ae1a4e0e80f4087a': (117 commits) fix(ui): import the shared deferred helper in sidebar scope tests (#146862) fix(ui): copy chat content from its context menu (#146679) perf(memory): defer legacy sidecar writer imports (#146815) fix(e2e): accept expected Kitchen Sink worker rejection (#146681) fix(ui): distinguish absolute and relative file links (#146572) feat(ui): keep file previews in tabs and render HTML (#146672) refactor: reuse shared deferred promises in UI tests (#146670) fix: gateway stop/restart refuses a healthy gateway when the Windows process snapshot misses (#146387) improve(crabbox): keep healthy cloud desktops warm on resume (#146816) fix: report blocked SQLite WAL checkpoints in status and doctor (#146775) feat: share browser dashboards with agents (#146702) fix(doctor): continue repairs after legacy agent directory collisions (#146092) feat(agents): retry cyber-refused embedded turns on Daybreak (#145291) fix: restore media uploads through protected egress (#144902) refactor(qa): share capture filter rendering (#146696) fix(cli): keep running stream jobs visible as running (#146793) refactor(parallels): share gateway readiness loop (#146694) fix(sessions): avoid rewriting already-consumed input on release (#146795) fix: preserve scheduled conversation delivery after Doctor (#146794) perf(ui): avoid redundant session-row provenance work (#146797) ...
…claw#146775) A passive SQLite checkpoint can return busy=0 while a reader prevents it from copying all WAL frames. Record blocked, complete, and failed outcomes on the existing maintenance handle and expose the recorded observation through status --deep and Doctor. Warn after two blocked observations or a WAL above max(2 × database bytes, 64 MiB), show frame progress and the last completed checkpoint, and name a graceful Gateway restart and status report as the next steps. Completion clears the warning. Observations are process-local; checkpoint scheduling, schemas, retention, and recovery stay unchanged. Validated by real-SQLite regression coverage, built-Gateway held-reader/recovery proof, and exact-head CI. This fixes the diagnostic gap; the original incident's long-lived reader remains unidentified. Fixes openclaw#146744 Refs openclaw#146719 Reported by @thegizmopro (openclaw#146719).
Fixes #146744
Refs #146719
What Problem This Solves
A SQLite reader can prevent a passive WAL checkpoint from finishing while SQLite returns
busy=0, causing OpenClaw to report success and leave operators without a useful warning.User Impact
openclaw status --deepand Doctor explain sustained or oversized blocked shared-state checkpoints, show frame progress and the last completed checkpoint, and name a graceful Gateway restart and status report as the next steps. Checkpoint errors are also recorded and reported.This addresses the diagnostic gap. The long-lived reader behind the original Windows incident remains unidentified.
Why This Change Was Made
The existing WAL maintenance handle now records each attempt and classifies incomplete frame progress as blocked. A warning appears after two consecutive blocked observations, or after one if the WAL exceeds
max(2 × database bytes, 64 MiB); the floor matches the existing retained-WAL size limit. Completion clears the warning.Status and Doctor consume the same recorded observation through the existing status RPC. Observations last for the open handle's lifetime, reset on retirement/restart, and are absent before the first maintenance attempt or on older Gateways. Normal periodic sampling remains every 30 minutes. Reading the observation does not probe storage or run a checkpoint. The native PRAGMA remains in the existing SQLite owner; file-size observation failures are recorded and logged without changing a completed checkpoint into a failure.
Reported by @thegizmopro (#146719).
Evidence
expected false, received true; status/Doctor regressions also failed when their production changes were reversed.busy=0, while the owner recordedstate=blocked,logFrames=120,checkpointedFrames=0,walBytes=494432,databaseBytes=3575808,consecutiveBlocked=122, andwarning=true. The last completion timestamp remained unchanged. Releasing the reader producedstate=complete,120/120frames,consecutiveBlocked=0, andwarning=falseon the next owner pass.status --deepanddoctor --non-interactiveboth displayed the warning, frame counts, last completion, and restart/report instructions. A laterstatus --deepcleared it. The rig used synthetic state and an external preload to accelerate the existing maintenance timer to one second; production cadence is unchanged.node scripts/check-changed.mjs,pnpm check:architecture, andpnpm buildpassed on the final layout. A final 94-second replay against the final built runtime completed 120 writes and again recorded blocked0/30frames, then complete30/30with the warning cleared.5f58141d7071aabb26bd0305885179c78f663801: run 34741924699, 118 successful jobs and 14 skipped jobs, including the Windows tests and runtime-topology architecture check.ClawSweeper review
Reviewed the completed review for
5f58141d7071aabb26bd0305885179c78f663801. No code or test findings remain. Skipped the data-model compatibility proof checkbox: checkpoint health is held only in the existing maintenance handle's closure, is absent before observation and after retirement, and is optional in status responses. This diff changes no schema, durable record, migration, retention policy, or recovery contract; the review's own evidence confirms that the migration concern is inapplicable. Existing real-SQLite and built-Gateway proof covers blocked observations, recovery, and warning clearance. No code changed during landing review.