Skip to content

fix: let package updates start while the Gateway is writing to an agent database - #201545

Merged
fuller-stack-dev merged 6 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-preflight-reads-schema-without-copy
Nov 19, 2026
Merged

fuller-stack-dev merged 6 commits into
openclaw:mainfrom
fuller-stack-dev:fix/update-preflight-reads-schema-without-copy

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

On a package install whose agent is busy, openclaw update (CLI, or update.run through the Gateway) can refuse at database-schema-preflight after 60 to 96 seconds: "could not inspect agent database ... SQLite source did not stabilize (reason=wal-copy-unstable) ... Wait a moment for write activity to settle". A retry refuses the same way. The only advice printed is openclaw triage, or a manual npm install that bypasses the guard. Nothing is changed and the Gateway keeps serving, but the update cannot start while the Gateway is writing.

The cause: the schema check reads each agent database through a private full copy of the live file, and a copy of a file the Gateway keeps writing never holds still. The same runs also printed "Database changed during capture; its snapshot requires manual recovery", which was false. Nothing had changed and nothing needed recovery.

User Impact

User impact: the update's schema check reads a live agent database where it is, without copying it, while the Gateway serves and writes. The check's time and disk use no longer grow with the database's size. Users on the published 2026.11.5 get this with no manual step once a release containing this commit is published, because the candidate package runs the check (see "Update behavior for published updaters").

Why This Change Was Made

Root cause: candidate admission (update-command-admit.ts) inspects state under artifact-preserving reads. Under those reads, preflightOpenClawDatabaseSchemas skipped the native read for every agent store and always prepared a private full copy (prepareSqliteReadOnlyLocation).

Every pre-update schema read funnels through one owner: checkTargetDatabaseSchemasForContexts → preflightOpenClawDatabaseSchemas. Its callers:

  • candidate admission (update-command-admit.ts), used by the CLI and by update.run, because the Gateway starts the same updater;
  • the installed updater's revalidation of the contexts the candidate did not cover (update-command-database-context.ts);
  • the schema preflight before activation (update-command-schema.ts);
  • the original-service context check (update-command-original-service.ts).

Without artifact preservation, the owner already read a live store in place. With artifact preservation, it now does too. The activation baseline (captureUpdateActivationSchemas → readUpdateStateSchemaVersions) does not preserve artifacts and already reads a complete WAL family in place (inspectSqliteSchemaHeaderInProcess), so it is unchanged.

What the copy protected (89217d3): admission must not change any source byte. A plain read-only open can claim a WAL-index reader mark in -shm, rebuild the index, or create -wal/-shm for a closed store. That protection is real, and this change keeps it.

Fix: the isolated schema reader opens a store with a complete WAL family (-wal and -shm present, WAL mode, no rollback journal) through SQLite's read-only shared-memory index (file:...?mode=ro&readonly_shm=1).

  • The read takes no reader mark, rebuilds no index and creates no sidecar, and it still sees a schema committed only to the WAL.
  • If SQLite cannot use a read-only index (a SQLITE_READONLY result), the store falls back to the existing private snapshot. On main, that path also has fix: let updates proceed while a busy agent database keeps writing #201327's online-backup fallback.
  • Stores without a complete WAL family (closed, no sidecars, rollback journal) keep the private snapshot.
  • Non-preserving callers and PostgreSQL stores are unchanged.

Warning text: the per-database capture warning now reads "Database write generation changed or could not be confirmed during capture (the running Gateway may have written to it); automatic rollback keeps the live database instead of this snapshot: ". That is what happens: automatic restoration is turned off for that capture, and the live database is kept. It no longer claims manual recovery is needed. One sentence covers both cases, so the change cherry-picks to the release line with no code differences.

No new config key, stored field, schema, protocol, dependency, retention or permission.

Relation to #201463: independent, and in other files. Once both land, #201463's post-activation reader can use this read-only-index path for live stores. Neither PR needs that unification.

Update behavior for published updaters

  • The admission check runs in the candidate package (openclaw update admit), and the installed updater skips revalidating any context the candidate covered. So a published 2026.11.5 updater reads schemas through this code once the target release contains it. Proven end to end below: installed published 2026.11.5, candidate v2026.11.5 plus this commit, busy writer, update succeeded.
  • Remaining on 2026.11.5: the installed updater's best-effort original-state capture still cannot copy a busy store. Its existing warning says the update continues without the capture, and that rollback uses the pre-migration snapshots taken after the Gateway stops. The update completes. That capture is a real backup taken by the installed updater, which cannot be patched, so this PR does not change it.
  • Steps this change leaves to a person: none for this failure.
  • Not fixed here (other owners; seen in the update-matrix busy cells):
    • the update.run reply says skipped, with a Doctor hint, when the run actually failed;
    • a CLI retry right after a Gateway-started failure is refused with "Another update executor owns this installation."

Evidence

Owner level (src/state/openclaw-database-preflight.artifacts.test.ts; real child-process owners and real WAL files):

  • admits a live agent store's schema without a stable copy while it keeps checkpointing. Setup: a 32 MiB store whose owner process commits 128 KiB batches with SQLite's default auto-checkpoint. Admission must report the store's newer schema and make no private copy of it, and the owner must keep committing across the check.
  • refuses a newer schema committed only to an open WAL without changing a source byte. Setup: the owner holds the WAL open after committing a newer user_version only to the WAL. Admission must refuse it, and every byte of the main file, -wal and -shm must stay the same, with no reader-mark masking. Base passes through the copy and fails only the no-copy assertion. Head passes through the read-only index. This guards what the copy protected.
  • Unchanged and still green: the candidate-admission CLI test with idle open WAL stores and a newer agent schema committed only to the WAL, which compares artifacts byte for byte (update-command-admit.test.ts, from 89217d3).

Cost of the admission schema check on one host, measured with the same script on both builds (script not committed; one run each). Setup: a 512 MiB agent store, writer at 8 MiB/s with default auto-checkpoint.

Code Admission check wall Peak snapshot staging Result
main 999e873 (with #201327) 13.7 s 580 MiB admitted after copy attempts and an online backup
this PR 0.6 s (4.6 s under concurrent Docker load) 1 MiB admitted, read in place

End to end (installed package, real Gateway, real openclaw update --yes --json):

  • Load: a Gateway-gated writer commits 16 KiB rows to a 512 MiB agent database at 8 MiB/s with default auto-checkpoint.
  • Harness: scripts/e2e/update-matrix-docker.sh (branch test/update-matrix-e2e). It uses a bare E2E image with a systemd-shim user service, and a loopback fixture registry that serves the candidate relabeled 2026.11.6.
Cell Installed updater Candidate Result Update wall Gateway downtime Peak extra disk
RED, CLI (update matrix) published 2026.11.5 main b400e8d (before #201327) exit 1 database-schema-preflight (wal-copy-unstable); repeat refuses the same way 96 s 0 s 1.7 GiB
RED, update.run (update matrix) published 2026.11.5 main b400e8d failed database-schema-preflight 72 s 0 s 1.9 GiB
Counterpart, CLI published 2026.11.5 published 2026.11.5 relabeled exit 0; the copy race went the other way this time 316 s 137 s 0.6 GiB
GREEN, CLI published 2026.11.5 v2026.11.5 + this commit exit 0, run succeeded, Gateway serves 2026.11.6, repeat already-current 452 s 199 s (package swap and Doctor) 1.1 GiB

The copy race depends on timing: on this host, two of the three red runs refused and the counterpart passed. So the deterministic proof sits at the owner level (whether a copy is made). The end-to-end green shows that the release-line package updates a published 2026.11.5 install under load. The Gateway downtime and peak disk in these cells come from the package swap, Doctor and the installed updater's own captures, which this PR does not change. The idle baseline from the update matrix is 233 s in the updater, with one 108 s outage.

Recordings of the owner test (RED: base production code with the PR test; GREEN: PR head):

RED, base 3eee09d:

owner-red.mp4

GREEN, PR head:

owner-green.mp4

Full raw logs are not attached because the artifact store rejected uploads from this machine (crabbox artifacts publish returned http 401). Decisive excerpts:

RED: update result (published 2026.11.5 updater, candidate main b400e8d)
update: exit=1 status=error reason=database-schema-preflight wall=95963ms peakDisk=1682 MiB
run: {"phase":"finished","status":"failed","reason":"database-schema-preflight"}
candidateAdmission: owner=candidate, verdict=refuse, database-schema: refuse
Update refused: could not inspect agent database $OPENCLAW_STATE_DIR/agents/main/agent/openclaw-agent.sqlite: SQLite read-only worker failed while creating its private snapshot: SQLite source did not stabilize (reason=wal-copy-unstable, attempts=10) after 10 read-only inspection attempts. Wait a moment for write activity to settle, then retry the inspection; check database access and free disk space, then retry the update.
Warning: Database changed during capture; its snapshot requires manual recovery: $OPENCLAW_STATE_DIR/agents/main/agent/openclaw-agent.sqlite
before/after: serving 2026.11.5 (never stopped)
repeat: exit=1 status=error reason=database-schema-preflight wall=72628ms
GREEN: update result (published 2026.11.5 updater, candidate v2026.11.5 + this commit)
update: exit=0 status=ok reason=null wall=451622ms peakDisk=1122 MiB
run: {"phase":"finished","status":"succeeded","reason":null}
admission checks: config ok, database-schema ok, node-runtime ok, plugin-availability ok
before: cli=OpenClaw 2026.11.5 (e13cf15) serving 2026.11.5
after:  cli=OpenClaw 2026.11.6 (e13cf15) serving 2026.11.6, readyz=true
outages during update (ms): [253, 253, 198834]
repeat: exit=0 status=skipped reason=already-current
load: {"commits":1063,"busy":0,"other":0,"db":"531 MiB"}
Warning (installed 2026.11.5 updater, best-effort original-state capture): Original state capture is unavailable; the update continues without it. ...

The revised capture warning comes from the backup owner. update-database-backup.test.ts asserts its exact rendered text, and three engine tests assert it for the write case and the unavailable-generation case. The cells cannot show it, because the installed 2026.11.5 updater prints its own copy of the warning.

CI on head f443ea8: two failing shards, both inherited and unrelated to this diff. checks-node-changed fails on test/gateway-restart-handoff.e2e.test.ts (a session resumeAfterRestart entry shape, from restart-resume code this diff does not touch; the test is Linux-only and could not be run locally). checks-node-changed-compact-large-30-1 hangs on src/config/sessions/session-accessor.sqlite-reclamation-wal.test.ts (reclaim); it also hangs locally for 300 s with this PR's production files reverted to main.

Checks run on head:

  • Focused Vitest for the preflight, admission, schema-inspection worker, node-sqlite, SQLite read-only location, update candidate state, backup and status suites. All pass except two update-candidate-state.result.test.ts cases that fail with ENAMETOOLONG on this macOS host; they fail the same way on the base.
  • tsgo:core, tsgo:core:test, oxlint on the touched files, check:baseline-ratchets, and git diff --check.
  • An independent read-only reviewer (Opus); findings and resolutions are below. autoreview does not run on this machine.

Not proven:

  • Windows: not run. If SQLite there cannot use a read-only index, the read falls back to the existing private snapshot.
  • The automatic update campaign, which the harness cannot drive: the 2026.11.5 update check asks public npm, and the stable channel waits 6 hours plus jitter.
Independent review findings and resolutions
  1. The warning claimed a write when the generation was only unreadable. Fixed: one sentence now covers "changed or could not be confirmed".
  2. No test proved byte preservation or WAL-only detection on the new path. Fixed: added an idle-owner test (unmasked, all sidecars). The live-owner test now asserts that no private copy was made and that the owner kept committing.
  3. Close race: when the last connection closes while admission opens the store, the read-only index cannot be opened and SQLite throws SQLITE_CANTOPEN (found by the landing review: 60 to 65 of 400 reads in a close-race probe, plus 2 in a long stress run; never a wrong, torn or stale version). Before the fix, that throw escaped the read's handler, so the preflight refused with "could not inspect agent database". Fixed: under artifact preservation, SQLITE_CANTOPEN now returns no result, and the store goes to the private snapshot path. That path rereads the closed store, which has no live writer, and reports any lasting open failure itself, so a fallback can never admit on its own. No other open error is converted. Regression: falls back to the private snapshot when the last owner closes during a preserving read runs 300 reads against an owner that opens, commits and closes as the last connection. It failed 3 of 3 runs before the fix (unable to open database file) and passed 3 of 3 after; the probe went from 60 errors in 400 reads to 0 (233 in-place reads, 167 snapshot fallbacks), with no sidecar left behind.
  4. No test for the SQLITE_READONLY fallback. Not added: SQLite returns that code only when it cannot use a read-only index, and that cannot be forced on SQLite 3.54 without mocking the native layer. The fallback is the existing snapshot path, which is covered.
  5. Test cleanup could mask a writer crash. Fixed: stop is sent only while the IPC channel is connected.
  6. Doctor and startup checks that preserve artifacts and verify integrity now run on the live store inside one read transaction, not on a full copy. While they run, the checkpointer cannot restart the WAL. Accepted: no bytes change, the alternative is a full copy, and the WAL is checkpointed after the read.

ClawSweeper (one local round): overall D, proof D, patch C, "patch is correct".

Cherry-pick for the release line

  • Commits to pick: the squash merge of this PR. On the branch, that is fix(update): read live agent schemas without a stable copy, test(update): check live-owner progress across admission and shrink the idle fixture and fix(update): fall back to the snapshot when the last owner closes during a preserving read.
  • Tested on a detached v2026.11.5 (e13cf15). git cherry-pick -n of the fix commit gives three mechanical textual conflicts:
    • src/state/openclaw-database-preflight.ts: the tag also reads cleanly closed runtime stores natively. Take the PR's block, and keep that path non-preserving by adding && !(purpose === "runtime" && readSqliteDatabaseCleanClose(realAgentPath)) to the preserveSourceArtifacts expression.
    • src/infra/sqlite-readonly-inspection.ts: comment wording only. Take the PR's preserve/closedWal/early-return block, and keep the PR's try/catch around the final withSqliteSourceReadDatabase call, together with the isSqliteCantOpenError helper (the close-race fallback).
    • src/infra/update-database-backup.test.ts: the PR's surrounding test does not exist at the tag. Keep the tag's side, and update the tag's one existing assertion of the old warning text to the new sentence.
  • The test commit applies unchanged to the artifacts test file, which is identical at the tag and the base.
  • The close-race fix commit (fix(update): fall back to the snapshot when the last owner closes during a preserving read) cherry-picks cleanly on top of the resolved pick at the tag. I did not rerun the tests at the tag for it: the machine is being kept quiet.
  • After that, tsgo:core passes, and 292 focused tests pass at the tag: the preflight artifacts and main suites, schema-inspection worker, node-sqlite, backup, backup engine, status, candidate admission and schema preflight. The package built from the tag plus the pick is the GREEN cell above.
  • No other commit is needed: it does not depend on feat(update): run Git checkout installs from releases behind the release link #199706 (Git release mode), fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database #201463 or fix: let updates proceed while a busy agent database keeps writing #201327.
  • Alternative or companion for the release line: fix: let updates proceed while a busy agent database keeps writing #201327 (07baab52b41) by itself also removes the refusal. Its cherry-pick onto v2026.11.5 has one conflict in src/infra/sqlite-readonly-location.ts: take the incoming side, which adds the LIVE_WRITER_CHANGES set and the async online-backup fallback. After that, tsgo:core passes and its own sqlite-readonly-location.test.ts passes there (26 passed, 1 skipped). Its Docker cell (installed published 2026.11.5, candidate v2026.11.5 + fix: let updates proceed while a busy agent database keeps writing #201327, same load) exits 0 and the Gateway serves 2026.11.6: 224 s wall, one 93 s outage, peak extra disk 3.7 GiB. It still copies the live store during admission, which is the cost in the table above. The two commits compose: this PR reads live WAL stores in place, and fix: let updates proceed while a busy agent database keeps writing #201327's fallback covers whatever still takes the copy path.

Landing follow-up

aaf5c777a45 reads the open failure code through sqlitePrimaryResultCode (src/infra/sqlite-error-diagnostics.ts) instead of a type assertion, which the assertion-safety ratchet rejected on 712b9684bf7. Behavior is unchanged: on that head the assertion-safety ratchet passes, openclaw-database-preflight.artifacts.test.ts passes (9/9, including the close-race fallback test), and a 400-read open/commit/close probe returns no errors (180 in place, 220 via the snapshot).

Candidate admission inspects agent databases with artifact preservation, so
every agent store went through a private full copy. A copy of a store the
serving Gateway keeps writing never stabilizes, and `openclaw update` refused
at database-schema-preflight (wal-copy-unstable) after up to 96 seconds.

A complete WAL family is now read in the isolated reader through SQLite's
read-only shared-memory index (`readonly_shm=1`): no reader mark, no index
rebuild, no sidecar creation, so every source byte is preserved and the
WAL-only committed schema is still seen. Any other family, or a read-only
index SQLite cannot use, keeps the private snapshot path.

The capture warning no longer claims manual recovery is needed. It says the
write generation changed or could not be confirmed and that automatic
rollback keeps the live database instead of that snapshot.
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Nov 19, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reads eligible live agent schemas through SQLite’s read-only shared-memory index and clarifies the backup warning.

Example: A package update inspects a 512 MiB agent database receiving 8 MiB/s of writes.

  • Before: Current main retries private copies and can then take a full online backup.
  • After: The schema reader inspects the live WAL transaction without copying the database or changing its existing artifacts.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused implementation with shipped-update evidence and distinct owner regressions; exact-head CI still requires resolution.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): Supplied terminal output maps the changed admission owner to a real package update from published 2026.11.5 under a checkpointing writer, followed by successful readiness and an already-current retry; unavailable video inspection does not negate those logs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Package updates can be refused on published versions, or incur full-database copying on main, while an agent database keeps checkpointing.
Reason: The maintainer-authored direction removes unnecessary work while preserving the established source-artifact contract; the neighboring post-activation repair remains separate.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it removes database-sized admission copies beyond the merged fallback, and no concrete introduced defect was found; the failing restart-handoff check remains unattributed.

Priority: P2
Reviewed head: f443ea86e29168346d902ca9c8acc9059e38634b

Before merge

None.

Findings

None.

Agent review details

How this fits together

CLI and Gateway-triggered updates send database paths and supported schema versions through candidate admission to the shared preflight owner, which returns compatibility results from an isolated inspection child.

flowchart TD
  A[CLI or Gateway update] --> B[Candidate admission]
  B --> C[Database schema preflight]
  C --> D[Isolated schema reader]
  D --> E[Read only WAL index]
  D --> F[Existing private snapshot fallback]
  E --> G[Compatibility result]
  F --> G
Loading

Technical review

Best possible solution:

Use the existing inspection child for byte-preserving live WAL reads while retaining private snapshots for families SQLite cannot inspect that way.

Do we have a high-confidence way to reproduce the issue?

Current-main source confirms artifact-preserving agent admission still copies the database, and the supplied red/green evidence exercises the checkpointing-writer trigger; no target code was executed during this review.

Is this the best way to solve the issue?

The patch addresses the unnecessary copy at its existing owner, preserves schema rejection and fallback behavior, and introduces no competing state or configuration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 895091c98787.

Provenance checked

  • Artifact-preserving agent admission changes intended behavior with a stated reason (89217d3: Ordinary native read-only opens could change SHM, so explicit preservation deliberately required private snapshots.)
  • Isolated coherent schema inspection keeps the original intent (improve(doctor): speed up schema checks for large databases #143802: Inspect schema metadata in a coherent child transaction without full copies, retaining ownership decisions and source-reader lifetime isolation.)
  • Source-handle cleanup and process isolation keeps the original intent (8b16e53: Keep native source reads and cleanup under their existing lifetime owner while avoiding redundant coordination machinery.)
  • Backup capture warning changes intended behavior with a stated reason (6c672d4: Retain capture-generation checks and refuse automatic restoration when attribution cannot be established; this PR changes the diagnostic without weakening that decision.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +35, Tests +137. Total +172 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 7 53 18 +35
Tests 4 143 6 +137
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 196 24 +172

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: This improves busy-database package updates and removes database-sized admission work; current main already has a fallback for the original refusal.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This improves busy-database package updates and removes database-sized admission work; current main already has a fallback for the original refusal.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 18, 2026, 8:20 PM ET / November 19, 2026, 01:20 UTC.

…s owner

The close-race fallback read errcode through an uncommented type assertion, which the assertion-safety ratchet rejects. Use sqlitePrimaryResultCode from sqlite-error-diagnostics instead.
@fuller-stack-dev
fuller-stack-dev merged commit 911e7c1 into openclaw:main Nov 19, 2026
218 of 220 checks passed
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

@fuller-stack-dev
fuller-stack-dev deleted the fix/update-preflight-reads-schema-without-copy branch November 19, 2026 04:29
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…nt database (#201545)

* fix(update): read live agent schemas without a stable copy

Candidate admission inspects agent databases with artifact preservation, so
every agent store went through a private full copy. A copy of a store the
serving Gateway keeps writing never stabilizes, and `openclaw update` refused
at database-schema-preflight (wal-copy-unstable) after up to 96 seconds.

A complete WAL family is now read in the isolated reader through SQLite's
read-only shared-memory index (`readonly_shm=1`): no reader mark, no index
rebuild, no sidecar creation, so every source byte is preserved and the
WAL-only committed schema is still seen. Any other family, or a read-only
index SQLite cannot use, keeps the private snapshot path.

The capture warning no longer claims manual recovery is needed. It says the
write generation changed or could not be confirmed and that automatic
rollback keeps the live database instead of that snapshot.

* test(update): check live-owner progress across admission and shrink the idle fixture

* fix(update): fall back to the snapshot when the last owner closes during a preserving read

* fix(update): read the SQLite open failure code through its diagnostics owner

The close-race fallback read errcode through an uncommented type assertion, which the assertion-safety ratchet rejects. Use sqlitePrimaryResultCode from sqlite-error-diagnostics instead.

(cherry picked from commit 911e7c1)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
…nt database (openclaw#201545)

* fix(update): read live agent schemas without a stable copy

Candidate admission inspects agent databases with artifact preservation, so
every agent store went through a private full copy. A copy of a store the
serving Gateway keeps writing never stabilizes, and `openclaw update` refused
at database-schema-preflight (wal-copy-unstable) after up to 96 seconds.

A complete WAL family is now read in the isolated reader through SQLite's
read-only shared-memory index (`readonly_shm=1`): no reader mark, no index
rebuild, no sidecar creation, so every source byte is preserved and the
WAL-only committed schema is still seen. Any other family, or a read-only
index SQLite cannot use, keeps the private snapshot path.

The capture warning no longer claims manual recovery is needed. It says the
write generation changed or could not be confirmed and that automatic
rollback keeps the live database instead of that snapshot.

* test(update): check live-owner progress across admission and shrink the idle fixture

* fix(update): fall back to the snapshot when the last owner closes during a preserving read

* fix(update): read the SQLite open failure code through its diagnostics owner

The close-race fallback read errcode through an uncommented type assertion, which the assertion-safety ratchet rejects. Use sqlitePrimaryResultCode from sqlite-error-diagnostics instead.
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…nt database (openclaw#201545)

* fix(update): read live agent schemas without a stable copy

Candidate admission inspects agent databases with artifact preservation, so
every agent store went through a private full copy. A copy of a store the
serving Gateway keeps writing never stabilizes, and `openclaw update` refused
at database-schema-preflight (wal-copy-unstable) after up to 96 seconds.

A complete WAL family is now read in the isolated reader through SQLite's
read-only shared-memory index (`readonly_shm=1`): no reader mark, no index
rebuild, no sidecar creation, so every source byte is preserved and the
WAL-only committed schema is still seen. Any other family, or a read-only
index SQLite cannot use, keeps the private snapshot path.

The capture warning no longer claims manual recovery is needed. It says the
write generation changed or could not be confirmed and that automatic
rollback keeps the live database instead of that snapshot.

* test(update): check live-owner progress across admission and shrink the idle fixture

* fix(update): fall back to the snapshot when the last owner closes during a preserving read

* fix(update): read the SQLite open failure code through its diagnostics owner

The close-race fallback read errcode through an uncommented type assertion, which the assertion-safety ratchet rejects. Use sqlitePrimaryResultCode from sqlite-error-diagnostics instead.

(cherry picked from commit 911e7c1)

Release adaptation: Preserved baseline schema-version snapshot pinning and private fallback. Resolved comment/closed-WAL overlap with source read-only-SHM branch; all eleven source files retained.

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant