Skip to content

fix(update): avoid rehearsal failures while databases are active - #149449

Merged
fuller-stack-dev merged 14 commits into
mainfrom
openclaw/rehearsal-current-native-2114
Sep 19, 2026
Merged

fuller-stack-dev merged 14 commits into
mainfrom
openclaw/rehearsal-current-native-2114

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

What problem this solves

Update rehearsal could fail to inventory or copy databases while another process kept committing SQLite WAL transactions. Rehearsal now uses the existing SQLite online-backup owner to acquire consistent disposable copies. Schema inspection keeps its existing synchronous, non-attaching path.

Cancellation, deadlines, disk-space and output limits remain enforced. Scratch is retained when worker or monitor settlement cannot be confirmed.

Related: #144005, #145169, #149350. This is the acquisition repair, not completion of the broader atomic-update rollout.

Verified landing evidence

Reviewed head: a9ad9f76e71292e5a41dabfb10f71a4562095aeb. Complete ten-file delta independently reviewed through P2 with no actionable findings; all reviewed hashes and the published diff match.

  • Required CI and aggregate gate: passed.
  • Native Windows rehearsal proof: relevant five-file batch 115 passed, one skipped, including independent WAL writers, inventory/snapshot integrity, cancellation/deadline/disk-full/cooperative settlement, uncertain-cleanup retention, output bounds and Windows paths. This is not a claim that the entire extra workflow passed.
  • Published-updater compatibility: published [email protected] upgraded the legacy-operator-state scenario with auto-auth; passed in 212 seconds. Tested CI candidate c4f071e922295dbf76d2207a675e5a60d7fb781d merges this exact head into aa6d12cc10412e7059bd0df7910bea18036fe5f2; both changed production blobs match the reviewed head.
  • Local integrated rehearsal tests: 115 passed; production core typing passed.

Qualification scope and remaining separate work

The extra Windows workflow failed an unchanged Scheduled Task owner-identity path and an unchanged Control UI publication test after the rehearsal tests passed. Those failures are retained, not counted as success. #151157 owns the Scheduled Task repair; its whole lifecycle/installer qualification is not a source dependency of this rehearsal-only change. The native task was removed and cleanup reported no errors.

Earlier published 2026.9.4 first-hop results remain valid only for their recorded older source combination; they are not exact-head proof. The current candidate-bound published-driver cell is the successful 2026.9.3 job above. This candidate change cannot retroactively patch an already installed updater; broader bootstrap delivery, capture retirement, live readiness and rollout remain separately owned.

The previous pending-hosted-check landing hold is superseded by the verified results above. No source change, test waiver, runtime restart, or full-program acceptance claim was needed to reconcile it.

Use the existing async backup path only for disposable rehearsal copies.
Preserve synchronous inspection, bounded worker output, and parent-owned
scratch when worker or monitor termination is uncertain.

Cover concurrent WAL writers, snapshot integrity, cancellation, deadlines,
low-space refusal, and stdout/stderr overflow through the worker boundary.
@clawsweeper

clawsweeper Bot commented Sep 15, 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 size: L maintainer Maintainer-authored PR labels Sep 15, 2026
@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 15, 2026 21:40
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 7:13 PM ET / 23:13 UTC (Revision 13).

ClawSweeper review

What this changes

The PR uses SQLite online backup for disposable update rehearsal copies, preserves scratch when worker cleanup is uncertain, and adds concurrent-write and failure-path coverage.

Merge readiness

⛔ Blocked before merge - 3 items remain

The repair remains necessary on current main, and no introduced blocking defect was found. This actively maintained PR still has an explicit native Windows qualification and upgrade-evidence reconciliation gate.

