Repository navigation
fix(update): update split-root Bun Gateway installs with their pinned runtime - #160495
Conversation
…ir own Bun Route owned split-root Bun Gateway services through the existing service-root update path, leaving the invoking CLI installation unchanged. Validate the service executable with the shared Bun and WAL-safe node:sqlite owner instead of comparing Bun's emulated Node version with engines.node. Keep Node rebind behavior, destination ownership, and the existing runtime-pin restart contract. Use the verified service Bun for Bun-owned package probes and installation; otherwise select the current Bun process executable before falling back to PATH. Consolidate repeated plan returns and keep their data types with service context. Update behavior: the installed updater runs first. Published 2026.9.6 still attempts cross-root rebinding and refuses a Bun split-root service before stopping it (original-service-unverified); the Gateway keeps running. This change applies from the first updater candidate that contains it. Validation: five expected pre-fix failures; focused Vitest 8 files / 166 tests passed in 95.27s with --maxWorkers=1. After planning cleanup, 4 files / 66 tests passed in 101.29s; final runtime checks passed 2 files / 52 tests in 69.00s. Core tsgo, the full source-test lane, final affected test types, scoped oxlint, oxfmt, three-file MDX sanity, and diff whitespace checks passed. The optional changed-graph selector encountered an unrelated UI inventory budget of 721/720; the full source-test lane ran successfully. Boundary proof covers pin retention and failed-stage cleanup; no operator Gateway was modified.
…ects Finalization retains the updater runtime even when an owned Bun service selects its own package root and runtime. Validate a Node updater through the existing Node engine/capability preflight before allowing the Bun service update, retain its refusal details, and preserve the service Bun pin when both runtimes pass. Service recovery cannot replace the runtime retained by finalization. Extend the target-boundary regression for old Node, missing SQLite text capability, and supported Node; both refusal cases failed before the fix. Clarify the additional updater requirement in the Bun/update documentation. The installed updater must contain this fix; it cannot be supplied retroactively by the candidate package. Validation: 3 focused Test Files / 61 tests passed with --maxWorkers=1 in 56.28s. Core tsgo, CLI update test types, scoped lint/format, three-page MDX validation, diff whitespace checks, and independent autoreview passed.
|
🦞👀 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 28, 2026, 1:53 PM ET / 17:53 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch makes updates target an owned Bun Gateway’s installation with its verified runtime, prevents cross-root Doctor repair from stopping that Gateway, and updates regression tests and installation guidance. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. Current main does not handle the reported split-root Bun case. The prior upgrade-compatibility question is answered by the recorded published-driver and candidate-driver runs, and this review found no actionable patch defect. Priority: P2 Review scores
Verification
How this fits togetherThe update CLI reads the invoking installation and the managed Gateway’s service definition before choosing a package root and runtime. That choice controls package installation, service restart, and later Doctor maintenance. flowchart LR
A[Invoking CLI] --> C[Owned service inspection]
B[Gateway definition and runtime pin] --> C
C --> D{Bun at another root?}
D -->|Yes| E[Gateway package root]
D -->|No| F[Existing update route]
E --> G[Verified Bun install]
G --> H[Service restart]
F --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +319, Docs +73. Total +408 across 23 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep update destination and runtime selection with the existing service and package owners, preserving the Bun pin and refusing cross-root repair before service shutdown. Do we have a high-confidence way to reproduce the issue? Yes. Current-main routing and the contributor’s before-fix Linux fixture identify the refusal path, while the Doctor follow-up records the earlier service-stop failure; this read-only review did not execute them. Is this the best way to solve the issue? Yes. The patch uses the existing service-root route and pinned-runtime validator, and places the Doctor refusal before service shutdown. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e4e9cd4aeee. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Live S1b/S2b proof found that repair from an aligned CLI installation stopped the Bun Gateway at another root, then left it stopped after reconciliation failed. Reject Bun at the shared cross-root refresh admission owner before Doctor can stop the service. Keep the existing refusal and drift details, directing repair to the Gateway installation rather than advising a manual stop. Node refresh admission is unchanged. Regression proof exercises the real Doctor health/maintenance flow, including update context, and direct Doctor service repair. Three new cases failed before the fix. Focused tests: 4 Test Files / 56 tests passed with --maxWorkers=1. Doctor flow selection: 44.13s wall; installation suite: 109.60s; service layout and routing suites: 37.29s together. Core/test types, scoped lint/format, MDX, diff whitespace, and independent autoreview passed. The broader health migration matrix was interrupted to focus the proof; live S1b/S2b replay remains pending.
|
@clawsweeper re-review Please re-review head |
|
🦞👀 Re-review progress:
|
|
Landing paused at head The exact check, |
|
@clawsweeper re-review Please review new head |
|
🦞👀 Re-review progress:
|
|
On the remaining "data-model compatibility proof" item: this PR changes no schema, config format, or persisted data. Runtime pins, service definitions, and the update/rollback ledgers keep their existing formats, so there is nothing to migrate. The upgrade-compatibility proof is the live published-driver × candidate matrix in the PR body (AWS Crabbox, pinned fork Bun):
That is the upgrade path in both directions this change can affect. |
|
@clawsweeper re-review New head: b5f3bac. Updated all three stale planner assertions to runtime-neutral wording, including the negative control. The full node-runtime suite plus service-plan, service-root-plan, and target.n1-prefix suites passed: 4 Test Files / 79 tests, 77.13 s wall with The existing data-model item is answered in comment 5875045715: no schema, config, persisted-data, or service-definition format changes. Published-driver × candidate and post-fix Doctor live evidence remain in the PR body. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
… runtime (openclaw#160495) * fix(update): update split-root Bun Gateway installs in place with their own Bun Route owned split-root Bun Gateway services through the existing service-root update path, leaving the invoking CLI installation unchanged. Validate the service executable with the shared Bun and WAL-safe node:sqlite owner instead of comparing Bun's emulated Node version with engines.node. Keep Node rebind behavior, destination ownership, and the existing runtime-pin restart contract. Use the verified service Bun for Bun-owned package probes and installation; otherwise select the current Bun process executable before falling back to PATH. Consolidate repeated plan returns and keep their data types with service context. Update behavior: the installed updater runs first. Published 2026.9.6 still attempts cross-root rebinding and refuses a Bun split-root service before stopping it (original-service-unverified); the Gateway keeps running. This change applies from the first updater candidate that contains it. Validation: five expected pre-fix failures; focused Vitest 8 files / 166 tests passed in 95.27s with --maxWorkers=1. After planning cleanup, 4 files / 66 tests passed in 101.29s; final runtime checks passed 2 files / 52 tests in 69.00s. Core tsgo, the full source-test lane, final affected test types, scoped oxlint, oxfmt, three-file MDX sanity, and diff whitespace checks passed. The optional changed-graph selector encountered an unrelated UI inventory budget of 721/720; the full source-test lane ran successfully. Boundary proof covers pin retention and failed-stage cleanup; no operator Gateway was modified. * fix(update): keep the updater runtime preflight for Bun service redirects Finalization retains the updater runtime even when an owned Bun service selects its own package root and runtime. Validate a Node updater through the existing Node engine/capability preflight before allowing the Bun service update, retain its refusal details, and preserve the service Bun pin when both runtimes pass. Service recovery cannot replace the runtime retained by finalization. Extend the target-boundary regression for old Node, missing SQLite text capability, and supported Node; both refusal cases failed before the fix. Clarify the additional updater requirement in the Bun/update documentation. The installed updater must contain this fix; it cannot be supplied retroactively by the candidate package. Validation: 3 focused Test Files / 61 tests passed with --maxWorkers=1 in 56.28s. Core tsgo, CLI update test types, scoped lint/format, three-page MDX validation, diff whitespace checks, and independent autoreview passed. * fix(doctor): leave split-root Bun Gateways at their own install root Live S1b/S2b proof found that repair from an aligned CLI installation stopped the Bun Gateway at another root, then left it stopped after reconciliation failed. Reject Bun at the shared cross-root refresh admission owner before Doctor can stop the service. Keep the existing refusal and drift details, directing repair to the Gateway installation rather than advising a manual stop. Node refresh admission is unchanged. Regression proof exercises the real Doctor health/maintenance flow, including update context, and direct Doctor service repair. Three new cases failed before the fix. Focused tests: 4 Test Files / 56 tests passed with --maxWorkers=1. Doctor flow selection: 44.13s wall; installation suite: 109.60s; service layout and routing suites: 37.29s together. Core/test types, scoped lint/format, MDX, diff whitespace, and independent autoreview passed. The broader health migration matrix was interrupted to focus the proof; live S1b/S2b replay remains pending. * docs(update): clarify published split-root Bun behavior * test(update): assert the runtime-neutral planner messages
Related: #159431
What Problem This Solves
Fixes
openclaw updaterefusing an owned Bun Gateway at a different package root withoriginal-service-unverified, and Bun package commands selecting barebunfrom PATH instead of the verified executable.User Impact
Owned split-root Bun Gateway installations update in place with their recorded runtime pin; the invoking CLI installation stays unchanged. Package probes and installation retain the selected Bun even when PATH has no Bun or contains a different build.
Update behavior: the installed updater runs first. In the live Linux fixture, published 2026.9.6 with no Bun on PATH refused early with ENOENT, leaving the Gateway and both roots unchanged. With the fork Bun on PATH, that same published driver updated service root B in place and restarted healthy while CLI root A stayed unchanged. This PR's routing and verified-executable selection apply from the first candidate containing them; a newer candidate cannot retroactively change its installed driver's first hop.
Why This Change Was Made
Reuse the existing service-root update route and the shared Bun/SQLite executable validation, while preserving Node service routing and destination ownership checks. Bun's emulated Node version is not checked against
engines.node. A Node-based updater still passes the target's Node engine and SQLite preflight because finalization retains the updater runtime. Bun package commands use the verified service Bun, then the current Bun process executable, with PATH only as the final fallback.The two commits were rebased onto the prerequisite squash merge without conflicts. Initial production LOC: +10 net; the Doctor follow-up below adds +6 net. The three installation/update docs describe runtime selection and first-hop behavior; the changelog remains release-owned.
Evidence
The original reviewed commits record five expected pre-fix failures for service routing/executable selection, plus two pre-fix failures for the old-Node and missing-SQLite-TEXT updater cases; those regressions passed after the fixes. Rebased-head validation and per-file single-worker wall times are recorded below.
Validated head:
c4421ba82d6c6e36c3ff2005aac0f59ffdd2a0f0.node scripts/run-vitest.mjs <file> --maxWorkers=1: 5 Test Files / 92 tests passed, measured separately with/usr/bin/time -p(133.45 s total wall).src/cli/update-cli/update-command-service-plan.test.tssrc/cli/update-cli/update-command-service-root-plan.test.tssrc/cli/update-cli/update-command-target.n1-prefix.test.tssrc/infra/update-global.bun-owner.test.tssrc/cli/daemon-cli/install.reinstall.test.tsWall times include harness compilation, module transforms, and cleanup. These existing suites exercise runtime admission, update destination selection, package activation/cleanup, and daemon reinstall pin retention through their owning boundaries. CI timing is pending.
Also passed:
pnpm tsgo:core(14.29 s wall), scoped oxlint and oxfmt on all 15 changed TypeScript files, oxfmt and MDX validation on all three changed docs, andgit diff --check. Independent Codex autoreview againstorigin/maincompleted with no actionable P0–P2 findings.Live proof ran on AWS Crabbox lease
cbx_761305c7e96a, using the verified fork Bun build6b9148b1(1.4.3-canary.1+6b9148b17) and candidates built on the box. A is the invoking CLI installation; B is the managed Gateway installation. Initial S1/S2/S3 usedc4421ba82d6c6e36c3ff2005aac0f59ffdd2a0f0; fresh S0′/S1b/S2b used the candidate built from332b0938b61a7541a026d2c2996989a372006690.Upgrade-compatibility proof (published driver × candidate)
The live cells below are the upgrade-compatibility proof requested by ClawSweeper: S0 uses published 2026.9.6 without Bun on PATH and refuses early with the Gateway and both roots unchanged; S0′ uses published 2026.9.6 with the fork Bun on PATH and updates B in place to a healthy candidate; S1/S2 exercise candidate Node/Bun drivers; S1b/S2b after
332b0938verify maintenance leaves the updated Gateway running. This PR changes no schema, config format, or persisted data model. Runtime pins and service definitions keep their existing formats; no data migration is required.332b0938Native lifecycle timestamps, restart counts and maintenance journals also showed no stop/restart during the fixed maintenance cells; approximately one-second samples do not claim continuous observation. No manual restart, reinstall or guard override was used for those reruns. The Linux fixture exercises the protected service-root path and explicit Bun writer, but does not independently isolate the owned-Bun routing predicate. System Node remained 24.18.1. Fixtures used synthetic credentials only; no credentials or raw private logs are included here. No configuration, stored schema or service-definition format changes are introduced; upgrade compatibility is covered by the published-driver and candidate-driver cells above.
Live-proof follow-up: S1b/S2b Doctor admission
On
c4421ba82d6c6e36c3ff2005aac0f59ffdd2a0f0, S1b (Node updater) and S2b (Bun updater) aligned the original invoking CLI A with the updated service installation B, then ran repair and Doctor from A. Repair returned exit 0/status warning but stopped the Bun Gateway at B and left it stopped because cross-installation reconciliation could not be verified. The separate manual reinstall from B restored health; it does not count as successful repair proof.The fix excludes Bun runtimes at
resolveGatewayServiceInstallationRefreshRoot, the shared admission owner for moving a service onto another CLI root. Doctor performs this inspection before the native stop. Explicit repair from A now refuses maintenance with installation-drift guidance while leaving the service and state untouched; run repair from B instead. Diagnostic service repair retains its drift note and skips installation. Node cross-root refresh admission is unchanged. No configuration, stored schema, or service-definition format changed.Follow-up head:
332b0938b61a7541a026d2c2996989a372006690.Three regression cases failed before this fix: the real Doctor health flow admitted cross-root Bun maintenance with and without update context, and direct Doctor service repair invoked the installer. The corrected focused proof passed 4 Test Files / 56 tests, all with
--maxWorkers=1:src/flows/doctor-health.test.ts— Bun regressions and existing foreign-running controlssrc/commands/doctor-maintenance.installation.test.ts— full suite, including Node cross-root behaviorsrc/daemon/service-layout.test.tsandsrc/cli/update-cli/update-command-service-root-plan.test.tsThe broader Doctor health migration matrix was interrupted to focus on these contracts; no full-file pass is claimed for that file. Wall times include harness preparation and cleanup. Core tsgo, Doctor and general source test-type graphs, scoped oxlint/oxfmt, both changed docs' MDX checks,
git diff --check, and independent autoreview passed with no actionable P0–P2 findings. CI timing for this head is pending; no CI run was dispatched or rerun for proof.Follow-up LOC versus
c4421ba: production +8/−2 (net +6); tests +73/−1 (net +72); docs +14/−0. Fresh live S1b/S2b replay against this exact fix is complete, as recorded in the table above. Both Gateways remained healthy with unchanged PID and pin through maintenance. The requested all-zero maintenance outcome was not observed: repair intentionally returned 1 with drift guidance, leaving the service running. The original failed cells remain recorded separately.Documentation follow-through: head
6745aaeb2eb9d20a6910f273aa6f5f87e27ebe95corrects the same published-driver statement indocs/install/bun-compatibility.mdanddocs/install/updating.md. This is a docs-only delta from the live-tested332b0938production code. Both files passed oxfmt and MDX validation;git diff --checkand independent Codex autoreview passed with no actionable P0–P2 findings. Current-head CI and ClawSweeper review remain landing gates.Refresh validation: merged main
f010fc0b579071d151e8f4e4084a40ac0b219057without conflicts into headdbf35a674cffdbf8e6ce9b390df5d19b1f369f78. The updater node-runtime/noop and service-plan/service-root-plan selections passed 4 Test Files / 65 tests, usingnode scripts/run-vitest.mjs <files> --maxWorkers=1, in 137.66 s wall. Independent Codex autoreview found no actionable P0–P2 findings;git diff --checkand the export-name collision guard passed. Package manifests and lockfile are unchanged versus main. Exact-head CI and ClawSweeper remain required landing gates.Assertion follow-up:
b5f3bace55c231b5f6b2466151699150c77e8d35updates the three planner output assertions to runtime-neutral wording, including the negative control. This fixes the stale expectation in CI run 36455674328 / job 109044885440. No production behavior changes in this follow-up.Focused validation with
node scripts/run-vitest.mjs <files> --maxWorkers=1: 4 Test Files / 79 tests passed, 77.13 s total wall. The completesrc/cli/update-cli.node-runtime.test.tspassed 18 tests (48.01 s Vitest duration); the service-plan, service-root-plan, and target.n1-prefix files passed 47, 7, and 7 tests respectively (19.34 s combined Vitest duration). Total wall includes wrapper preparation and cleanup. Scoped oxfmt/oxlint,git diff --check, and independent Codex autoreview passed with no actionable P0–P2 findings. Repository search found no remaining old quotes of these planner messages; the separate Node-only schema diagnostic remains unchanged. Exact-head CI and ClawSweeper re-review are pending.Hosted assertion-fix proof: on exact head
b5f3bace55c231b5f6b2466151699150c77e8d35, CI run 36458778939, the formerly failingchecks-node-changed-compact-large-7job 109052394328 passed. Its Node test step took 545 s (17:34:09–17:43:14 UTC); total job time was 587 s. These are mixed-shard timings, not isolated-file timings. Aggregate CI and the fresh ClawSweeper verdict are still pending.