Repository navigation
fix(update): preserve failures and running worker code during replacement - #153764
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 22, 2026, 3:46 AM ET / 07:46 UTC (Revision 20). ClawSweeper reviewWhat this changesThe PR preserves update validation failures and Doctor diagnostics through recovery, retains running SQLite worker code during installation replacement, and delegates finalization to the selected target runtime. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this remains useful, distinct updater work, and no concrete introduced correctness defect was established. The current composition's declared upgrade qualification remains incomplete. Priority: P2 Review scores
Verification
How this fits togetherThe updater prepares and validates a replacement installation before activating it, running Doctor, and recording recovery outcomes. Its SQLite workers must remain compatible with the running updater while installation files change. flowchart TD
A[Update request] --> B[Prepare and validate candidate]
B --> C[Retain running worker code]
C --> D[Activate replacement]
D --> E[Target runtime and Doctor]
E --> F[Record success or recovery]
F --> G[Drain retained workers]
G --> H[Release temporary runtime]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +528, Tests +2065, Other +1. Total +2594 across 65 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep activation, Doctor, and recovery with their existing owners, and qualify the retained-worker transition against the published updater before landing. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main replaces a recorded Doctor outcome with a generic failure when verification throws, and lacks the proposed worker-generation retention. No failing runtime execution was performed in this review. Is this the best way to solve the issue? Yes at the source-design level: extending the existing failure classifier, CLI finalizer, dependency copier, and SQLite broker avoids competing owners. Compiled and published-updater qualification is still needed to establish upgrade safety. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b3f097deb9e3. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
144d389 to
6b7bb15
Compare
6b7bb15 to
0509bad
Compare
Keep failed validation meaningful through activation, rollback, and history. Retain the updater's worker runtime until admitted work and cleanup settle, while preserving current requester checks and structured npm diagnostics.
0509bad to
f4291a7
Compare
|
Merged via squash.
|
* commit '80b9608a25e191a17e1466d750c2f76a38a38507': fix(tooling): declare tsx CLI shim exports test(gateway): reuse session PR access state fixtures (#155626) test(heartbeat): await wake registration before advancing coalescing time refactor(status): share plugin health section assembly (#155390) fix: CLI and MCP tool completions skip plugin hooks (#155206) fix(update): preserve failures and retain running worker code (#153764) fix(sqlite): drain idle coordinators at lifecycle teardown fix(test): prepare SQLite compile-cache probes before launch fix(test): preserve owned compiler caches in Vitest workers fix(ios): assistant files are not downloadable in chat (#155195) fix(heartbeat): avoid timeouts for busy scheduled polls (#148333) test(gateway): hold SSH approval until pending assertions finish test(update): cover launcher permission rollback on Linux (#155615) fix(edit): avoid duplicate replacements from legacy arguments (#155513) feat(browser): support Lightpanda connection-scoped CDP replies (#154342) improve(ci): speed up compatible Control UI tests with Bun (#154585) test(gateway): prepare remaining approval fixtures before requests (#155589) fix(doctor): exclude retained agents from automatic session import
* refactor(cli): centralize daemon action output Keep generic result emission JSON-only and route message-bearing successes through the action context. Bind install warnings once in the shared install context while preserving warning order and lifecycle exception boundaries. Characterize human and JSON output through the existing response owners, including foreground restart health ordering and install warning behavior. * test(daemon): isolate install warning inventory * chore: merge main into daemon output cleanup * chore: merge main into daemon output cleanup Preserve daemon action JSON and human output ownership, including current backup and rebind receipts, readiness exit codes, and runtime pin contracts. Related: #150047. * test(cli): update daemon restart output fixture * chore(cli): integrate current main for daemon output validation * chore: merge main config reload and wrapper repairs Integrate canonical main e99e75e, including config include publication fix 97e9ce9 and wrapper import-closure fix b518db4. Preserve the published PR ancestry and byte-identical daemon output patch. * chore: merge main pairing fixture repair Integrate canonical main ca97ceb with SSH pairing fixture fix f87f23c and the reviewed updater owner changes from #153764. Preserve the published PR ancestry and byte-identical daemon output patch. Co-authored-by: Peter Steinberger <[email protected]>
…ng the package (#155977) ## Summary `openclaw update` retains the running updater's package tree so its workers survive the installer's replacement (#153764). That retention byte-copied the entire package root (`package.json`, `dist/`, `node_modules/`, 37,309 files / 625 MB for 2026.9.6) with three full `lstat` passes plus a per-file copy and verify. On the release Docker host this ran at ~12 files/s, so every in-place global update stalled in the `validating` phase for well over the E2E harness's 300 s command budget. `Plugin Prerelease` lane `plugin-update` (Full Release Validation 35775979903 → run 35779065106) then reported `update-denied did not return JSON: Unexpected end of JSON input` because `timeout` killed the command before any output. This keeps the retention semantics and makes it cheap: - Files are hard-linked into the private runtime directory (`fs.link`), so the inventoried inodes outlive npm's rename/unlink without copying bytes. Bytes are copied only when the filesystem refuses the link (`EXDEV`, `EPERM`, `ENOTSUP`, ...) or when relocation must rewrite the member in place (`.modules.yaml`, `.bin` launchers), so the live package is never edited through a shared inode. - One walk performs the inventory check, publication, relocation and escape check per entry (was: pre-check pass, directory pass, file pass with two checks, symlink pass, post-check pass, relocation pass, full verify walk). - After each link the private name is checked to reference the inventoried `dev:ino`; entries sharing an already linked inode (pnpm store hard links) keep every fingerprint field except the change time that the link itself bumps. - The IO budget watchdog around retention is unchanged. - `node_modules` stays in the retained tree: retained workers (`dist/**` entrypoints) resolve their dependencies from it. - The shared copy path used for candidate rehearsal snapshots is unchanged in behavior; its plan rebasing, host-link/alias publication and verification moved to `update-candidate-plugin-tree-links.ts` so both materializers share them. - Harness: the consent scenario's "did not return JSON" assertion now includes the command's exit code so a `timeout` kill (124) is visible in CI. ## Evidence - Root cause repro on the exact CI candidate bytes (artifacts `docker-e2e-package-35777886894-1` + `docker-e2e-prepublish-plugin-registry-35777886894-1`): `update --tag core-denied-future.tgz --yes --json` finished `npm i` in 2 min, then sat in `validating` copying `openclaw-update-runtime-*` at 5,264 → 5,513 files in 20 s (~12 files/s); 6,402 files / 102 MB after 9 min; SQLite `update_runs` row `failed/interrupted` when the harness killed it. - With this change: the same repro (same host, load average ~34) returns the denial payload on stdout with exit 0 (`status: ok`, `postUpdate.plugins.status: warning`, `PLUGIN_CAPABILITY_CONSENT_REQUIRED`, `after.version: 2026.9.99-first-hop.0`) and the whole `update --tag` command completes in 3.5 min end to end (npm install 28 s, canary validation, activation, Doctor). Retention alone, measured directly on the installed 38,678-file package with `withRetainedUpdateRuntime`: 33.9 s to retain (about 1,140 files/s, roughly 95x faster than the copy) and 4.6 s to release. - Unit tests: `src/infra/update-retained-runtime-tree.test.ts` (link path shares inodes and survives source replacement, `EXDEV` fallback copies bytes with the inventoried mode, changed entries are refused before any link, relocated launcher is copied so the live file is untouched); existing `update-retained-runtime.test.ts` layouts (npm/pnpm/pnpm-workspace/git/git-linked) and `update-candidate-plugin-tree.test.ts` pass. - `OPENCLAW_TESTBOX=1 pnpm check:changed` and the `plugin-update` Docker lane on the packed candidate: results in the PR comments.
…ng the package (#155977) ## Summary `openclaw update` retains the running updater's package tree so its workers survive the installer's replacement (#153764). That retention byte-copied the entire package root (`package.json`, `dist/`, `node_modules/`, 37,309 files / 625 MB for 2026.9.6) with three full `lstat` passes plus a per-file copy and verify. On the release Docker host this ran at ~12 files/s, so every in-place global update stalled in the `validating` phase for well over the E2E harness's 300 s command budget. `Plugin Prerelease` lane `plugin-update` (Full Release Validation 35775979903 → run 35779065106) then reported `update-denied did not return JSON: Unexpected end of JSON input` because `timeout` killed the command before any output. This keeps the retention semantics and makes it cheap: - Files are hard-linked into the private runtime directory (`fs.link`), so the inventoried inodes outlive npm's rename/unlink without copying bytes. Bytes are copied only when the filesystem refuses the link (`EXDEV`, `EPERM`, `ENOTSUP`, ...) or when relocation must rewrite the member in place (`.modules.yaml`, `.bin` launchers), so the live package is never edited through a shared inode. - One walk performs the inventory check, publication, relocation and escape check per entry (was: pre-check pass, directory pass, file pass with two checks, symlink pass, post-check pass, relocation pass, full verify walk). - After each link the private name is checked to reference the inventoried `dev:ino`; entries sharing an already linked inode (pnpm store hard links) keep every fingerprint field except the change time that the link itself bumps. - The IO budget watchdog around retention is unchanged. - `node_modules` stays in the retained tree: retained workers (`dist/**` entrypoints) resolve their dependencies from it. - The shared copy path used for candidate rehearsal snapshots is unchanged in behavior; its plan rebasing, host-link/alias publication and verification moved to `update-candidate-plugin-tree-links.ts` so both materializers share them. - Harness: the consent scenario's "did not return JSON" assertion now includes the command's exit code so a `timeout` kill (124) is visible in CI. ## Evidence - Root cause repro on the exact CI candidate bytes (artifacts `docker-e2e-package-35777886894-1` + `docker-e2e-prepublish-plugin-registry-35777886894-1`): `update --tag core-denied-future.tgz --yes --json` finished `npm i` in 2 min, then sat in `validating` copying `openclaw-update-runtime-*` at 5,264 → 5,513 files in 20 s (~12 files/s); 6,402 files / 102 MB after 9 min; SQLite `update_runs` row `failed/interrupted` when the harness killed it. - With this change: the same repro (same host, load average ~34) returns the denial payload on stdout with exit 0 (`status: ok`, `postUpdate.plugins.status: warning`, `PLUGIN_CAPABILITY_CONSENT_REQUIRED`, `after.version: 2026.9.99-first-hop.0`) and the whole `update --tag` command completes in 3.5 min end to end (npm install 28 s, canary validation, activation, Doctor). Retention alone, measured directly on the installed 38,678-file package with `withRetainedUpdateRuntime`: 33.9 s to retain (about 1,140 files/s, roughly 95x faster than the copy) and 4.6 s to release. - Unit tests: `src/infra/update-retained-runtime-tree.test.ts` (link path shares inodes and survives source replacement, `EXDEV` fallback copies bytes with the inventoried mode, changed entries are refused before any link, relocated launcher is copied so the live file is untouched); existing `update-retained-runtime.test.ts` layouts (npm/pnpm/pnpm-workspace/git/git-linked) and `update-candidate-plugin-tree.test.ts` pass. - `OPENCLAW_TESTBOX=1 pnpm check:changed` and the `plugin-update` Docker lane on the packed candidate: results in the PR comments.
…aw#153764) Keep failed validation meaningful through activation, rollback, and history. Retain the updater's worker runtime until admitted work and cleanup settle, while preserving current requester checks and structured npm diagnostics. Co-authored-by: Peter Steinberger <[email protected]>
* refactor(cli): centralize daemon action output Keep generic result emission JSON-only and route message-bearing successes through the action context. Bind install warnings once in the shared install context while preserving warning order and lifecycle exception boundaries. Characterize human and JSON output through the existing response owners, including foreground restart health ordering and install warning behavior. * test(daemon): isolate install warning inventory * chore: merge main into daemon output cleanup * chore: merge main into daemon output cleanup Preserve daemon action JSON and human output ownership, including current backup and rebind receipts, readiness exit codes, and runtime pin contracts. Related: openclaw#150047. * test(cli): update daemon restart output fixture * chore(cli): integrate current main for daemon output validation * chore: merge main config reload and wrapper repairs Integrate canonical main 2a74f33, including config include publication fix fda6f32 and wrapper import-closure fix 91a6617. Preserve the published PR ancestry and byte-identical daemon output patch. * chore: merge main pairing fixture repair Integrate canonical main 860100a with SSH pairing fixture fix fadc546 and the reviewed updater owner changes from openclaw#153764. Preserve the published PR ancestry and byte-identical daemon output patch. Co-authored-by: Peter Steinberger <[email protected]>
…ng the package (openclaw#155977) ## Summary `openclaw update` retains the running updater's package tree so its workers survive the installer's replacement (openclaw#153764). That retention byte-copied the entire package root (`package.json`, `dist/`, `node_modules/`, 37,309 files / 625 MB for 2026.9.6) with three full `lstat` passes plus a per-file copy and verify. On the release Docker host this ran at ~12 files/s, so every in-place global update stalled in the `validating` phase for well over the E2E harness's 300 s command budget. `Plugin Prerelease` lane `plugin-update` (Full Release Validation 35775979903 → run 35779065106) then reported `update-denied did not return JSON: Unexpected end of JSON input` because `timeout` killed the command before any output. This keeps the retention semantics and makes it cheap: - Files are hard-linked into the private runtime directory (`fs.link`), so the inventoried inodes outlive npm's rename/unlink without copying bytes. Bytes are copied only when the filesystem refuses the link (`EXDEV`, `EPERM`, `ENOTSUP`, ...) or when relocation must rewrite the member in place (`.modules.yaml`, `.bin` launchers), so the live package is never edited through a shared inode. - One walk performs the inventory check, publication, relocation and escape check per entry (was: pre-check pass, directory pass, file pass with two checks, symlink pass, post-check pass, relocation pass, full verify walk). - After each link the private name is checked to reference the inventoried `dev:ino`; entries sharing an already linked inode (pnpm store hard links) keep every fingerprint field except the change time that the link itself bumps. - The IO budget watchdog around retention is unchanged. - `node_modules` stays in the retained tree: retained workers (`dist/**` entrypoints) resolve their dependencies from it. - The shared copy path used for candidate rehearsal snapshots is unchanged in behavior; its plan rebasing, host-link/alias publication and verification moved to `update-candidate-plugin-tree-links.ts` so both materializers share them. - Harness: the consent scenario's "did not return JSON" assertion now includes the command's exit code so a `timeout` kill (124) is visible in CI. ## Evidence - Root cause repro on the exact CI candidate bytes (artifacts `docker-e2e-package-35777886894-1` + `docker-e2e-prepublish-plugin-registry-35777886894-1`): `update --tag core-denied-future.tgz --yes --json` finished `npm i` in 2 min, then sat in `validating` copying `openclaw-update-runtime-*` at 5,264 → 5,513 files in 20 s (~12 files/s); 6,402 files / 102 MB after 9 min; SQLite `update_runs` row `failed/interrupted` when the harness killed it. - With this change: the same repro (same host, load average ~34) returns the denial payload on stdout with exit 0 (`status: ok`, `postUpdate.plugins.status: warning`, `PLUGIN_CAPABILITY_CONSENT_REQUIRED`, `after.version: 2026.9.99-first-hop.0`) and the whole `update --tag` command completes in 3.5 min end to end (npm install 28 s, canary validation, activation, Doctor). Retention alone, measured directly on the installed 38,678-file package with `withRetainedUpdateRuntime`: 33.9 s to retain (about 1,140 files/s, roughly 95x faster than the copy) and 4.6 s to release. - Unit tests: `src/infra/update-retained-runtime-tree.test.ts` (link path shares inodes and survives source replacement, `EXDEV` fallback copies bytes with the inventoried mode, changed entries are refused before any link, relocated launcher is copied so the live file is untouched); existing `update-retained-runtime.test.ts` layouts (npm/pnpm/pnpm-workspace/git/git-linked) and `update-candidate-plugin-tree.test.ts` pass. - `OPENCLAW_TESTBOX=1 pnpm check:changed` and the `plugin-update` Docker lane on the packed candidate: results in the PR comments.
Resolve the physical .artifacts directory once before native Git database capture. This preserves the existing backup durability, identity, custody and rollback checks while supporting redirected artifact storage. The paired real-backup regression fails on the original caller and passes with the fix. Fresh-process replay verifies cross-volume storage, the physical returned path, SQLite integrity and the retained synthetic row. Existing redirected Git staging tests pass. Related: #160671, #153764
) Resolve the physical .artifacts directory once before native Git database capture. This preserves the existing backup durability, identity, custody and rollback checks while supporting redirected artifact storage. The paired real-backup regression fails on the original caller and passes with the fix. Fresh-process replay verifies cross-volume storage, the physical returned path, SQLite integrity and the retained synthetic row. Existing redirected Git staging tests pass. Related: openclaw#160671, openclaw#153764
Related: #150153, #152466, #153814. The original combined PR must not be merged.
What Problem This Solves
A package or Git update could lose a failed validation result or load replacement worker code while the running updater still expected the previous worker protocol.
User Impact
Updates preserve validation failures through activation, rollback and history, and retain the running updater's worker code until its work settles. Doctor configuration refusals remain fatal without replacing the actual process exit code.
Why This Change Was Made
The CLI owns activation Doctor, requester authority and configuration attribution; package and Git updates consume its results through the shared failure classifier. This removes duplicate Doctor execution and the competing runner facade. Runtime retention uses the existing dependency copier and SQLite broker lifecycle, selecting the code generation before queued work loses its source context. Explicit target-runtime work still uses the selected target.
The change preserves current main's worker preparation, streamed Git-transfer ownership, requester continuation and Doctor advisory behavior. A final configured-owner check runs after executor and Doctor settlement, before publication. Uncertain process settlement retains recovery artifacts; failure to remove disposable files remains advisory.
Evidence
The reviewed candidate is
f4291a7463b6dc2d1320174b591ed6d31fd59b19(tree7fa24c34dca316da4b99f2db9162734a7d09f496). Its patch is identical to the scoped-clean P2-reviewed predecessor; all 65 changed paths were disjoint from intervening main changes, and the nearby dependency audit found no composition defect. Normal commit hooks and all 64 applicable formatting checks passed.2026.9.2driver updated to the exact candidate package and returned success. The native service served that build; session metadata and both transcript messages were preserved, and agent schema advanced from 19 to 23. The original qualification phase remains failed because its immediatePRAGMA user_versionassertion observed 15 before main's existing five-minute publication delay. A separate read-only observation confirmed content schema 18 was already recorded before update completion, and later confirmed both published schema markers at 18 on the same database inode and serving process. The updater was not replayed. Ownership-checked service cleanup and lease release were separately verified.Earlier failed CI and interrupted qualification remain bound to their original sources; they are not relabeled as current-head successes. This PR adds 528 application lines, one tooling line and 2,065 test/support lines against its captured base. The overall split campaign's production reduction is accounted for after actual merges. No production deployment or release is included.