Repository navigation
fix(daemon): forced reinstall moves an unpinned Bun Gateway service to Node - #160189
Conversation
Forced reinstall already retained a supported Node recorded in the managed service, but an unpinned service recorded on Bun fell back to Node. On a Bun-only host that made every implicit reinstall, including the updater's own service refresh, fail; with Node present it silently moved the service to Node. Implicit `gateway install` and `node install` now retain a supported recorded Bun or Node executable. Interactive runtime pickers (configure, Doctor's reinstall branch, onboarding) default to the recorded runtime and use its path only when it stays selected; flows without a picker retain it directly. Explicit --runtime/--runtime-path, pins, wrappers, and the fallback for a missing or unsupported recorded runtime are unchanged. No pin is created.
|
🦞👀 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, 2:35 PM ET / 18:35 UTC (Revision 15). ClawSweeper reviewWhat this changesThe branch makes implicit Gateway and node-host installs retain a supported recorded Bun runtime, uses a supported running Bun when no Node is available, and updates setup, Doctor, QuickStart text, docs, and tests. Merge readiness⛔ Blocked before merge - 1 item remains Keep open. Current main still retains only a recorded Node executable during implicit Gateway reinstall. The merged related PRs address distinct updater, pin, and split-root behavior; this PR remains necessary. The earlier QuickStart finding is fixed, and the recorded published-driver upgrade cell addresses the prior compatibility question. Priority: P1 Review scores
Verification
How this fits togetherGateway and managed node-host installation turns CLI options, saved service commands, and runtime pins into native service definitions. Update refresh, Doctor, configure, and onboarding use that path to choose the executable that starts the service. flowchart LR
A[CLI updater or setup] --> B[Options pin and saved service]
B --> C[Runtime selection]
C --> D[Capability probe]
D --> E[Install plan]
E --> F[Managed service]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +114, Tests +580, Docs +23. Total +717 across 30 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep runtime choice with the shared service installer so update refresh and setup consume the same probed decision and existing runtime-pin contract. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source still selects only a recorded Node executable, and the PR body records the published-version failure on an unpinned Bun service. I did not execute current main. Is this the best way to solve the issue? Yes. The branch uses the existing service planner and runtime capability probes while preserving explicit runtime choices and pins; an explicit runtime-path pin is a workaround for one service, not a repair for implicit refresh. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eadee73a325e. 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 (14 earlier review cycles; latest 8 shown)
|
Fall back only after implicit Node discovery finds no supported executable, and require the existing capability probe to approve the running Bun. Carry explicit runtime intent through shared service planning, retain pins/wrappers/recorded runtimes, and never persist the fallback as a pin. Validation: 250 distinct focused tests passed across nine files (164 tests in 39.70s; 100 in 20.85s, with overlapping regression coverage). The registered install regression failed before the fix. Both tsgo:core and tsgo:test:root, changed-file oxfmt, git diff --check, and scoped P2 Codex autoreview passed. No CI reruns were requested.
…runtime-retention
…runtime-retention
… fallback Compute the setup suggestion before configure, Doctor, or advanced onboarding prompts, using the shared Bun-only discovery policy. Treat picker results and pins as explicit runtime intent so selecting unavailable Node fails before service replacement. Retain recorded runtime paths, preserve quickstart's implicit fallback, and keep automatic choices unpinned. Doctor uses the same suggestion for its non-interactive runtime fallback. Service-install consent and update deferral remain unchanged. No state or runtime-pin migration is needed. Validation: the configure regression reached installation before the fix and now fails with the existing unavailable-Node diagnostic before install. 164 tests passed across six focused files in 218.77s wall, including cold compiler preparation; the commands shard passed 85 tests in 22.04s and the onboarding shard passed 70 tests in 12.36s. tsgo:core (18.83s), tsgo:test:root (67.31s), changed-file oxfmt, git diff --check, and scoped P2 Codex autoreview passed. No CI runs were dispatched or retried. Addresses the interactive runtime selection finding on #160189.
…runtime-retention
|
@clawsweeper re-review Refreshed onto main The sole conflict was the Bun compatibility history table. Both parents' rows are preserved verbatim in newest-first chronological order. There were no source conflicts. Validation: Focused tests passed: 11 files, 347 tests across three Vitest shards. Measured node scripts/run-vitest.mjs src/cli/daemon-cli/install.reinstall.test.ts src/cli/daemon-cli/install.wrapper.integration.test.ts src/cli/node-cli/daemon.test.ts src/commands/configure.daemon.test.ts src/commands/daemon-install-plan.shared.test.ts src/commands/doctor-gateway-daemon-flow.test.ts src/commands/doctor-gateway-services.test.ts src/commands/gateway-setup-runtime.test.ts src/commands/node-daemon-install-helpers.test.ts src/wizard/setup.finalize.test.ts src/wizard/i18n/index.test.ts --maxWorkers=1This is a branch refresh only; the PR remains open for review. |
|
🦞👀 Re-review progress:
|
|
CI run 36426405305, attempt 1, failed in The test uses a mock Gateway and exercises Control UI layout; this PR touches neither the failing test nor the UI, stylesheet, or QA harness code it exercises. Main recurrence is not established; recent successful main push runs do not provide full-suite evidence. Under the coordinator's unrelated-flake policy, one failed-job rerun is authorized once this attempt completes. A repeat failure will stop landing; a passing rerun would not establish a fix. |
|
@clawsweeper re-review Refreshed onto main after #159431. New head: The merge completed without conflicts. All Bun compatibility table rows from both parents are preserved verbatim and in their existing order; both sides' Doctor documentation is retained. No source resolution was needed. Validation: |
|
🦞👀 Re-review progress:
|
|
CI run 36435979350 attempt 1, job 108974878799 (
The job log was fetched once: 77 files / 364 tests passed, 2 files / 2 tests failed. Both tests and the browser UI, Gateway-client, and mock harness code they exercise are untouched by this PR; neither flow invokes daemon installation or wizard runtime selection. The same failures on current main are not established. Under the coordinator's unrelated-flake policy, requesting one failed-job rerun after attempt completion; either repeated failure stops landing. A passing replay would not establish a fix, and cancelled coverage remains unrun until the rerun completes. Cutoff update (14:59 UTC): attempt 2 is in progress on unchanged head |
|
@clawsweeper re-review Refreshed head: The previously resolved interactive-runtime and QuickStart effective-runtime findings remain fixed. The PR body's R4 published-driver × candidate refresh supplies upgrade compatibility proof; no persisted schema or service-definition format changes are introduced. Exact-head CI is pending. |
|
🦞👀 Re-review progress:
|
|
CI run 36446914644, attempt 1, head The test uses the browser mock Gateway and UI history/loading state. The failing file, UI history/request owners, mock Gateway, and shared harness are untouched by this PR; daemon service installation and wizard runtime selection are not exercised. |
|
CI note for head |
|
@clawsweeper re-review Refreshed head: All compatibility-table rows from both parents are preserved verbatim and in order. Dependency files match main exactly after The interactive-runtime and QuickStart effective-runtime findings remain resolved. R4 in the PR body retains the published-driver upgrade proof. Historical unrelated CI failures and reruns remain recorded; the side-chat readiness failure is addressed by incorporated main fix |
|
🦞👀 Re-review progress:
|
|
CI note for head |
|
@clawsweeper re-review Refreshed head: Post-resolution proof: Main includes the side-chat readiness fix |
|
🦞👀 Re-review progress:
|
|
CI run 36463375406 attempt 1, head Main already fixed the fixture in ClawSweeper revision 14 reviewed the preceding head with no actionable code findings and explicitly resolved QuickStart. Its recurring “Add data-model compatibility proof” checkbox is already addressed by R4 in the PR body, which the review itself acknowledges; the emitted review state nevertheless remains blocked. |
|
Data-model compatibility checklist for head Upgrade compatibility is demonstrated by live R4 in the PR body: the published 2026.9.6 updater refreshes the candidate service with no runtime flags, and the Gateway restarts healthy on Bun with a new PID. For precision, R4's service is unpinned, with Bun recorded in its existing service definition; this directly exercises the retention bug. The accompanying R0/R1/R3 evidence covers the published before-failure, successful retained-runtime reinstall/Doctor flow, and Bun-only first install. Those live cells plus the focused regression coverage answer the generic data-model compatibility checklist item. |
|
Merged via squash.
|
…o Node (openclaw#160189) * fix(daemon): keep a supported recorded Bun on implicit service reinstall Forced reinstall already retained a supported Node recorded in the managed service, but an unpinned service recorded on Bun fell back to Node. On a Bun-only host that made every implicit reinstall, including the updater's own service refresh, fail; with Node present it silently moved the service to Node. Implicit `gateway install` and `node install` now retain a supported recorded Bun or Node executable. Interactive runtime pickers (configure, Doctor's reinstall branch, onboarding) default to the recorded runtime and use its path only when it stays selected; flows without a picker retain it directly. Explicit --runtime/--runtime-path, pins, wrappers, and the fallback for a missing or unsupported recorded runtime are unchanged. No pin is created. * fix(daemon): use the running Bun when a Bun-only host has no Node Fall back only after implicit Node discovery finds no supported executable, and require the existing capability probe to approve the running Bun. Carry explicit runtime intent through shared service planning, retain pins/wrappers/recorded runtimes, and never persist the fallback as a pin. Validation: 250 distinct focused tests passed across nine files (164 tests in 39.70s; 100 in 20.85s, with overlapping regression coverage). The registered install regression failed before the fix. Both tsgo:core and tsgo:test:root, changed-file oxfmt, git diff --check, and scoped P2 Codex autoreview passed. No CI reruns were requested. * fix(daemon): keep an interactive runtime choice ahead of the Bun-only fallback Compute the setup suggestion before configure, Doctor, or advanced onboarding prompts, using the shared Bun-only discovery policy. Treat picker results and pins as explicit runtime intent so selecting unavailable Node fails before service replacement. Retain recorded runtime paths, preserve quickstart's implicit fallback, and keep automatic choices unpinned. Doctor uses the same suggestion for its non-interactive runtime fallback. Service-install consent and update deferral remain unchanged. No state or runtime-pin migration is needed. Validation: the configure regression reached installation before the fix and now fails with the existing unavailable-Node diagnostic before install. 164 tests passed across six focused files in 218.77s wall, including cold compiler preparation; the commands shard passed 85 tests in 22.04s and the onboarding shard passed 70 tests in 12.36s. tsgo:core (18.83s), tsgo:test:root (67.31s), changed-file oxfmt, git diff --check, and scoped P2 Codex autoreview passed. No CI runs were dispatched or retried. Addresses the interactive runtime selection finding on openclaw#160189. * fix(gateway): report the effective QuickStart service runtime * fix(wizard): translate the QuickStart Bun runtime note
Related: #159431
What Problem This Solves
Fixes:
openclaw gateway install --force(and the updater's service refresh, which runs it without runtime flags) moves an unpinned Gateway service recorded on Bun to Node. On a Bun-only host it fails with "No supported Node runtime". A firstgateway installon a Bun-only host fails the same way.User Impact
An implicit reinstall now keeps a supported Bun recorded in the managed service, just as it already kept a recorded Node. This covers
gateway install --force,node install --force, and the updater's service refresh. Interactive runtime pickers in configure, Doctor's reinstall branch, and onboarding now default to the recorded runtime instead of Node. Explicit--runtime/--runtime-path, pins, and wrappers are unchanged. A recorded runtime that is missing or unsupported still falls back to today's Node selection. A first install on a Bun-only host now also works: with no pin, no recorded runtime, and no supported Node anywhere, an implicit install uses the running supported Bun. It prints a warning and writes no pin. Where a supported Node exists, Node remains the default. QuickStart reports the effective runtime from the completed install plan, so a Bun-only install announces Bun.Why This Change Was Made
Runtime selection belongs to the service configuration: pin, then the recorded runtime, then the default. The recorded-runtime step only knew Node. A small
resolveRecordedDaemonRuntimeprobes the recorded executable as Bun or Node and never substitutes a discovered runtime. The Gateway and node-host installers and the shared setup resolver use it. The setup resolver passes the recorded runtime to pickers as their default, so an explicit interactive choice still wins. The recorded path is used only when that runtime remains selected. No pin is written, and the pin record, config schema, and service-definition format are unchanged.This was a follow-up from #159431, which keeps the updater's own children on Bun and relies on the service configuration for the service runtime.
Evidence
Latest QuickStart/CI follow-up: the Bun-only wizard regression failed before the repair because the install selected Bun but the note did not say “QuickStart uses Bun”; it passes after moving the note behind the real install planner. The regression mocks host probes and service installation, while exercising the real wizard service setup and install plan. The generic picker retains its
<T> → Promise<T>contract with a method spy, and runtime explicitness uses an explicit undefined comparison.Focused proof (
node scripts/run-vitest.mjs <files> --maxWorkers=1, measured with/usr/bin/time -p):setup.finalize.test.ts,gateway-setup-runtime.test.ts,daemon-install-plan.shared.test.ts,daemon-install-helpers.test.tsdoctor-gateway-daemon-flow.test.ts,doctor-gateway-services.test.ts(required plan-field fixture updates)The oversized Doctor test file now delegates its existing Bun-only regression to its test-support module, preserving its assertions and staying under the lint line limit without a suppression.
The wizard regression needs the real install planner to catch the original ordering defect; no sleeps, polling, timers, or live Gateway boots were added. Targeted oxlint (including
gateway-setup-runtime.ts),pnpm tsgo:core, and the exact failingcore-test-commandstsgo graph pass;core-test-other,core-test-commands-doctor,core-test-config-cli, andcore-test-cli-updatealso pass. Formatting andgit diff --checkpass. Final Codex autoreview (high reasoning, P0–P2) isscoped-cleanwith no accepted/actionable findings. CI run 36400713885 failed on the PR-introduced implicit coercion and generic mock; current main has neither defect.CI follow-up: run 36405535779 exposed a missing pair of shipped locale keys; Simplified and Traditional Chinese now include the Bun note, and the existing locale-parity suite passes (13 tests, 3.03s wall). The same run inherited ten ACP lifecycle fixture failures from main; main fix
ea6bf83e821f4808e081f8ff1ffa30b34414edd7supplies the missing typed exports, and this branch incorporates it through main526f67dc6382bae28cb26231b0813ce755521d80.The published-driver test also hit its 15-second child timeout in that PR run and independently in main run 36405405614 (job 108873060688). A local replay of the original 85-file CLI selection with eight workers reproduced the three driver timeouts, plus a roster integration failure and a pre-bootstrap subprocess timeout (82 files passed, 3 failed; 280.45s wall). The standalone driver suite passes after the main integration, but this is not evidence of a timeout fix; its cause remains unresolved. No timeout, retry, or assertion was weakened.
Post-integration proof:
setup.finalize.test.ts,i18n/index.test.ts,gateway-setup-runtime.test.ts, anddaemon-cli.update-run.test.tspassed: 4 files / 104 tests, 84.77s combined wall with--maxWorkers=1. The complete PR delta against the incorporated main head received a fresh scoped-clean P0–P2 Codex autoreview. Earlier cancelled CI coverage remains unrun; final exact-head CI is the landing gate.Original retention regressions, each failing on
mainand passing on the recorded candidate (node scripts/run-vitest.mjs <file> --maxWorkers=1, wall times include compile and worker startup):src/cli/daemon-cli/install.reinstall.test.tssrc/cli/node-cli/daemon.test.tssrc/commands/doctor-gateway-daemon-flow.test.tssrc/commands/configure.daemon.test.tssrc/wizard/setup.finalize.test.tssrc/commands/gateway-setup-runtime.test.ts+ non-interactivedaemon-install.test.tsCovered: an unpinned supported recorded Bun is kept, with its path; a recorded Bun that is unsupported or missing falls back to Node; explicit
--runtime nodestill selects Node; pickers default to the recorded runtime and a different choice drops the recorded path; Doctor's non-interactive fallback and quickstart keep the recorded Bun.pnpm tsgo:core,pnpm tsgo:test:root, oxfmt, targeted lint, andgit diff --checkpass. A Codex review (high reasoning, P0–P2) isscoped-clean. Live proof on a Crabbox AWS Ubuntu VM with the OpenClaw Bun fork1.4.3-canary.1+ddfce5d01. Bun-only users run in a systemd user manager whose mount namespace has nonode,npm,npx, orcorepackanywhere, plus a private/tmp. Candidates were built on the box frome426c54cand69c2fa3a. Every service was installed without--runtime-path, so none is pinned.gateway install --force --jsone426c54c): same reinstall, thendoctor --fix --non-interactive --yesExecStartand/proc/<pid>/exe); no pin row; no Node migration proposed69c2fa3a): no service, no Node,gateway install --force --jsonwith no flags69c2fa3a): Node visible, unpinned Bun service, published 2026.9.6 runsupdate --tag <candidate>status: ok. The sampled refresh child was the candidate'sgateway install --force --json --update-executor runwith no runtime flags, and the Gateway restarted on the fork Bun (new PID), healthy and unpinned.One observation I could not attribute: after
doctor --fix, the Bun Gateway's health probe reported an event-loop CPU advisory. It persisted in a sample 61 seconds later with the other proof Gateways stopped (CPU 1.2–1.3); health still exited 0 and RPC succeeded. The change only selects which runtime path is written, and the service ran on the same Bun either way.Data-model compatibility proof: the existing R4 published-driver × candidate refresh above demonstrates that the published 2026.9.6 updater refreshes the recorded Bun service and keeps it on Bun. This service is unpinned (no
--runtime-pathand no pin row), which exercises the retention bug directly. No schema changes or migrations are made: the pin record, config schema, and persisted service-definition format are unchanged, and no pin is written for a retained or fallback runtime. The effective runtime returned by the install plan is in-memory metadata for the wizard note.