Priority: P2
Reviewed head: a9ad9f76e71292e5a41dabfb10f71a4562095aeb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful process-boundary coverage and no blocking source finding; declared platform qualification remains open.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its body reports actual inventory/snapshot workers succeeding under concurrent WAL writes; native qualification and upgrade-source reconciliation remain separate declared landing gates.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its body reports actual inventory/snapshot workers succeeding under concurrent WAL writes; native qualification and upgrade-source reconciliation remain separate declared landing gates.
Evidence reviewed 9 items Introduced production boundary: The pinned base-to-head diff changes acquisition only for rehearsal inventory and snapshot calls; schema inspection retains the synchronous path. The parent now checks subprocess cleanup certainty and preserves its scratch on uncertain settlement.
Current main still needs the repair: Fetched main still selects prepareSqliteReadOnlyLocationSyncInProcess unconditionally in the shared snapshot wrapper. The existing helper retries byte-stable copying at most ten times, which can exhaust while the WAL continues changing.
Latest release comparison: The supplied latest release, v2026.9.4, also uses synchronous acquisition in withStateDatabaseSnapshot; this rehearsal repair is not present there.
Findings None None.
Security None None.

How this fits together

Update rehearsal copies existing databases into private scratch so candidate diagnostics can run before activation. The snapshot owner coordinates capacity checks, subprocess completion, and cleanup before handing the copies to candidate validation.

flowchart TD
  A[Existing databases and active writers] --> B[Rehearsal inventory]
  B --> C[Capacity checks]
  C --> D[SQLite online backup worker]
  D --> E{Worker cleanup confirmed?}
  E -->|Success| F[Private copies for candidate validation]
  E -->|Uncertain| G[Refuse rehearsal and retain scratch]
Loading

Before merge

  • Resolve merge risk (P1) - The new worker-settlement check can refuse rehearsal and retain temporary database copies when process termination cannot be confirmed; native Windows qualification of the latest candidate remains outstanding.
  • Resolve merge risk (P1) - Retained published-driver upgrade results establish their recorded source combinations, but their applicability to the candidate being landed still needs reconciliation.
  • Complete next step (P2) - Complete the declared native Windows qualification and bind retained published-driver results to the candidate being landed.
Agent review details

Security

None.

PR surface

Source +33, Tests +568, Config 0. Total +601 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 2 103 70 +33
Tests 7 605 37 +568
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 709 108 +601

Review metrics

Metric Value Why it matters
Production versus regression coverage Production net +33 lines; tests and test support net +568 lines Production growth is justified by rehearsal-only acquisition selection and preserving scratch until worker settlement is certain.

Merge-risk options

Maintainer options:

  1. Finish candidate qualification (recommended)
    Complete native Windows qualification and reconcile retained published-driver evidence before landing the changed acquisition and settlement paths.

Technical review

Best possible solution:

Keep rehearsal acquisition with the existing SQLite backup owner, preserve inspection and rollback contracts, and establish native and published-driver compatibility for the landing candidate.

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

Yes, from source: continuous WAL writes can invalidate every synchronous copy attempt used by current main. The PR supplies a concrete real-worker regression path and reports before/after results; this review did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the existing online-backup owner only for disposable rehearsal copies is a narrow repair that preserves the separate schema-inspection contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a focused updater reliability repair for databases that remain active during rehearsal.
  • merge-risk: 🚨 availability: The changed settlement path can block update rehearsal on uncertain process cleanup, and its latest native Windows behavior remains unqualified.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its body reports actual inventory/snapshot workers succeeding under concurrent WAL writes; native qualification and upgrade-source reconciliation remain separate declared landing gates.

Evidence

What I checked:

  • Introduced production boundary: The pinned base-to-head diff changes acquisition only for rehearsal inventory and snapshot calls; schema inspection retains the synchronous path. The parent now checks subprocess cleanup certainty and preserves its scratch on uncertain settlement. (src/infra/update-candidate-state.ts:181, a9ad9f76e712)
  • Current main still needs the repair: Fetched main still selects prepareSqliteReadOnlyLocationSyncInProcess unconditionally in the shared snapshot wrapper. The existing helper retries byte-stable copying at most ten times, which can exhaust while the WAL continues changing. (src/infra/update-candidate-state.ts:180, 2d1973e31d3a)
  • Latest release comparison: The supplied latest release, v2026.9.4, also uses synchronous acquisition in withStateDatabaseSnapshot; this rehearsal repair is not present there. (src/infra/update-candidate-state.ts:115, 3a9d69db306c)
  • Existing SQLite owner is reused: The existing online-backup helper opens the source read-only, starts a read transaction, pins its generation, backs up into private staging, and closes the source. Rehearsal invokes it through the dedicated state worker rather than introducing another backup implementation. (src/infra/sqlite-readonly-location.ts:433, a9ad9f76e712)
  • Behavioral regression coverage: The added process suite runs actual inventory and snapshot workers alongside an independent WAL writer, checks writer advancement, joins the writer before bounding copied generations, and verifies database integrity. Budget and cleanup additions cover cancellation, disk exhaustion, output overflow, and uncertain settlement. These tests were inspected, not executed during this read-only review. (src/infra/update-candidate-state.online-backup.process.test.ts:31, a9ad9f76e712)
  • Captured proof and review continuity: The supplied body at sourceRevision 5d4e195a107f3530acfbe8c2694c81da535ea6cc9330556e9f5782480057fa4b reports before/after real-worker WAL acquisition and 115 passing rehearsal tests on the latest integrated candidate. It explicitly leaves native Windows qualification pending and limits published-driver results to their retained source identities. The previous completed review had no findings and requested qualification plus candidate-identity reconciliation; that remains unresolved in the captured evidence. (a9ad9f76e712)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete Windows qualification and reconcile the landing candidate with retained native and published-driver results.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-16T21:07:54.042Z sha 373ee4d :: blocked before merge. :: none
  • reviewed 2026-09-16T21:57:14.431Z sha 928b78d :: blocked before merge. :: none
  • reviewed 2026-09-17T00:35:36.466Z sha a11f65b :: blocked before merge. :: none
  • reviewed 2026-09-17T22:10:49.751Z sha 486963f :: blocked before merge. :: none
  • reviewed 2026-09-17T22:23:59.783Z sha af5a7c6 :: blocked before merge. :: none
  • reviewed 2026-09-18T00:27:40.074Z sha cb1476e :: blocked before merge. :: none
  • reviewed 2026-09-18T20:10:00.006Z sha aceab55 :: blocked before merge. :: none
  • reviewed 2026-09-18T22:54:10.160Z sha 85fd481 :: blocked before merge. :: none

Align the canary snapshot mock with the bounded UTF-8 runner. Delegate real progress probes and non-canary children; exclude snapshot-worker results from progress-byte parsing. Preserve timing, cancellation, byte-limit and capacity assertions.

Include the reviewed managed-parent lifecycle assertion grouping that resolves the shared max-lines prerequisite.

These test corrections address failures in the preceding hosted run. Source review and focused static checks passed; behavioral and type qualification must come from the corrected exact-head hosted run. First-hop and native LAND gates remain open.
@jalehman jalehman self-assigned this Sep 16, 2026
@jalehman

jalehman commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Commandeering this PR at Josh's request. This is a mutiny. 🏴‍☠️

I'll work through the outstanding ClawSweeper findings, verify the fixes, and push them to this branch. No merge as part of this takeover; the declared native and published-updater qualification gates remain explicit.

Repair follow-up

Pushed bacf2316d37be4f4892f6230ad0ca3b15593f8fd to this PR branch. Both actionable Windows test findings are addressed:

  • Budget fixtures now execute under the real Node executable, preserving the real subprocess/output/cleanup owners and leaving progress probes unchanged. Removed direct .mjs executables and redundant probe subprocess forwarding; no batch shell or command-safety relaxation.
  • Cooperative cancellation assertions now follow Windows forced cleanup versus POSIX uncertain cleanup, including both the error and scratch-directory expectations. Cross-platform injected-uncertainty coverage remains intact.

Validation: 85 focused tests passed (41 rehearsal/backup tests and 44 process-control contract tests); repository changed checks passed, including services test typecheck, lint, and dead-export scans; fresh independent P0–P2 review of this repair is scoped-clean. Reproduced the original Windows resolver rejection and verified repaired argv admission through that same resolver on Linux. This is contract evidence, not native Windows execution.

Production LOC delta: 0. Two test files: +19/-16. Native-platform qualification and published-driver × candidate first-hop proof remain separate, unverified merge gates. No merge performed.

Follow-up ecde6b1d3ece06dbb67c64fcf86ec9c47cbbc464: narrowed fixture routing to the candidate-state worker entrypoint using the existing canary helper regex; every other command now delegates unchanged. All 16 budget tests reran successfully, lint/format checks passed, and fresh independent P0–P2 review was scoped-clean. Native Windows and published-updater qualification remain unverified.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 16, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 16, 2026
@jalehman

Copy link
Copy Markdown
Contributor

Resolved the two failures from CI run 35154396910 by merging the existing upstream fixes into this branch, pushed as a11f65bebbae0aa8129a4e7fce1075f87149e6f1.

  • Reproduced the release inventory failure at 928b78d77d8: 98 npm packages expected, 95 actual after publication deferral. Integrated fix: release inventory checks fail after publication deferral #150333, which checks the complete publisher inventory rather than a stale fixed count.
  • Reproduced the formatting failure in src/scripts/ci-changed-scope.test.ts; integrated style(ci): format ci-changed-scope test #150330.
  • After integration: all 246 tests passed across release-plan producer, changed-scope, rehearsal budget, and rehearsal cleanup suites (207 tooling + 39 infrastructure). Formatting checks pass for both previously failing files; merge has no conflicts or custom conflict resolutions.

No additional source edits or speculative test changes. Hosted CI must qualify the new head; native-platform and published-updater first-hop proof gaps remain separate. PR not merged.

jalehman and others added 2 commits September 18, 2026 13:01
Use append-only committed progress records to avoid the observed Windows rename race while preserving concurrent WAL acquisition assertions.

Include the exact test-only CI prerequisites from #152099 (d339607) and three duplicate declaration removals from #152028 (3fceb86).

Co-authored-by: Peter Steinberger <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Sep 18, 2026
Integrate the exact CI base 87e2cfb and preserve its canonical progress-probe helper without duplicate bindings. Align the real cancellation regression with confirmed cooperative settlement from #152107, retaining uncertainty preservation controls.

115 rehearsal tests pass; the complete integrated PR delta is independently reviewed through P2.
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Sep 18, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 9904ad6 into main Sep 19, 2026
235 of 236 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the openclaw/rehearsal-current-native-2114 branch September 19, 2026 01:57
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…nclaw#149449)

* fix(update): snapshot rehearsal SQLite through online backup

Use the existing async backup path only for disposable rehearsal copies.
Preserve synchronous inspection, bounded worker output, and parent-owned
scratch when worker or monitor termination is uncertain.

Cover concurrent WAL writers, snapshot integrity, cancellation, deadlines,
low-space refusal, and stdout/stderr overflow through the worker boundary.

* test(update): align rehearsal mocks with bounded snapshot runner

Align the canary snapshot mock with the bounded UTF-8 runner. Delegate real progress probes and non-canary children; exclude snapshot-worker results from progress-byte parsing. Preserve timing, cancellation, byte-limit and capacity assertions.

Include the reviewed managed-parent lifecycle assertion grouping that resolves the shared max-lines prerequisite.

These test corrections address failures in the preceding hosted run. Source review and focused static checks passed; behavioral and type qualification must come from the corrected exact-head hosted run. First-hop and native LAND gates remain open.

* test(update): make rehearsal worker fixtures portable

* test(update): scope rehearsal fixtures to worker entrypoint

* test(update): compare equivalent Windows scratch paths

* test(update): stabilize Windows rehearsal qualification

Use append-only committed progress records to avoid the observed Windows rename race while preserving concurrent WAL acquisition assertions.

Include the exact test-only CI prerequisites from openclaw#152099 (c857531) and three duplicate declaration removals from openclaw#152028 (75ac5ef).

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

---------

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

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

2 participants