Skip to content

fix: keep database preflight responsive during gateway startup - #138986

Merged
steipete merged 2 commits into
mainfrom
codex/team-preflight-event-loop-20260905
Sep 5, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/team-preflight-event-loop-20260905

Conversation

@steipete

@steipete steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Gateway startup and database maintenance become unresponsive while inspecting large existing SQLite stores.

Why This Change Was Made

Schema preflight now awaits the existing isolated, byte-preserving snapshot strategy. It keeps version/shape checks, per-database ordering, source-file protection, and cleanup at their existing owners.

The Gateway run loop owns the resource-bearing ownership and schema checks through one per-start work scope. Accepted stops cancel and join the child and its private staging before exit; queued startup restarts retain their existing behavior. Snapshot errors settle after child close, and cleanup failures remain failures. The sync and async worker transports share argument construction, result validation, and process completion handling; snapshot strategy, staging, and cleanup remain in their existing owner. The Windows update owner also rejects mutation after interruption or completed recovery, including signals received during the newly awaited schema check.

Database schemas, migration decisions, shutdown deadlines, configuration, and dependencies remain unchanged.

User Impact

The event loop can service work while snapshot preparation runs, and Gateway stop joins its database workers and staging cleanup before reporting a clean exit. Overall startup duration still depends on copying and validation.

Direct in-process container onboarding still has its existing noncancellable startup-before-handle limitation. This change does not claim clean child teardown after forced process exit in that path.

Evidence

  • A compiled Gateway with a valid synthetic 136 MB state database spent 3,318.7 ms in schema preflight, used 101.2 ms of parent CPU, and serviced zero timer callbacks. It subsequently reached readiness and shut down cleanly. These are instrumented macOS/Node 26.8.1 observations, not a production latency distribution.
  • The real live-WAL regression fails on the original code because the event loop is not serviced; it passes with the fix while preserving source-family and schema assertions.
  • A transport-only intermediate implementation reproduced a real shutdown defect: the Gateway exited with code 0 while its snapshot worker remained running under PID 1 with partial staging. The final owner tests require actual child close and cleanup before settlement, including a child that acknowledges SIGTERM but waits for an explicit release.
  • Earlier broad owner/sibling run: 581 tests passed; one Linux-only POSIX-lock case was skipped on macOS. The full run-loop suite separately passed all 78 tests. Deferred update-preflight and interrupted/completed recovery regressions have recorded RED/GREEN results.
  • Composition with the merged external-restart handoff passed 135 lifecycle and cancellation cases. The refreshed candidate passed 193 owner/lifecycle tests (one Linux-only POSIX case skipped on macOS) and type-aware lint across all 26 changed files. Fresh whole-candidate P2 review found no actionable issues.
  • An exact-source compiled Linux/Node 26.7 probe of the prior revision (a6cb4a10c351) confirmed the earlier ownership gap: after parent-only SIGTERM, the Gateway exited/closed with code 0 in 30 ms while its deliberately paused snapshot worker remained alive under PID 1. Source/dist/harness seals were stable; recovery and fixture cleanup were recorded separately. This controlled pause proves lifetime ownership, not natural latency or production frequency.
  • Five added ownership-cancellation regressions all failed on the original helper and passed with signal propagation, preserving source files and cleaning adopted snapshots.

Final verification on public head 1ce6848dbbe3fbb83f91dadded8704ee517a5162 is complete:

  • Matched Linux/Node 26.7 compiled runs: baseline schema preflight took 185.4 ms with zero timer callbacks; candidate took 169.4 ms while servicing 33 callbacks, with a 5.41 ms largest adjacent in-phase gap. Both reached an owned /readyz 200. These single instrumented runs establish scheduling progress; they do not establish overall startup acceleration or a latency distribution.
  • Schema-stage STOP interrupted a real 10 MB partial copy: child SIGTERM close in 7.15 ms, parent clean close in 28.84 ms, no later network bootstrap. Ownership-stage STOP retained the live parent while its exact child was deliberately paused; after the timing control was released, actual child SIGTERM close and staging cleanup preceded parent exit 0.
  • Both stop cases had no fallback signals, residual workers, process group, or snapshot staging. Complete source/build/harness seals matched. The baseline had its own checkout and frozen dependency install.
  • All 32 changed checks passed. Focused Linux coverage passed 772 tests; one Windows-only case was skipped. Live-WAL POSIX locks and uncommitted writer-version assertions passed explicitly. Exact-head CI passed.

Remote proof used Crabbox 0.49.1 with the configured Blacksmith Testbox backend, lease tbx_01m1rk2v2zfwjsydpj9f4xxyce. The delegated command exited 0; the 24,862,800-byte evidence archive was downloaded and SHA-256 verified before lease closure (514242a6ac34fada8580155492683a75276094dbebd4f73012880898185a820f). The persistent Testbox workflow shows cancelled after normal lease cleanup; its command result and retained receipts are successful.

Validation history is retained: an initial pre-lease base-ref guard refused a raw SHA, the next Linux gate rejected a widening assertion, and earlier CI found test syntax/file-length issues. The final revision passes those guards without suppressions or longer timeouts.

The data-model review heuristic refers to private child-process JSON replies moved between modules. Their { ok, location } / { ok, message } shapes are unchanged; no persisted tables, schema definitions, migrations, or SQLite transaction policy change. The extra worker argument names only caller-owned temporary staging. Existing schema compatibility/refusal and source-artifact tests remain in the completed proof.

Production LOC: +335/-149 (net +186, including the worker transport move). Tests: +592/-126. The production growth supplies the startup operation lifetime and parent-owned temporary staging required to cancel and join safely; changing only the blocking transport reproduced the orphan-worker failure above.

@clawsweeper

clawsweeper Bot commented Sep 5, 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 gateway Gateway runtime cli CLI command changes commands Command implementations size: L maintainer Maintainer-authored PR labels Sep 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 5, 2026, 7:02 AM ET / 11:02 UTC.

ClawSweeper review

What this changes

Makes database compatibility checks asynchronous and ties startup snapshot workers to Gateway cancellation and cleanup, while preserving Update and Doctor sequencing.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/infra/sqlite-readonly-location.ts, src/infra/sqlite-readonly-worker.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 3 items remain

Still useful: current main retains blocking schema snapshots. No concrete introduced correctness defect found; the declared final Linux lifecycle verification remains outstanding.

Priority: P2
Reviewed head: 1ce6848dbbe3fbb83f91dadded8704ee517a5162

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Coherent ownership repair with meaningful regression coverage and no identified correctness defect; final compiled lifecycle verification remains a material risk reducer.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the ordinary contributor-proof gate; reported live-WAL and child-close results support the snapshot owner, while final compiled Linux Gateway startup-stage cancellation remains explicitly pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the ordinary contributor-proof gate; reported live-WAL and child-close results support the snapshot owner, while final compiled Linux Gateway startup-stage cancellation remains explicitly pending.
Evidence reviewed 10 items Current main still needs the fix: Fetched main imports and calls prepareSqliteReadOnlyLocationSync for both state and agent schema inspection. The proposed asynchronous behavior is therefore still distinct.
Startup ownership boundary: Both ownership inspection and schema preflight receive the per-start operation callback. Accepted stops close admission and drain that scope before server close; cancellation is joined through the retained stop completion.
Snapshot transport and dependency boundary: The worker runs the existing OpenClaw SQLite entrypoint with process.execPath, waits for child close, and lets the snapshot owner remove parent-owned staging. Schema inspection retains the byte-preserving copy strategy. This path depends on Node child-process behavior, with no affirmative Codex dependency signal.
Findings None None.
Security None None.

How this fits together

Before Gateway startup, updates, and Doctor maintenance, OpenClaw inspects existing SQLite databases for compatibility. Private snapshot workers feed those checks; the Gateway host now owns their cancellation and cleanup during startup.

flowchart TD
  A[Gateway startup or maintenance] --> B[Database preflight]
  C[Existing SQLite stores] --> D[Private snapshot worker]
  B --> D
  D --> E[Version and shape checks]
  E --> F[Continue or report refusal]
  G[Gateway stop request] --> H[Cancel worker and join cleanup]
  H --> D
Loading

Before merge

  • Resolve merge risk (P1) - Final compiled Linux verification remains pending for stopping during ownership inspection and schema preflight; composed process exit, worker teardown, and staging cleanup are not yet demonstrated for the final revision.
  • Complete next step (P2) - Attach final compiled Linux readiness and cancellation results for both startup database stages, plus the declared POSIX-lock verification.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +186, Tests +466. Total +652 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 16 333 147 +186
Tests 10 592 126 +466
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 925 273 +652

Review metrics

Metric Value Why it matters
Production versus test growth Production net +186; tests net +466 Transport moves cancel in the net; production growth supplies startup lifetime ownership and parent-owned staging, justified by the recorded orphan-worker failure.

Stored data model

Persistent data-model change detected: serialized state: src/infra/sqlite-readonly-worker.ts, unknown-data-model-change: src/infra/sqlite-readonly-location.ts, unknown-data-model-change: src/infra/sqlite-readonly-worker.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete the declared Linux verification (recommended)
    Attach the final compiled startup and stop results, including worker disappearance, staging cleanup, and POSIX-lock preservation.

Technical review

Best possible solution:

Keep the existing isolated snapshot strategy under one host-owned cancellation and cleanup boundary, with compiled startup and shutdown behavior verified.

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

Yes, from source: current main synchronously waits for snapshot workers during schema inspection, and the existing live-WAL fixture supplies a focused event-loop regression path. This review did not execute it.

Is this the best way to solve the issue?

Yes, architecturally: reusing the snapshot owner and AsyncWorkScope addresses both blocking and worker lifetime; changing transport alone would leave the recorded orphan-worker failure unresolved.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1a13b42b6b75.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: Repairs database-preflight responsiveness without evidence of a widespread current outage.
  • merge-risk: 🚨 availability: The newly asynchronous startup path relies on child-close and cleanup joins whose final compiled Linux composition remains unverified.
  • 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 maintainer-authored PR is exempt from the ordinary contributor-proof gate; reported live-WAL and child-close results support the snapshot owner, while final compiled Linux Gateway startup-stage cancellation remains explicitly pending.

Evidence

What I checked:

  • Current main still needs the fix: Fetched main imports and calls prepareSqliteReadOnlyLocationSync for both state and agent schema inspection. The proposed asynchronous behavior is therefore still distinct. (src/state/openclaw-database-preflight.ts:347, 1a13b42b6b75)
  • Startup ownership boundary: Both ownership inspection and schema preflight receive the per-start operation callback. Accepted stops close admission and drain that scope before server close; cancellation is joined through the retained stop completion. (src/cli/gateway-cli/run-loop.ts:881, 1ce6848dbbe3)
  • Snapshot transport and dependency boundary: The worker runs the existing OpenClaw SQLite entrypoint with process.execPath, waits for child close, and lets the snapshot owner remove parent-owned staging. Schema inspection retains the byte-preserving copy strategy. This path depends on Node child-process behavior, with no affirmative Codex dependency signal. (src/infra/sqlite-readonly-worker.ts:83, 1ce6848dbbe3)
  • Direct child-process contract inspection: Inspected the installed official Node v24.20.0 builtin source: abort can invoke the error callback before process close, while execFile registers its close callback before returning the child. The distribution README identifies nodejs/node; no dependency commit SHA was established. (lib/child_process.js:521)
  • Sibling sequencing and stale recovery: Package and Git mutation paths await preflight before beginMutation; interrupted or completed Windows recovery rejects there. Doctor awaits compatibility and final readiness checks, and managed reload already returns the readiness promise. (src/cli/update-cli/update-command-execution.ts:255, 1ce6848dbbe3)
  • Regression coverage inspected: The live-WAL test checks event-loop progress alongside committed versions and unchanged source artifacts. Cancellation coverage holds a real child after SIGTERM and requires close plus staging removal before settlement; run-loop tests cover queued restart followed by stop, duplicate signals, cleanup failure, and retained callbacks. (src/state/openclaw-database-preflight.artifacts.test.ts:107, 1ce6848dbbe3)

Likely related people:

  • Peter Steinberger: Raw commit 0d830e9 adds src/shared/async-work-scope.ts:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0d830e9e7448; files: src/shared/async-work-scope.ts)
  • Jason (Json): 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.

  • Attach the declared final compiled Linux readiness, both startup-stage stop, and POSIX-lock results, completing the prior review's remaining validation request.

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 (1 earlier review cycle)
  • reviewed 2026-09-05T09:47:13.293Z sha 5fcb700 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/team-preflight-event-loop-20260905 branch from 5fcb700 to a6cb4a1 Compare September 5, 2026 10:09
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Final verification is complete for 1ce6848dbbe3fbb83f91dadded8704ee517a5162, resolving the review's pending Linux evidence and Rank-up request.

On matched Linux / Node 26.7 compiled builds, baseline schema preflight serviced zero callbacks over 185.4 ms; the candidate serviced 33 over 169.4 ms, with a 5.41 ms largest adjacent in-phase gap. Both reached an owned readiness endpoint. This establishes preflight scheduling progress; it does not establish an overall startup-speed improvement.

Both real Gateway startup stop paths passed. During schema copying, the worker closed from SIGTERM in 7.15 ms and the parent closed with code 0 in 28.84 ms, with no later network bootstrap. During ownership inspection, the parent remained alive after accepted STOP while the exact child was deliberately paused; after the timing control was released, actual child SIGTERM close and staging cleanup preceded parent exit 0. No fallback signals, orphan workers, live group, or staging residue were needed to make either result pass.

All 32 changed checks and 772 focused tests passed; one Windows-only case was skipped on Linux. Live-WAL POSIX-lock and uncommitted-writer-version assertions passed explicitly. The independent baseline used its own checkout and frozen dependency install. Source/build/harness inventories matched, including all 38,048 candidate and 38,027 baseline source entries against immutable Git blobs. Exact-head CI passed.

The data-model warning refers to private child-process replies relocated into src/infra/sqlite-readonly-worker.ts: the existing { ok, location } and { ok, message } shapes are unchanged. No persisted SQLite table, canonical schema, migration, SQL statement, retention or SQLite transaction policy changes in this diff. The optional worker argument names caller-owned temporary staging. Existing schema compatibility/refusal and source-artifact checks are included in the passing suites; no data migration is introduced.

The delegated Blacksmith Testbox command exited 0 and all acquired runtimes settled before capture. The 24,862,800-byte archive was downloaded and verified before lease closure (SHA-256 514242a6ac34fada8580155492683a75276094dbebd4f73012880898185a820f). The persistent Testbox workflow is marked cancelled by normal lease cleanup; its command result and retained process receipts passed. The PR body now contains the complete results and limits.

@steipete
steipete merged commit d46c7ee into main Sep 5, 2026
188 of 191 checks passed
@steipete
steipete deleted the codex/team-preflight-event-loop-20260905 branch September 5, 2026 11:43
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via the native squash workflow as d46c7ee046a9, from tested head 1ce6848dbbe3.

The accepted merge was reconciled after a post-dispatch GitHub policy-service timeout; no second merge request was sent. Final Linux, lifecycle, compatibility and CI evidence is complete.

steipete added a commit that referenced this pull request Sep 5, 2026
Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.
steipete added a commit that referenced this pull request Sep 5, 2026
Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.
steipete added a commit that referenced this pull request Sep 6, 2026
Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.
steipete added a commit that referenced this pull request Sep 6, 2026
Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
…law#138986)

* fix: keep database preflight responsive during gateway startup

* fix: join early database ownership checks during startup stop
steipete added a commit that referenced this pull request Sep 6, 2026
Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.
steipete added a commit that referenced this pull request Sep 6, 2026
* refactor(update): stage and retain package and Git transactions

Stage supported package-manager layouts and prebuilt Git runtimes before
activation. Expose candidate validation and activation boundaries, retain the
previous package and launcher until finalization, and preserve the original
failure when source exposure is cancelled.

Verify the requested package version before admitting a staged no-op. Replace
live Git install/build and rollback rebuild work with prepared runtime promotion.

(cherry picked from commit 0a1e09cb5350e1e1268d07753c11551d24549aa1)

* feat(update): validate online and verify activation or rollback

Keep the gateway serving during candidate staging, lint, config/plugin checks,
and an isolated SQLite-snapshot canary. Same-version and same-SHA no-ops never
stop the service. Limit activation downtime to swap, owned migrations, and start.

Record settle, version/build, plugin, channel, readiness, advisory inference,
and downtime in the existing run ledger. Restore retained package transactions
only across unchanged state schemas, using prior verification to authorize the
previous gateway restart. Hand migrated-state finalization to candidate code.

Park managed helpers only at activation. Give the spawn fallback runner sole
ownership of helper stdin so activation acknowledgements reach its child.
Protect active backups from cleanup and CLI-owned runs from premature notices.

Refs #137580, #136997, #124396.

(cherry picked from commit 5523f4f419652d7e6666fa53dc19c650528aba0d)

* docs(update): explain staged activation and schema-neutral recovery

Document no-op behavior, candidate validation, bounded activation, verified
package rollback, migration refusal, downtime, and managed-helper ownership.

(cherry picked from commit d1dc73c804e02626e89d677970744bf1b235269b)

* fix(update): preserve run ownership and explain skipped rollback

Record an explicit no-retained-package fact when post-core verification fails
without a rollback transaction, keeping the original failing oracle and service
policy. Verify the durable report with an isolated real ledger.

Keep staging and repair under CLI completion ownership too, so sentinel expiry
after an unrelated gateway boot cannot prematurely finish an active update run.
The existing phase regression fails for both phases before this fix.

(cherry picked from commit c212030ce05a41018c0d2f335d49e65ec999c92c)

* fix(update): restore a running previous generation after rollback

Restore package bytes and shims, the config writer version, the owned service
definition, and the previous Node runtime across unchanged config and schemas.
Scope the existing older-binary recovery allowance to service invocations.

Carry complete restoration proof into the managed helper, keep its ledger run
open through CLI unwind, and recover instead of unconditionally parking on
exit 79. Refresh observed service facts and retain restoration receipts when
bounded diagnostics are evicted. Successful recovery remains a failed update
but records rolled-back, the previous version, and verified downtime.

Wait on actual ownership validation readiness and isolate all helper test
coordinators while preserving real cross-process arbitration within fixtures.
Document the recovery boundary and the helper's observed verification limits.

Follow-up: review zero-wait coordinator admission under concurrent independent
updates; the existing lease reader maps SQLite contention to unavailable
identity. This change does not alter production store concurrency policy.

Validation: full CLI/ledger/report scope 948 passed (1 skipped); handoff/package
scope 176 passed (2 skipped); two concurrent lifecycle copies passed 154/154 each
during a separate checkout build; closing cross-process/CLI scope 114 passed
(1 skipped). pnpm build, the complete changed-files gate, and P1 autoreview pass.

(cherry picked from commit fe3fa2e7dd29ca98e9e5e8c375f9e7431d4733dc)

* fix(update): preserve sibling packages during late native rollback

Recheck the native global project before stopping a reachable candidate and
again before restoring any project or launcher bytes. Compare the finalized
staging fingerprint, excluding OpenClaw payloads, using the existing helper
with per-entry digests and direct sibling entries.

Refuse changed-project rollback with rollback-project-changed, preserve the
candidate and backups, record names-only details, and report recovery guidance.
Keep the run failed without automatically repairing the shared project. npm
package-root swaps retain their existing behavior.

Validation: 85 focused tests passed; three final fixture cases passed after
adding required service inspection fields. The new filesystem regression
failed on the parent for pnpm 10, pnpm 11, and Bun. Full changed-file checks and
fresh Codex P0/P1 autoreview passed. Production +112 lines, tests +179 lines,
docs +2 lines; no new fingerprint implementation, configuration, or schema.

(cherry picked from commit 0abb72b514226cc0b4cd4d0f99207e93aedad99b)

* fix(update): preserve verification and cancellation ownership

Verify metadata-refresh restarts through the same readiness and inference path, preserve rollback recovery ownership, and reject cancelled activation after asynchronous checks. Keep schema/protocol verification fields aligned and share update step and state-snapshot types.

Carry the cancellation-only hardening from campaign commit d37a9418d94 without its automatic repair integration. Regression proofs cover refresh readiness, Windows autostart compensation, and systemd/launchd cancellation boundaries.

* fix(update): require safe recovery before restoring autostart

Narrow the recovery verdict before consuming service health. Align native Windows fixtures with their actual enabled state, verify compensation after an enable commits and fails, and preserve the precise interrupted verification diagnostic. Keep npm staging and cleanup assertions on the current namespace.

* refactor(update): keep verified service recovery in its owner

Move failed-update restart into the existing recovery module, retain the service facade, and await Doctor lifecycle cleanup. Align Doctor tests with HTTP readiness and advisory inference, including a healthy service with unready HTTP and preserved probe-port coverage. Complete synthetic helper teardown before removing its files.

* fix(update): preserve staging and plugin maintenance boundaries

Use effective pnpm configuration arguments and verify staged root/bin destinations before installing. Preserve relative external dependency links during Git promotion through the same relocation owner as native package staging.

Centralize post-plugin completion in the parent updater after the fresh child finishes package work. Park the owned service only for required Doctor maintenance, retain Windows compensation through verification, and measure the full second outage. Keep downgrade writes in the target runtime and validate unchanged-plugin configuration with that runtime's schema.

Remove the recovery-to-command import cycle. Cover native destination refusal, promoted imports, fresh child/parent lease boundaries, target-owned downgrade stamps, and migration/restart timing. Isolated real pnpm and Doctor coordinator flows verify the dependency and maintenance contracts.

* fix(update): finalize unmanaged runs after gateway restart

Use the recorded CLI trigger or managed handoff identity to preserve verification ownership. An unmanaged RPC also reaches restarting, so its phase cannot imply an updater exists to finish it. Keep notice expiry bounded while preserving managed verification.

Reproduce four unmanaged completion failures before the fix; cover successful and expired unmanaged runs, managed API/chat/control-plane/campaign handoffs, and all CLI phases. Gateway owner, sentinel, and update method tests: 150 passed. Codex P1 local review clean.

* fix(update): retain complete candidate dependency stores

Retain configured Git virtual stores inside the exact preflight cleanup boundary, including sibling and symlinked stores. Rebase external store metadata and launchers, preserve rollback, and refuse source or destination checkout overlap through aliases.

Share native and Git relocation of links, manifests, and launchers. Keep pnpm candidate project stores private through the supported invocation environment so staging cannot prune the serving generation. Preserve operator configuration and ordinary subsequent package-manager operations.

Proof: five pre-fix Git regressions; 40 Git/native transaction and 27 post-update tests passed, followed by eight focused overlap/native tests. Real pnpm proof covers seven Git layouts and four native manager/store modes, imports, launchers, metadata, rollback, promotion, and subsequent global install. Codex P1 review clean.

* test(update): preserve online inspection through package executor

* test(update): align transaction fixtures and prune unused exports

* fix(update): retain Git runtime backups after failed restoration

* test(update): consolidate post-update fixtures for lint

* fix(update): preserve recovery ownership and CI prerequisites

Remove the history-based cleanup lock. A killed updater leaves a running
ledger row, but history is not retirement authority: migration cleanup
already verifies its own archives under exclusive maintenance ownership.
Package, shim, and Git runtime backups belong to separate transactions.
This also avoids opening the ledger before external state ownership checks.

Register the real candidate canary and migrated-update process fixtures
with their runtime build owner. Partition whole-config consumers before
striping, keeping one runtime build and removing the sibling-sharing
exception without changing CI caps or worker budgets.

Align installed-CLI validation, managed handoff, and native stop fixtures
with the transaction and service-owner contracts.

* test(ci): derive runtime exclusions from the consumer catalog

* fix(update): preserve report ownership across candidate migration

Suspend every old CLI progress reader at activation and resume only after schema compatibility is established. Let migrated candidates own final reporting, and keep the permanent finished-notice key available while CLI verification remains pending.

Preserve the merged update-surface contracts, truthful acknowledgement wording, and canonical restart successor ownership. Regression coverage includes real candidate migration in text and JSON modes plus sentinel expiry followed by verified completion.

* fix(update): preserve live SQLite artifacts during inspection

Use the canonical private snapshot owner for candidate copies and schema inspection. Discover registered databases from the same private generation instead of reopening the live registry, and preserve original locators in rollback receipts.

Keep the existing bounded inspection deadline and fail-closed rollback behavior. Regression coverage reproduces source WAL sidecar creation, checks closed WAL and rollback stores, and verifies committed schema visibility while a live writer retains its transaction.

* test(update): sort artifact entries without mutation

* fix(update): preserve active runtime ownership during staged updates

Keep candidate pnpm stores private across installs, nested lifecycle commands,
workspace configuration, native staging, and Git promotion so preparation cannot
prune the serving generation or leave activated dependencies behind.

Record the active package root at each activation and restoration boundary.
Launch post-activation schema inspection from that package and selected Node;
retain unknown identity after partial moves until recovery verifies the original.

Accumulate verified outage intervals independently of mutable ledger health,
excluding online plugin work. Register built schema-worker test prerequisites.

Refs #136997, #137580, #124396.

* test(ci): type build admission argument rows explicitly

* fix(update): await the async schema preflight before activation

Follow #138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.

* fix(update): restart the unchanged gateway after native swap refusal

Record live mutation in the swap owner after its native project recheck, immediately before the first move. A sibling change during shutdown now preserves safe recovery of the original package without restoring over the sibling.

Extend the native refusal matrix with the original recovery version and exercise its safe restart outcome through finalization. Keep late rollback-project-changed behavior unchanged.

* fix(update): preserve finalization for older downgrade targets

Keep the shipped explicit downgrade contract when a candidate predates the migration-continuation worker. Record runtime validation as unavailable before invoking new-only canary commands, then use the established finalization owner.

Present workers must still report their schema contract, and database preflights remain mandatory when target schema metadata is available. Do not attempt the new schema-worker or rollback contract for targets that do not provide it.

* fix(update): make Windows Bun refusal actionable

Preserve the pre-stop refusal for Bun's Windows launchers. Carry the inspected install spec into staging so the failed step names the exact manual Bun install, Gateway restart, and update-status commands.

Bun is an opt-in runtime; keep one supported staging flow instead of adding an in-place fallback. Match the updating guide to the emitted recovery instructions.

* perf(update): avoid snapshot imports during schema inspection

Load the verified-snapshot dependency only when snapshot rehearsal runs. Schema-version workers do not need the snapshot module's memory and plugin import graph.

Keep the same private-copy inspection and 30-second worker deadline. This changes dependency loading without changing SQLite schemas, data, or recovery policy.

* fix(update): keep the owned managed-update environment when given process.env

The absent-service rollback regression exposed an aliased input: clearing process.env also cleared the environment supplied to the phase. Reuse the existing snapshot for that input and preserve restoration after failure. The environment-only regression fails before the repair; copied-input and rollback sibling paths pass.

* fix(triage): accept the unavailable canary advisory

Preserve failure diagnostics after a confirmed downgrade to a target without migration continuation. The diagnostic boundary accepts both advisory variants while retaining only actual failed steps; the new advisory row failed schema validation before this repair.

* test(ci): route real-worker update CLI tests to the process lane

Keep rollback, post-update recovery and service integration tests that launch built schema workers in the existing isolated serial process owner. Move their runtime prerequisites with them and preserve CI partition, concurrency and budget assertions. All three routing regressions failed before the owner correction.

* test(update): align downgrade and recovery fixtures with checks

Supply the required invariant diagnostic and construct recovery table rows without map-spread. Preserve all cases and assertions.

* test(ci): align CLI build admission with process ownership

The shared CLI config has no runtime consumers after moving the real-worker update tests. Test it in the no-build table and retain process-lane build, failure, exclusion and SIGTERM coverage. Fixes the stale build.pid expectation from CI run 33991347672 without changing deadlines or production behavior.

* test(update): verify candidate snapshots through the worker

Snapshot backup and VACUUM run in a dedicated production process so cancellation can join before cleanup. Direct Vitest DELETE and symlink cases hit their 120-second deadline, while the equivalent worker copies preserved source bytes in about seven seconds. Exercise the existing worker entrypoint, retain every registry and artifact assertion, and bound the child to 30 seconds.

* test(update): include helper logs in terminal outcome failures

A loaded-host run restored the Gateway but left the ledger running. The six-case and full 154-case reruns passed without a production change. Preserve helper diagnostics in the assertion so a recurrence exposes the terminal-writer failure; no behavioral fix or timeout relaxation is claimed.

* test(update): preserve launchd recovery identity proof after restack

Carry the real stripped helper environment and emulated recovery cleanup from #139393 into the extracted transaction boundary fixture.

* fix(update): retain runtime evidence across partial backup cleanup

A cross-device backup move can publish its backup, remove the source dist
inventory, then reject after deleting a runtime file. Directory order varies
by filesystem. Older packages may legitimately lack that inventory, so a
fresh verification using only surviving metadata could accept a gutted tree.

Retain the expected dist files before mutation and compare the surviving
runtime against them before accepting recovery without a completed rollback.
A partially removed package must never be reported as the active root.
Preserve recovery of an unchanged package after a refused backup move.

Make the existing cleanup regression exercise inventory-first deletion; it
fails before this fix with the same active-root assertion as CI. Recovery and
native transaction suites pass all 57 cases. Extend CLI finalization coverage
to ensure failed swaps with unsafe recovery never restart the package.

* fix(update): verify recovery inventory at the previous package root

* fix(update): retain backups until activation or restoration is verified

* test(update): isolate handoff workers and child result publication
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…w#138839)

* refactor(update): stage and retain package and Git transactions

Stage supported package-manager layouts and prebuilt Git runtimes before
activation. Expose candidate validation and activation boundaries, retain the
previous package and launcher until finalization, and preserve the original
failure when source exposure is cancelled.

Verify the requested package version before admitting a staged no-op. Replace
live Git install/build and rollback rebuild work with prepared runtime promotion.

(cherry picked from commit 0a1e09cb5350e1e1268d07753c11551d24549aa1)

* feat(update): validate online and verify activation or rollback

Keep the gateway serving during candidate staging, lint, config/plugin checks,
and an isolated SQLite-snapshot canary. Same-version and same-SHA no-ops never
stop the service. Limit activation downtime to swap, owned migrations, and start.

Record settle, version/build, plugin, channel, readiness, advisory inference,
and downtime in the existing run ledger. Restore retained package transactions
only across unchanged state schemas, using prior verification to authorize the
previous gateway restart. Hand migrated-state finalization to candidate code.

Park managed helpers only at activation. Give the spawn fallback runner sole
ownership of helper stdin so activation acknowledgements reach its child.
Protect active backups from cleanup and CLI-owned runs from premature notices.

Refs openclaw#137580, openclaw#136997, openclaw#124396.

(cherry picked from commit 5523f4f419652d7e6666fa53dc19c650528aba0d)

* docs(update): explain staged activation and schema-neutral recovery

Document no-op behavior, candidate validation, bounded activation, verified
package rollback, migration refusal, downtime, and managed-helper ownership.

(cherry picked from commit d1dc73c804e02626e89d677970744bf1b235269b)

* fix(update): preserve run ownership and explain skipped rollback

Record an explicit no-retained-package fact when post-core verification fails
without a rollback transaction, keeping the original failing oracle and service
policy. Verify the durable report with an isolated real ledger.

Keep staging and repair under CLI completion ownership too, so sentinel expiry
after an unrelated gateway boot cannot prematurely finish an active update run.
The existing phase regression fails for both phases before this fix.

(cherry picked from commit c212030ce05a41018c0d2f335d49e65ec999c92c)

* fix(update): restore a running previous generation after rollback

Restore package bytes and shims, the config writer version, the owned service
definition, and the previous Node runtime across unchanged config and schemas.
Scope the existing older-binary recovery allowance to service invocations.

Carry complete restoration proof into the managed helper, keep its ledger run
open through CLI unwind, and recover instead of unconditionally parking on
exit 79. Refresh observed service facts and retain restoration receipts when
bounded diagnostics are evicted. Successful recovery remains a failed update
but records rolled-back, the previous version, and verified downtime.

Wait on actual ownership validation readiness and isolate all helper test
coordinators while preserving real cross-process arbitration within fixtures.
Document the recovery boundary and the helper's observed verification limits.

Follow-up: review zero-wait coordinator admission under concurrent independent
updates; the existing lease reader maps SQLite contention to unavailable
identity. This change does not alter production store concurrency policy.

Validation: full CLI/ledger/report scope 948 passed (1 skipped); handoff/package
scope 176 passed (2 skipped); two concurrent lifecycle copies passed 154/154 each
during a separate checkout build; closing cross-process/CLI scope 114 passed
(1 skipped). pnpm build, the complete changed-files gate, and P1 autoreview pass.

(cherry picked from commit fe3fa2e7dd29ca98e9e5e8c375f9e7431d4733dc)

* fix(update): preserve sibling packages during late native rollback

Recheck the native global project before stopping a reachable candidate and
again before restoring any project or launcher bytes. Compare the finalized
staging fingerprint, excluding OpenClaw payloads, using the existing helper
with per-entry digests and direct sibling entries.

Refuse changed-project rollback with rollback-project-changed, preserve the
candidate and backups, record names-only details, and report recovery guidance.
Keep the run failed without automatically repairing the shared project. npm
package-root swaps retain their existing behavior.

Validation: 85 focused tests passed; three final fixture cases passed after
adding required service inspection fields. The new filesystem regression
failed on the parent for pnpm 10, pnpm 11, and Bun. Full changed-file checks and
fresh Codex P0/P1 autoreview passed. Production +112 lines, tests +179 lines,
docs +2 lines; no new fingerprint implementation, configuration, or schema.

(cherry picked from commit 0abb72b514226cc0b4cd4d0f99207e93aedad99b)

* fix(update): preserve verification and cancellation ownership

Verify metadata-refresh restarts through the same readiness and inference path, preserve rollback recovery ownership, and reject cancelled activation after asynchronous checks. Keep schema/protocol verification fields aligned and share update step and state-snapshot types.

Carry the cancellation-only hardening from campaign commit d37a9418d94 without its automatic repair integration. Regression proofs cover refresh readiness, Windows autostart compensation, and systemd/launchd cancellation boundaries.

* fix(update): require safe recovery before restoring autostart

Narrow the recovery verdict before consuming service health. Align native Windows fixtures with their actual enabled state, verify compensation after an enable commits and fails, and preserve the precise interrupted verification diagnostic. Keep npm staging and cleanup assertions on the current namespace.

* refactor(update): keep verified service recovery in its owner

Move failed-update restart into the existing recovery module, retain the service facade, and await Doctor lifecycle cleanup. Align Doctor tests with HTTP readiness and advisory inference, including a healthy service with unready HTTP and preserved probe-port coverage. Complete synthetic helper teardown before removing its files.

* fix(update): preserve staging and plugin maintenance boundaries

Use effective pnpm configuration arguments and verify staged root/bin destinations before installing. Preserve relative external dependency links during Git promotion through the same relocation owner as native package staging.

Centralize post-plugin completion in the parent updater after the fresh child finishes package work. Park the owned service only for required Doctor maintenance, retain Windows compensation through verification, and measure the full second outage. Keep downgrade writes in the target runtime and validate unchanged-plugin configuration with that runtime's schema.

Remove the recovery-to-command import cycle. Cover native destination refusal, promoted imports, fresh child/parent lease boundaries, target-owned downgrade stamps, and migration/restart timing. Isolated real pnpm and Doctor coordinator flows verify the dependency and maintenance contracts.

* fix(update): finalize unmanaged runs after gateway restart

Use the recorded CLI trigger or managed handoff identity to preserve verification ownership. An unmanaged RPC also reaches restarting, so its phase cannot imply an updater exists to finish it. Keep notice expiry bounded while preserving managed verification.

Reproduce four unmanaged completion failures before the fix; cover successful and expired unmanaged runs, managed API/chat/control-plane/campaign handoffs, and all CLI phases. Gateway owner, sentinel, and update method tests: 150 passed. Codex P1 local review clean.

* fix(update): retain complete candidate dependency stores

Retain configured Git virtual stores inside the exact preflight cleanup boundary, including sibling and symlinked stores. Rebase external store metadata and launchers, preserve rollback, and refuse source or destination checkout overlap through aliases.

Share native and Git relocation of links, manifests, and launchers. Keep pnpm candidate project stores private through the supported invocation environment so staging cannot prune the serving generation. Preserve operator configuration and ordinary subsequent package-manager operations.

Proof: five pre-fix Git regressions; 40 Git/native transaction and 27 post-update tests passed, followed by eight focused overlap/native tests. Real pnpm proof covers seven Git layouts and four native manager/store modes, imports, launchers, metadata, rollback, promotion, and subsequent global install. Codex P1 review clean.

* test(update): preserve online inspection through package executor

* test(update): align transaction fixtures and prune unused exports

* fix(update): retain Git runtime backups after failed restoration

* test(update): consolidate post-update fixtures for lint

* fix(update): preserve recovery ownership and CI prerequisites

Remove the history-based cleanup lock. A killed updater leaves a running
ledger row, but history is not retirement authority: migration cleanup
already verifies its own archives under exclusive maintenance ownership.
Package, shim, and Git runtime backups belong to separate transactions.
This also avoids opening the ledger before external state ownership checks.

Register the real candidate canary and migrated-update process fixtures
with their runtime build owner. Partition whole-config consumers before
striping, keeping one runtime build and removing the sibling-sharing
exception without changing CI caps or worker budgets.

Align installed-CLI validation, managed handoff, and native stop fixtures
with the transaction and service-owner contracts.

* test(ci): derive runtime exclusions from the consumer catalog

* fix(update): preserve report ownership across candidate migration

Suspend every old CLI progress reader at activation and resume only after schema compatibility is established. Let migrated candidates own final reporting, and keep the permanent finished-notice key available while CLI verification remains pending.

Preserve the merged update-surface contracts, truthful acknowledgement wording, and canonical restart successor ownership. Regression coverage includes real candidate migration in text and JSON modes plus sentinel expiry followed by verified completion.

* fix(update): preserve live SQLite artifacts during inspection

Use the canonical private snapshot owner for candidate copies and schema inspection. Discover registered databases from the same private generation instead of reopening the live registry, and preserve original locators in rollback receipts.

Keep the existing bounded inspection deadline and fail-closed rollback behavior. Regression coverage reproduces source WAL sidecar creation, checks closed WAL and rollback stores, and verifies committed schema visibility while a live writer retains its transaction.

* test(update): sort artifact entries without mutation

* fix(update): preserve active runtime ownership during staged updates

Keep candidate pnpm stores private across installs, nested lifecycle commands,
workspace configuration, native staging, and Git promotion so preparation cannot
prune the serving generation or leave activated dependencies behind.

Record the active package root at each activation and restoration boundary.
Launch post-activation schema inspection from that package and selected Node;
retain unknown identity after partial moves until recovery verifies the original.

Accumulate verified outage intervals independently of mutable ledger health,
excluding online plugin work. Register built schema-worker test prerequisites.

Refs openclaw#136997, openclaw#137580, openclaw#124396.

* test(ci): type build admission argument rows explicitly

* fix(update): await the async schema preflight before activation

Follow openclaw#138986's asynchronous database preflight contract before checking its result. Passing the promise to hasSchemaRefusal otherwise throws on package activation.

Keep Git's mutation fence after its post-stop schema check so interruption can restore the unchanged Windows task. Reject retained recovery handles as soon as settlement begins.

* fix(update): restart the unchanged gateway after native swap refusal

Record live mutation in the swap owner after its native project recheck, immediately before the first move. A sibling change during shutdown now preserves safe recovery of the original package without restoring over the sibling.

Extend the native refusal matrix with the original recovery version and exercise its safe restart outcome through finalization. Keep late rollback-project-changed behavior unchanged.

* fix(update): preserve finalization for older downgrade targets

Keep the shipped explicit downgrade contract when a candidate predates the migration-continuation worker. Record runtime validation as unavailable before invoking new-only canary commands, then use the established finalization owner.

Present workers must still report their schema contract, and database preflights remain mandatory when target schema metadata is available. Do not attempt the new schema-worker or rollback contract for targets that do not provide it.

* fix(update): make Windows Bun refusal actionable

Preserve the pre-stop refusal for Bun's Windows launchers. Carry the inspected install spec into staging so the failed step names the exact manual Bun install, Gateway restart, and update-status commands.

Bun is an opt-in runtime; keep one supported staging flow instead of adding an in-place fallback. Match the updating guide to the emitted recovery instructions.

* perf(update): avoid snapshot imports during schema inspection

Load the verified-snapshot dependency only when snapshot rehearsal runs. Schema-version workers do not need the snapshot module's memory and plugin import graph.

Keep the same private-copy inspection and 30-second worker deadline. This changes dependency loading without changing SQLite schemas, data, or recovery policy.

* fix(update): keep the owned managed-update environment when given process.env

The absent-service rollback regression exposed an aliased input: clearing process.env also cleared the environment supplied to the phase. Reuse the existing snapshot for that input and preserve restoration after failure. The environment-only regression fails before the repair; copied-input and rollback sibling paths pass.

* fix(triage): accept the unavailable canary advisory

Preserve failure diagnostics after a confirmed downgrade to a target without migration continuation. The diagnostic boundary accepts both advisory variants while retaining only actual failed steps; the new advisory row failed schema validation before this repair.

* test(ci): route real-worker update CLI tests to the process lane

Keep rollback, post-update recovery and service integration tests that launch built schema workers in the existing isolated serial process owner. Move their runtime prerequisites with them and preserve CI partition, concurrency and budget assertions. All three routing regressions failed before the owner correction.

* test(update): align downgrade and recovery fixtures with checks

Supply the required invariant diagnostic and construct recovery table rows without map-spread. Preserve all cases and assertions.

* test(ci): align CLI build admission with process ownership

The shared CLI config has no runtime consumers after moving the real-worker update tests. Test it in the no-build table and retain process-lane build, failure, exclusion and SIGTERM coverage. Fixes the stale build.pid expectation from CI run 33991347672 without changing deadlines or production behavior.

* test(update): verify candidate snapshots through the worker

Snapshot backup and VACUUM run in a dedicated production process so cancellation can join before cleanup. Direct Vitest DELETE and symlink cases hit their 120-second deadline, while the equivalent worker copies preserved source bytes in about seven seconds. Exercise the existing worker entrypoint, retain every registry and artifact assertion, and bound the child to 30 seconds.

* test(update): include helper logs in terminal outcome failures

A loaded-host run restored the Gateway but left the ledger running. The six-case and full 154-case reruns passed without a production change. Preserve helper diagnostics in the assertion so a recurrence exposes the terminal-writer failure; no behavioral fix or timeout relaxation is claimed.

* test(update): preserve launchd recovery identity proof after restack

Carry the real stripped helper environment and emulated recovery cleanup from openclaw#139393 into the extracted transaction boundary fixture.

* fix(update): retain runtime evidence across partial backup cleanup

A cross-device backup move can publish its backup, remove the source dist
inventory, then reject after deleting a runtime file. Directory order varies
by filesystem. Older packages may legitimately lack that inventory, so a
fresh verification using only surviving metadata could accept a gutted tree.

Retain the expected dist files before mutation and compare the surviving
runtime against them before accepting recovery without a completed rollback.
A partially removed package must never be reported as the active root.
Preserve recovery of an unchanged package after a refused backup move.

Make the existing cleanup regression exercise inventory-first deletion; it
fails before this fix with the same active-root assertion as CI. Recovery and
native transaction suites pass all 57 cases. Extend CLI finalization coverage
to ensure failed swaps with unsafe recovery never restart the package.

* fix(update): verify recovery inventory at the previous package root

* fix(update): retain backups until activation or restoration is verified

* test(update): isolate handoff workers and child result publication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations gateway Gateway runtime 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: XL 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