Skip to content

fix(update): avoid duplicate database copies while the Gateway is stopped - #198148

Merged
steipete merged 9 commits into
mainfrom
steipete/perf-micro-update-dark-window-db-copies-20260919
Nov 13, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/perf-micro-update-dark-window-db-copies-20260919

Conversation

@steipete

@steipete steipete commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Schema-crossing updates keep the Gateway stopped while repeatedly copying large agent databases for read-only inspection.

User Impact

Eligible stopped-writer inspections avoid redundant whole-database images while retaining the primary rollback payload and validation. The maintainer accepted the completed 14-arm performance result for landing: stopped migration/cleanup falls from 5.56 to 4.22 minutes, CPU falls 12.82%, and outcomes match. The final head has green CI and a ClawSweeper review with zero open items.

Why This Change Was Made

Use the existing native updater maintenance lease and awaited worker handoff to checkpoint eligible WAL once, then capture source identities. Reuse the captured shared-state image and open drained, maintenance-owned sources immutably, including auth worker IPC. Preserve artifact-preserving scope, non-cacheable results and reader cleanup from #166857. A pinned reader/busy checkpoint, pending journal or unowned source retains the verified private-image path.

Activation-time capacity admission precedes checkpointing: successful preflight reserves no space. Full integrity/FK checks, hashes, durable publication, source-change fencing and recovery rules remain. No schema, product configuration, cache or online backup staging is added. Production LOC is net +76 versus the pinned main parent, primarily custody/IPC plumbing and the checkpoint/contention boundary.

Evidence

Candidate d342cc012364d2f29439bae60169fd76ca3d259e versus main parent 84727572dd04bc769679e124b0bd5f26857ec640, Node v26.12.1. Synthetic fixture: 30.08 GiB largest agent, 2.01 GiB shared state, seven agents, 10,003 sessions, 62,000 workspace files (~1.181 GB), and 128.9 MiB committed WAL including a real session-row update. The real native migration and cleanup run under maintenance custody, from schema 41 to 42. Preparation/outcome hashing are outside timing. Every arm cleans its source/staging files and compacts its private non-reflinking HFS+ image; native safety checks remain enabled. No operator data is used.

Pair Baseline stopped seconds Candidate stopped seconds Wall change CPU change
1 333.651 392.275 +17.57% +5.90%
2 302.028 236.807 -21.59% -15.35%
3 281.460 253.105 -10.07% -6.70%
4 408.578 297.599 -27.16% -10.86%
5 340.772 233.009 -31.62% -18.99%

Four interleaved unchanged controls: 336.845, 405.163, 367.156 and 319.104 seconds. Median stopped migration/cleanup improves 333.651→253.105 seconds (-24.14%); total process-tree CPU improves 384.14→334.89 seconds (-12.82%). Wall p95 (nearest-rank) is 408.578→392.275 seconds. Parent sampled allocations are 6.046→6.065 GB (+0.31%, versus 0.75% A/A range); complete child allocation totals are unavailable.

The rule published before sampling requires median wall improvement ≥10% and greater than the A/A relative wall range, at least four improving pairs, CPU within the A/A relative CPU range, and identical outcomes. Four pairs improve, CPU passes and all canonical session/transcript hashes, committed WAL content, schema versions and migration receipts match. The wall gate fails: 24.14% improvement is below 24.45% A/A variability. The first negative pair is retained. The original threshold remains reported as failed. The maintainer explicitly accepted this 0.31-percentage-point miss as noise and directed landing based on the measured work reduction, matching outcomes and lower CPU; this is a maintainer decision, not a claim that the predeclared wall gate passed.

The backup owner median falls 117.788→62.675 seconds. File samples show three distinct full-agent readonly images on every baseline arm and one on every candidate. Both retain the primary recovery payload; the later reclamation inspection still uses a private image because Doctor has written new WAL. Five-second sampling is a lower bound. These timings exclude service-manager stop/start/readiness, use natural OS caches, and do not reproduce dense transcript scanning or Linux/btrfs latency. The prior 35 GiB and 30 GiB diagnostic series also failed their noise gates; they are not substituted for this result.

Focused proof includes 110 infra tests, 32 Doctor tests and 14 lint-suppression tests. The final capacity-order correction passes all 76 capture/engine/space tests on both Node and pinned Bun, check:changed, and independent Codex P0–P2 review. Its retained-WAL regression fails on 4e74381 because capture changes source sidecars before refusing space; after the fix, hashes and mtimes remain unchanged. The earlier auth regression failed on 463af25 from changed SHM bytes and passes after immutable IPC handling.

Current-head CI hit the retained-copy test's 20-second publication deadline on Linux. It tested merge 8f31e91 onto main 68542b2. The unchanged retained case passes on that exact parent on macOS (7.78 seconds), Linux ARM64 (10.45 seconds), and Linux x64 translated on ARM64 (20.73 seconds total). Both Linux full-file runs pass all five cases. Replaying CI's exact two compact groups with its runner, pinned Node 24.22.1/Bun, eight-CPU scheduling budget and two concurrent plans also passes the affected seven-file group: 53 passed, 11 skipped; retained case 22.37 seconds total. Translation and different hardware limit timing equivalence. An initial container lacking init failed orphan-PID assertions, so it was corrected and is not evidence of the publication failure.

The publication test is byte-identical since e68dfaf / #190918, which introduced its deadline and cold compiler settings. This identifies the deadline's owner, not a proven introducing commit for the CI failure. The actual parent's staging/copy implementations also match the candidate. The retained request has no maintenance custody and does not select the changed stopped-checkpoint or auth-row branches. A fresh independent Codex review of the complete final patch is P0–P2 scoped-clean and finds no new wait or import initialization barrier on that path. The original timeout remains causally unattributed; passing replays are not a fix or an inherited-red waiver. No timeout, assertion, or production change was made to chase green. Ready-PR CI now passes on the identical head and merge tree (56 successful jobs, 27 skipped, including the successful aggregate gate). Its publication job passes all five lifecycle cases; retained-copy total is 25.262 seconds, including retirement after publication. ClawSweeper Revision 6 reviews this exact head with Before merge: None; Findings: None, and explicitly retains the original timeout uncertainty. No inherited-red exception is used.

Full manual validation on 3ef1, before the final capacity-order correction, finished with 240 successful, 20 failed and 8 skipped jobs. The published-driver job passes: published 2026.11.3→candidate reaches readyz=200; the native systemd survivor passes; a separate intentional scoped migration failure restores schema 42→26, retains two outbox rows and preserves an unrelated write. Broader manual-run failures remain reported, not blanket-waived; PostgreSQL inventory regressions reproduce on exact main parent and trace to #190001/#195369.

Legacy transcript-label rewriting remains before activation because replay recognizes the new provenance marker. No production scan-speedup claim is made. Moving the primary backup before stop remains a separate, design-only recovery-contract change requiring maintainer acceptance.

Design-only follow-up (B): Stage a consistent recovery image with SQLite’s online backup API while the old release serves, then finalize the exact committed generation under the existing stopped-writer lease and durably publish it before migration. An observed 104.4 GB primary capture took 404 seconds inside the stop; moving those writes online could remove that component, but final catch-up, whole-file SHA-256, integrity checks and fsync still belong in the measured stop budget. At 115–250 MB/s, a genuinely incremental 1–10 GB catch-up projects 4–87 seconds before validation; writes from another connection may instead restart SQLite backup, so this is not a promised bound. Budget at least 104.4 GB plus WAL headroom, or 208.8 GB plus overhead if staging coexists with a fallback image. Preserve exact pre-migration recovery, later-write refusal, crash/cancel safety and retirement after update finish. Validate serving latency, total I/O, disk peak and recovery under concurrent WAL writes before accepting this material persistent-store change. B is unimplemented and requires separate maintainer acceptance.

Use the existing maintenance custody and drained-family fact before eager read preparation. Reuse the completed stopped backup image for registry rediscovery while retaining current filesystem inventory and source mutation checks. Preserve backup publication, migration, and rollback contracts.
@clawsweeper

clawsweeper Bot commented Nov 13, 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 docs Improvements or additions to documentation scripts Repository scripts size: M labels Nov 13, 2026
@steipete
steipete marked this pull request as ready for review November 13, 2026 06:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T18:45:45.571093Z d342cc0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR checkpoints eligible stopped databases once and reuses captured images and immutable readers to avoid redundant inspection copies.

Example: A schema-crossing update inspects a synthetic 30.08 GiB agent database with committed WAL.

  • Before: The reported baseline creates three full-agent inspection images.
  • After: The candidate creates one while retaining the primary recovery payload and matching migration outcomes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful production-path evidence supports the repair, prior findings are resolved, and no new actionable defect was found; required CI remains incomplete.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Supplied native migration output exercises committed-WAL capture and Doctor inspection with matching content and receipts; the passing published-driver job covers stable upgrade and recovery, and the final capacity-order correction has focused red/green evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Large database inspection copies keep the Gateway stopped longer during schema-crossing updates.
Reason: The maintainer accepted the measured work reduction and explicitly accepted the narrow performance-noise threshold miss; the separate online-backup design remains outside this patch.

Merge readiness

✅ Ready for maintainer review

This PR provides a useful, maintainer-approved reduction in stopped-update I/O; prior findings are fixed, and the publication timeout does not establish a patch defect.

Priority: P2
Reviewed head: d342cc012364d2f29439bae60169fd76ca3d259e

Before merge

None.

Findings

None.

Agent review details

How this fits together

The native updater passes stopped database families through backup capture and Doctor inspection, producing verified recovery images, migration receipts, and schema-validation results.

flowchart TD
  A[Native updater maintenance lease] --> B[Capacity admission]
  B --> C[Eligible WAL checkpoint]
  C --> D[Verified recovery image]
  D --> E[Backup inventory inspection]
  C --> F[Immutable Doctor reads]
  C --> G[Private recovery fallback]
  F --> H[Migration and rollback verification]
  G --> H
Loading

Technical review

Best possible solution:

Land the focused copy reduction after required CI completes, preserving full rollback and artifact-preserving fallbacks.

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

Current main still eagerly prepares private inspection images despite eligible maintenance custody; the supplied native-update comparison exercises that redundant-copy path without requiring a new reproduction run.

Is this the best way to solve the issue?

The smallest complete repair uses the existing backup and maintenance owners: admit capacity, checkpoint eligible WAL, and consume prepared images or immutable reads while retaining journal and contention fallbacks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Stopped database capture changes intended behavior with a stated reason (21aa351: Use cheaper raw capture only for stopped, checkpointed families while retaining coherent recovery for WAL and journals.)
  • Artifact-preserving inspection keeps the original intent (3be8851: Keep Doctor inspections from changing existing database artifacts and retain scope-owned reader cleanup.)
  • Drained immutable reads keeps the original intent (b91520c: Avoid database-sized inspection scratch when maintenance custody and drained state make immutable reads safe.)
  • Activation capacity admission keeps the original intent (8738c09: Preflight reserves no space, so activation must independently admit the complete backup requirement.)
  • Auth reader opener selection keeps the original intent (2529bba: Keep snapshot orchestration lazy and let the existing reader owner receive its appropriate native opener.)
  • Performance observation tooling keeps the original intent (44ea337: Measure native update work without treating stopped backup capture as reusable full-integrity proof.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 3be8851 adds src/infra/sqlite-snapshot-source.ts:49 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3be885108e5e; files: src/infra/sqlite-snapshot-source.ts)
  • Jason (Json): Raw commit b91520c adds src/infra/sqlite-snapshot-source.ts:187 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b91520c16b62; files: src/infra/sqlite-snapshot-source.ts)

PR surface

Source +76, Tests +236, Docs +12, Other +290. Total +614 across 22 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 11 128 52 +76
Tests 6 303 67 +236
Docs 1 14 2 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 4 308 18 +290
Total 22 753 139 +614

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.

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +128/-52; tests +303/-67 The net production growth carries existing custody through preparation and auth IPC and preserves checkpoint integrity checks; tests cover retained WAL, pinned readers, aliases, artifact preservation, and capacity refusal.

Labels

Label changes:

  • 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. Replaced prior rating: 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Redundant database copies prolong schema-crossing update downtime, with a bounded optimization that preserves existing recovery behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • 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.

History

Review history (5 earlier review cycles)
  • reviewed 2026-11-13T07:11:57.918Z sha 429ddcf :: needs maintainer review before merge. :: none
  • reviewed 2026-11-13T11:55:49.903Z sha 8c6a50d :: needs changes before merge. :: [P2] Create the benchmark destination parent before copying the fixture
  • reviewed 2026-11-13T12:44:54.230Z sha 463af25 :: blocked before merge. :: [P2] Carry immutable access through the custodied worker boundary
  • reviewed 2026-11-13T16:20:18.683Z sha 4e74381 :: needs changes before merge. :: [P2] Check capture capacity before checkpointing source databases
  • reviewed 2026-11-13T17:33:07.164Z sha d342cc0 :: blocked before merge. :: none

Reviewed November 13, 2026, 1:49 PM ET / 18:49 UTC (Revision 6).

@steipete
steipete marked this pull request as draft November 13, 2026 07:53
Checkpoint committed WAL frames once under the native updater handoff before recording backup identities. Retain the pinned-reader fallback, final-image integrity validation, and primary rollback payload.

Read journal-free databases directly under maintenance custody across Doctor and read-only worker paths. Resolve file aliases before selecting immutable reads. Add WAL and alias regressions plus serial synthetic measurement tooling.
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: L and removed size: M labels Nov 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review 8c6a50dee6770d4b88e684dae02ec7e3d8fbb79f. The WAL follow-up checkpoints once under the existing stopped-writer handoff, keeps the primary recovery payload and integrity validation, and uses direct read-only WAL views under maintenance custody. It retains private recovery for journals and the verified fallback for pinned readers. Canonical sidecar checks also cover database-file aliases.

The previous hosted review had no open findings. Fresh local Codex review is clean at P0–P2 after reproducing and correcting an alias issue. The body records the current test/build gaps and exact-target CI. This PR remains draft: large-fixture A/A and A/B measurements must qualify the stopped interval and total CPU before landing.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 13, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@steipete

steipete commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressing both items in the latest review on final candidate d342cc012364d2f29439bae60169fd76ca3d259e:

  1. Capacity before checkpointing: fixed in src/infra/update-database-backup.ts:243–253. The existing capacity check now precedes prepareRestorableDatabaseFiles; source identities are still recorded after checkpointing. The retained-WAL refusal regression at src/infra/update-database-backup-space.test.ts:111–145 passes preflight with 74 MiB, drops capacity to 71 MiB before capture, and checks source DB/WAL/SHM hashes and modification times. It fails on 4e74381 because WAL is removed before refusal; all 76 focused tests pass on Node and pinned Bun after the fix.
  2. Activation-time admission from fix(update): size the disk preflight with the same calculation activation enforces #183177: retained and restored to its original pre-mutation position, not removed or duplicated. It measures the complete pre-checkpoint family conservatively. The regression explicitly proves a successful earlier preflight does not authorize later capture when capacity has fallen. check:changed and independent Codex P0–P2 review pass.

The PR remains held for performance qualification and CI attribution. Please review these fixes on this head.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@steipete
steipete marked this pull request as draft November 13, 2026 18:21
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressing the latest review's single open item on unchanged head d342cc012364d2f29439bae60169fd76ca3d259e:

  1. Resolve merge risk — publication timeout investigation. CI used main parent 68542b21d0d20ea368a1fb43d6b47aebf2e55d75, not the older performance baseline. On a clean archive of that exact parent, the full lifecycle file passes all five cases on Linux ARM64 and Linux x64 (the latter translated on ARM64). The retained case takes 10.45/20.73 seconds total. Replaying CI's exact two compact groups together with scripts/ci-run-node-test-shard.mts, Node 24.22.1, the pinned Bun fork, CPU scheduling budget 8 and plan concurrency 2 passes the affected seven-file group (53 passed, 11 skipped); the retained case takes 22.37 seconds total. The prepared inventory matches CI (15,345 inputs, 24,810 outputs). Different hardware/translation means these are bounded reproductions, not identical CI timing.

    Source: the retained request has no maintenance scope and calls startSqliteReadOnlyLocationAsync with artifact preservation. Its staging launch and the staging/copy implementations are unchanged from the actual CI parent. The new auth branch requires an auth-row request and drained maintenance custody; this case selects neither. The test file is unchanged since e68dfaf / fix: avoid state database clone stalls during Gateway startup #190918, which owns the deadline, but that alone does not identify the failure's introducing commit.

    Fresh independent Codex P0–P2 review of the complete final patch is scoped-clean and finds no added wait or import initialization barrier on this path. The original CI timeout was not reproduced and remains causally unattributed. No assertion/timeout was weakened, no speculative product fix was made, and no inherited-red waiver is requested. The passing replays do not erase the failed run. Please reassess the remaining merge-risk item against this source evidence and the ready-PR exact-head CI; merging still requires green CI and zero open items.

