Repository navigation
fix(update): snapshot databases consistently under concurrent writes - #158317
Merged
Merged
Conversation
Contributor
|
🦞👀 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. |
steipete
marked this pull request as ready for review
September 25, 2026 20:33
steipete
enabled auto-merge (squash)
September 25, 2026 20:37
Manually stopping the gateway to update does not remedy the issue, see here: |
This was referenced Sep 25, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Sep 26, 2026
roboclaw-bot
added a commit
that referenced
this pull request
Sep 27, 2026
Backport the coupled all-database snapshot and pre-start rollback repairs: - #158317 / 979a8be - #158163 / d780fdc Source credit: Peter Steinberger (steipete). Capture complete source-preserving online snapshots with continuous Gateway exclusion for automatic restoration eligibility. Account for Doctor writes through exact native transaction images, ordered worker/heartbeat receipts and persistent metadata, including default_cache_size. Unknown observations refuse restoration rather than adopt foreign generations. Retain native source custody through displacement and separate published postimage custody through settlement. Missing names use creator-owned locked file capabilities and no-clobber publication. Published handles settle before absence-last handback. Preserve foreign replacements/contents, cleanup errors, WAL publication, live authority and the target restart attempted-start guard. Review findings were reproduced at actual boundaries and corrected. The final metadata proof passes 36 Doctor/image cases plus a real rollback positive; prior 29 current-custody cases and earlier scoped evidence remain retained, not relabeled as rerun. Production/focused types, lint, format and frozen eb377ac ratchets pass. Final independent P0-P2 review passes both partitions on exact tree a16411a. Linux/Node source proof is not installed-driver or full platform qualification. Windows/Bun restoration remains explicitly manual when native custody is not supported. No schema/dependency/version changes or guard/budget waivers. This component is committed locally only; parent composition and its bound service-membership fixture patch are still pending. Public size-policy hold remains active. Implementation: https://team.openclaw.ai/chat/roboclaw/dashboard/6dde6dee-8e3f-4d43-aada-2c1cf14afa4e Persistent metadata correction: https://team.openclaw.ai/chat/roboclaw/subagent/609bf089-d2c0-499e-8f9f-74c2615d43ac Original discussion, handback correction and final review: https://team.openclaw.ai/chat/roboclaw/dashboard/db4d78ac-b19b-4f64-adfb-0ca7973a62e4 Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
roboclaw-bot
added a commit
that referenced
this pull request
Sep 27, 2026
Merge the reviewed coupled snapshot/rollback component into the prepared release branch, preserving the existing service, Doctor, APFS, vendor and already-landed canonical release repairs. Source credit remains Peter Steinberger for #158317/#158163; all inherited contributor credits remain. Apply the service-membership fixture only after matching its recorded exact preimage and verify its postimage. Repair the extracted wrapper closure with the three existing transaction/image/receipt modules required by the new SQLite worker flow. Bind maintenance exclusion to a private live owner: foreign late delegates and unowned schema work refuse while valid same-owner delegates retain the fence through release and cleanup. The quarantine inventory review concern was refuted by its existing producer filter and real create/verify/restore WAL coverage, with a discriminating filter-removal control. No redundant backup production filter or schema change was added. Composed interaction proof: 81 tests across nine files plus two extracted wrapper checks pass. The final ownership repair passes 108 unique tests in 11 owner/sibling files, production/exact-owner types, lint, formatting and all frozen eb377ac ratchets. Earlier independent source proof remains retained rather than relabeled as rerun. Final independent P0-P2 review completed all five partitions with zero findings on exact tree d963fed; all 132 file bindings match. This is local preparation, not canonical release publication or installed platform qualification. Version remains 2026.9.6 and fs-safe remains0.18.1. The separately accepted dependency PR and the public size-policy decision remain external gates. No guard, assertion, lease, timeout or baseline waiver. ## Work sessions - Original discussion, review and final integration: https://team.openclaw.ai/chat/roboclaw/dashboard/db4d78ac-b19b-4f64-adfb-0ca7973a62e4 - Final ownership correction and verification: https://team.openclaw.ai/chat/roboclaw/subagent/2a4b17b6-c5cf-4278-b582-debae9da3826 - Database implementation: https://team.openclaw.ai/chat/roboclaw/dashboard/6dde6dee-8e3f-4d43-aada-2c1cf14afa4e - Persistent metadata correction: https://team.openclaw.ai/chat/roboclaw/subagent/609bf089-d2c0-499e-8f9f-74c2615d43ac Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
azuretek
added a commit
to azuretek/nucleo
that referenced
this pull request
Sep 30, 2026
This was referenced Oct 3, 2026
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #157603
What Problem This Solves
Fixes update schema preflight and candidate snapshots failing after repeated large database copies while a running Gateway continues writing.
User Impact
Updates can snapshot active databases consistently, including committed WAL content, with pages, bytes, and elapsed time visible in the existing update ledger. A genuine storage/access failure is reported once with an actionable next step.
The already-installed 2026.9.5 updater is not retrofitted. Until an updated driver is installed, stop the Gateway service and run
openclaw updatefrom a separate terminal, then start the service again. Normal Gateway databases use WAL; a consistent snapshot of a rollback-journal database holds SQLite's required reader lock and can temporarily delay its writer.Why This Change Was Made
Copying database files and retrying until their metadata stops changing treats ordinary Gateway activity as a failure. Update preflight now uses a dedicated reader, and async snapshot acquisition uses the existing canonical SQLite online-backup primitive with a pinned read transaction. This removes the async stabilization loop and its “did not stabilize” failure, while retaining the separate synchronous artifact-preservation contract. No new schema, configuration, CLI option, dependency, or progress store is introduced.
Native progress flows through the existing worker diagnostics and update ledger. The native backup's resolved page count supplies the completion event, and grouped byte counts preserve useful sizes through existing support redaction.
The plugin-build directory leak is already addressed by #154324 (operation cleanup) and #157727 (stale tokenless capture reclamation). This PR verifies those owners instead of duplicating them. Reported by @Nickfost.
Evidence
SQLite source did not stabilize after 10 read-only inspection attemptsunder concurrent writes/checkpoints. The fixed preflight and snapshot paths succeed on the first acquisition and pass integrity checks.openclaw update --tag file:<candidate.tgz> --yes --json --no-restart. The snapshot contained 3,770,085,376 bytes / 920,476 pages, copied in 3.605 s, with 16 observed database-version transitions during copying; verification/publication finished in 27.9 s. The update succeeded, integrity passed, and the Gateway kept running. System and operation temp-directory censuses contained noopenclaw-plugin-build-*roots after cleanup. Leasetbx_01m3cwt6mghc1gwgbeqxhaznfp: https://github.com/openclaw/openclaw/actions/runs/36172908071.[email protected]→ candidate Docker upgrade cell passed with its offline fixture. This does not claim the old driver gained concurrent-write support.tbx_01m3cyn9yxk11ke26nh83k55nt: https://github.com/openclaw/openclaw/actions/runs/36176317620.run-main.cleanup,plugin-source-capture-directory, andplugin-source-capture-recovery.node scripts/check-changed.mjs -- <changed paths>completed with exit 0, including core production types, all 25 test type graphs, lint, dead-export scans, and repository guards. Testbox command time: 30m15.492s. Leasetbx_01m3d24rh1hmmqcwnba6j3kr1w: https://github.com/openclaw/openclaw/actions/runs/36182540425. Fresh Codex autoreview found no actionable P0/P1 findings;git diff --checkpassed. No source edits followed the completed test/live proof, so those results were reused.Measured single-file
pnpm test <file> --maxWorkers=1wall times on Testbox (shared compiler/worker preparation included):src/cli/update-cli.target-schema.test.tssrc/cli/update-cli/schema-preflight.test.tssrc/infra/sqlite-backup.test.tssrc/infra/sqlite-readonly-location.copy.test.tssrc/infra/sqlite-readonly-location.test.tssrc/infra/update-candidate-canary.test.tssrc/infra/update-candidate-state.online-backup.process.test.tssrc/infra/update-candidate-state.schema.test.tsPer-PR CI timings are pending. The final canary and candidate-admission suites also passed three times after the byte-format and strict mock-expectation corrections (75 tests per run).
Known gaps / follow-ups
These pre-existing slow cases passed and are explicitly assigned to separate follow-up lanes:
extensions/qa-lab/src/control-ui-media-transcript.real-gateway.e2e.test.tsrenders recoverable and omitted image historydelivers PowerPoint and keeps persisted attachment failures replay-safeextensions/memory-core/src/tools.index-upgrade.test.tskeeps the rebuild cost warning when a search deadline expires during embeddingThe controlled offline systemd handoff drain hang reported in #157603 belongs to the #157329/#153401 class and is not changed here.