The maintainer explicitly accepted the performance result and directed landing: median stopped migration/cleanup 5.56→4.22 minutes (-24.14%), CPU -12.82%, identical outcomes and inspection images 3→1. Four of five pairs improve. The PR preserves the predeclared 24.45% A/A wall threshold as a narrow miss and records maintainer acceptance separately. B remains unimplemented; its recovery, I/O, headroom and validation design is now in the PR body. Previous capacity items remain fixed and covered by their numbered response and red/green regression.

@clawsweeper

clawsweeper Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete marked this pull request as ready for review November 13, 2026 18:42
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 13, 2026
@steipete
steipete merged commit 3bd03da into main Nov 13, 2026
384 of 391 checks passed
@steipete
steipete deleted the steipete/perf-micro-update-dark-window-db-copies-20260919 branch November 13, 2026 19:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 14, 2026
…pped (openclaw#198148)

* fix(update): avoid duplicate database copies while stopped

Use the existing maintenance custody and drained-family fact before eager read preparation. Reuse the completed stopped backup image for registry rediscovery while retaining current filesystem inventory and source mutation checks. Preserve backup publication, migration, and rollback contracts.

* fix(update): reuse stopped WAL databases without inspection copies

Checkpoint committed WAL frames once under the native updater handoff before recording backup identities. Retain the pinned-reader fallback, final-image integrity validation, and primary rollback payload.

Read journal-free databases directly under maintenance custody across Doctor and read-only worker paths. Resolve file aliases before selecting immutable reads. Add WAL and alias regressions plus serial synthetic measurement tooling.

* fix(update): carry immutable reads through auth worker IPC

* test(perf): preserve native safety in byte-copy update proof

* test(perf): retain checks for agents created by update Doctor

* test(update): verify WAL capture after capacity admission

* test(perf): reclaim sparse staging space between update arms

* fix(update): admit backup capacity before WAL checkpointing
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…aw#194058)

Failed-update triage now captures the operator's environment before managed candidate admission, so a coding agent installed only on the operator's PATH is still offered when the Gateway service's PATH differs. Restores the operator-environment contract from openclaw#134490 and keeps the launch confirmation from openclaw#143139.

Proof: shipped CLI on isolated Linux (Crabbox) with a running systemd Gateway: accept launches the operator-only agent, decline starts nothing, base 18bee8e reports no agent found; published 2026.11.1 upgrades to the fix with settings intact.

Co-authored-by: TorstenW <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: steipete <[email protected]>

(cherry picked from commit 7c702c3)

Release adaptation: Capture invoking operator env before candidate admission, forward to interactive triage only; preserve latest target selectors, confirmation and lease cleanup ordering. Exact three authorized production paths plus real lifecycle regression.

Follow-up dispositions: ad4863d fix: preserve the running installation when an agent updates its Gateway (openclaw#201570); dc73ec0 fix: let updates finish when another tool briefly reads OpenClaw's databases (openclaw#202541); d07b530 fix: clarify PostgreSQL schema upgrades for Git installs (openclaw#202098); e60ea9f test(update): add a Git release upgrade-survivor scenario (openclaw#201956); 2ef6f7b fix(update): build and serve Git releases outside node_modules (openclaw#201917); dbc1aa0 fix: keep the openclaw command and Gateway working after updating a pnpm install (openclaw#201735); f5e7641 fix: Git checkout updates across a schema change no longer end as post-update-failed after the new release starts (openclaw#201600); 2183caf fix: Git checkout updates no longer fail before the new release starts on a schema change or a busy database (openclaw#201463); 47e8649 fix: explain why Doctor cannot restore a scheduled job’s account (openclaw#201550); 8f2cfd4 fix: remove updater-only restrictions from agent maintenance guidance; cb5cfb2 fix: keep a doubtful killed-update recovery on the repair path (openclaw#201361); 24cb734 fix: keep carried-over scheduled jobs running after updates (openclaw#200653); d1276e1 feat(doctor): check OpenClaw ID member roles and honor an optional roles default (openclaw#197785); 0a39956 fix: finish updates when another tool reads OpenClaw's databases during the update (openclaw#201330); ea1c9d5 fix(update): settle remounted package publications before admission (openclaw#201336); 66b5212 fix(update): isolate malformed retained-install markers (openclaw#201199); 7e79c83 fix: let the next update finish a killed source checkout update (openclaw#201009); d905d8a fix: let the next update finish a killed update after the machine restarted (openclaw#200994); fdf0c95 fix: let the next update finish a killed update that had already installed the new version (openclaw#200866); 0c19bcd chore(release): close out 2026.11.5 on main (openclaw#200577); a1940e0 fix(matrix): keep explicit recovery available during deferred migration (openclaw#200805); 18b4776 improve: explain package baseline drift during updates (openclaw#200802); 1ad4cad fix(doctor): reclaim macOS updater runtimes blocked by non-updater processes (openclaw#200732); 427c857 fix: keep one missing archived transcript from blocking every update (openclaw#200733); 802e3f7 fix(update): keep valid cold archives from blocking updates (openclaw#200659); 23fca1a fix: let the next update continue after a killed update when nothing is left to repair (openclaw#200680); 3afe212 fix: let Doctor publish unchanged plugin migrations in any order (openclaw#200658); f65e4db fix(doctor): reclaim runtimes blocked by unrelated Linux processes (openclaw#200657); dab086c fix(update): let candidate Doctor read plugin dependencies from the staged package (openclaw#200595); 3447bee fix(update): keep updates going when the predecessor writes during its stop (openclaw#200569); 0ce9c77 fix: let the next update settle a package publication that a killed update left behind (openclaw#200550); ae31ea3 fix(update): repair handoffs in the journal-pinned lease store (openclaw#200532); 74020ea fix: continue updates when initial SQLite capture is stale (openclaw#200328); 6747b1e feat(update): run Git checkout installs from releases behind the release link (openclaw#199706); e3f8a67 fix(state): keep completed retained agent stores out of startup upgrade (openclaw#200284); 3c512c5 fix(gateway): move managed update lease operations off the main thread (openclaw#200169); ea69fcb chore(release): close out 2026.11.4 on main (openclaw#199956); 618bf31 fix(state): bound startup upgrade copies and pruning to owned state (openclaw#199929); e4a3093 perf(update): replace the candidate canary with a runtime contract check (openclaw#198268); 5dbf569 fix(update): plugin failures never fail an update or Gateway health; 764761e fix(update): refuse missing host prerequisites in one line and record a cause per attempt; 4c4fef4 fix(ui): update dialog claims installation before progress is confirmed (openclaw#199254); 136e1f6 fix(update): retrying an update from a dev checkout is refused after a killed update (openclaw#198673); 3bd03da fix(update): avoid duplicate database copies while the Gateway is stopped (openclaw#198148); 68a839b fix: isolate held agent databases until explicit restoration (openclaw#198180); e333f7e chore(ci): drop retired test-lines allocation records (3/3) (openclaw#197657); fd6fa47 fix: converge Gateway updates with environment-only service overrides (openclaw#196371); 7cf5e75 fix: clarify split-install updates and blocked Doctor repairs (openclaw#196342); 6ff8c86 fix(update): retain lazy sqlite catalog generation (openclaw#197095); 930e1f7 fix: keep stable updates and recovery free of premature migrations (openclaw#196474); a15f737 fix: preserve external plugin data during update rehearsal (openclaw#196301); 92798ae fix: updates survive interrupted heartbeat runs (openclaw#195656); c1e55e2 fix(update): restore LaunchAgent registration after repair contention (openclaw#195406); 715c610 fix(doctor): repair retained ISO session end timestamps (openclaw#194685); 689cfc8 fix(update): reclaim dead closing triage repair leases (openclaw#194503); 86bc89e fix(doctor): keep standing Codex parameter advice out of retirement blockers (openclaw#193650); 691bc8d fix(backup): read the backup engine without copying the live database (openclaw#194234); 000542f fix(backup): backups and updates fail on slow storage when a header probe batch misses its deadline (openclaw#194239); 31a65d5 fix(update): skip --no-lazy-fetch on Git versions without it (openclaw#194198); e45e99d fix(update): preserve dev update sources in tag-only Git clones (openclaw#193109)

Validation: Baseline2 intended operator-agent failures/32 controls passed; candidate34/34passed (194058-green.log). Accept launches synthetic operator-only CLI with expected env, decline starts nothing. Isolated updater flow, not live systemd/upgrade qualification.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 6689fd575ada8fe40a9593784deac18ec73041cd)
(cherry picked from commit 92e7a9fa223b0dc35801f25f70be90b472d9a6b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant