Repository navigation
fix(macos): keep saved Gateway runtime pins without automatic replacement - #160127
Conversation
The macOS app enabled its LaunchAgent with an explicit `--runtime node`. Since runtime pins exist, that flag clears pin intent, so every launch-agent toggle wiped a runtime pinned with `openclaw gateway install --runtime-path`. Drop it: the service configuration owns runtime selection, fresh installs still default to Node, and forced reinstall keeps a pinned or recorded runtime. When the app's resolved CLI runs under an absolute Bun executable, both the macOS and Linux apps now pass `--runtime bun --runtime-path <bun>`, so a Bun-only app install pins its own Bun.
|
🦞👀 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: needs maintainer review before merge. Reviewed September 28, 2026, 6:49 AM ET / 10:49 UTC (Revision 12). ClawSweeper reviewWhat this changesThe macOS app stops overriding Gateway runtime selection with Node, while the CLI adds explicit repair guidance for invalid saved pins and the tests and docs describe the behavior. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main still forces Node when the macOS app enables its Gateway, and the branch addresses that saved-pin failure. The earlier P1 findings are resolved; this review found no new actionable defect. Priority: P1 Review scores
Verification
How this fits togetherThe macOS app asks the Gateway CLI to install or refresh its LaunchAgent. The CLI reads saved runtime intent, validates it, and writes the service definition that starts the Gateway. flowchart LR
A[macOS app enable] --> B[Gateway install CLI]
C[Saved runtime pin] --> B
B --> D{Pin valid?}
D -->|Yes| E[LaunchAgent definition]
D -->|No| F[Repair instruction]
E --> G[Gateway runtime]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +54, Docs +4, Other +12. Total +72 across 6 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep runtime selection with the CLI, preserve valid saved pins during app enable, and display the explicit reinstall instruction when a pin cannot be used. Do we have a high-confidence way to reproduce the issue? Yes, from current-main source: the macOS enable request passes Is this the best way to solve the issue? Yes. Removing the app's override lets the existing CLI pin owner select and validate the runtime without adding a second pin policy in Swift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc168b2f6c16. 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 (11 earlier review cycles; latest 8 shown)
|
|
CI note: run 36380081999 failed one unrelated Bun-lane test, |
Leave runtime selection with the service installer. Remove both apps' Bun runtime-path overrides, which could replace an operator pin, while retaining the macOS fix that omits the pin-clearing explicit runtime node selection. Enabling preserves an installed service's pin. Disabling still uninstalls the LaunchAgent and removes the pin. CLI fallback on Bun-only hosts is separate. Validation: 59 focused native tests passed in an isolated test-helper run; SwiftFormat, docs formatting, and diff checks passed. Independent review of the complete candidate is scoped-clean for P0-P2.
|
Addressing the two P1 findings on
|
…its Gateway Classify both CLI pin inspection and validation failures as runtime-pin-invalid in JSON while preserving the existing human errors and exit code 1. The macOS app keeps valid runtime pins, but retries an install once with --runtime node when the CLI reports that typed failure. Log successful repair, return retry failures, and leave unrelated failures unchanged. Validation: CLI output and response tests passed 19/19 in 23.11s wall; the install-output file passed 6 cases. Core typechecking, 60 focused native tests, SwiftFormat, oxfmt, and whitespace checks passed. Independent P0-P2 review of the complete candidate is scoped-clean. Both regressions failed before the fix.
Give a saved pin's changed service definition a dedicated error class. Only that inspection failure emits runtime-pin-invalid; transient IO/SQLite and other inspection failures remain untagged so the app preserves the pin and returns the error without resetting runtime selection. Keep the invalid executable classification and all human errors unchanged. Exercise the real pin reader with an IO-like state read failure and a changed saved definition. The transient-read regression fails before this fix. Validation: 10 focused tests passed in 97.32s wall (7 install-output cases and 3 pin-state cases), pnpm tsgo:core, oxfmt, and whitespace checks passed. Swift is unchanged; existing coverage rejects retries for untagged failures.
…ment Automatic runtime retries could discard an operator pin after transient validation failures or a changed service definition. Preserve the existing explicit replacement contract by returning the CLI error and naming the reinstall action instead.
|
@clawsweeper re-review The current head removes automatic runtime-pin replacement entirely. Both P1 tag sites and the app retry are gone; explicit operator reinstall remains the only pin-replacement path. The PR body records the maintainer decision and fresh focused TypeScript/Swift proof, and states the installed-app proof gap. |
|
🦞👀 Re-review progress:
|
Include ea6bf83, which repairs the inherited ACP session metadata mock failure in PR CI. Runtime pin files are unchanged by this merge; the full PR candidate was reviewed against the exact merged main commit.
|
@clawsweeper re-review Please review current head 7e1e601. The runtime-pin patch is unchanged; this head merges the verified main fix for the inherited ACP fixture failure. The complete six-file PR candidate has fresh clean independent review, and the PR body records the failure, main repair, and proof. Saved pins still require explicit operator reinstall for replacement. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…ment (openclaw#160127) * fix(apps): stop clearing Gateway runtime pins and pin the app's Bun The macOS app enabled its LaunchAgent with an explicit `--runtime node`. Since runtime pins exist, that flag clears pin intent, so every launch-agent toggle wiped a runtime pinned with `openclaw gateway install --runtime-path`. Drop it: the service configuration owns runtime selection, fresh installs still default to Node, and forced reinstall keeps a pinned or recorded runtime. When the app's resolved CLI runs under an absolute Bun executable, both the macOS and Linux apps now pass `--runtime bun --runtime-path <bun>`, so a Bun-only app install pins its own Bun. * fix(apps): keep runtime pins when the macOS app enables its Gateway Leave runtime selection with the service installer. Remove both apps' Bun runtime-path overrides, which could replace an operator pin, while retaining the macOS fix that omits the pin-clearing explicit runtime node selection. Enabling preserves an installed service's pin. Disabling still uninstalls the LaunchAgent and removes the pin. CLI fallback on Bun-only hosts is separate. Validation: 59 focused native tests passed in an isolated test-helper run; SwiftFormat, docs formatting, and diff checks passed. Independent review of the complete candidate is scoped-clean for P0-P2. * fix(apps): recover an invalid runtime pin when the macOS app enables its Gateway Classify both CLI pin inspection and validation failures as runtime-pin-invalid in JSON while preserving the existing human errors and exit code 1. The macOS app keeps valid runtime pins, but retries an install once with --runtime node when the CLI reports that typed failure. Log successful repair, return retry failures, and leave unrelated failures unchanged. Validation: CLI output and response tests passed 19/19 in 23.11s wall; the install-output file passed 6 cases. Core typechecking, 60 focused native tests, SwiftFormat, oxfmt, and whitespace checks passed. Independent P0-P2 review of the complete candidate is scoped-clean. Both regressions failed before the fix. * fix(daemon): only flag definitely invalid runtime pins for app recovery Give a saved pin's changed service definition a dedicated error class. Only that inspection failure emits runtime-pin-invalid; transient IO/SQLite and other inspection failures remain untagged so the app preserves the pin and returns the error without resetting runtime selection. Keep the invalid executable classification and all human errors unchanged. Exercise the real pin reader with an IO-like state read failure and a changed saved definition. The transient-read regression fails before this fix. Validation: 10 focused tests passed in 97.32s wall (7 install-output cases and 3 pin-state cases), pnpm tsgo:core, oxfmt, and whitespace checks passed. Swift is unchanged; existing coverage rejects retries for untagged failures. * fix(macos): keep saved Gateway runtime pins without automatic replacement Automatic runtime retries could discard an operator pin after transient validation failures or a changed service definition. Preserve the existing explicit replacement contract by returning the CLI error and naming the reinstall action instead.
Related: #159431
What Problem This Solves
Enabling or refreshing the macOS Gateway passed
--runtime node, replacing an operator's saved runtime pin.User Impact
Enabling preserves a saved pin and leaves runtime selection with the CLI. If the pin cannot be read or validated, or its bound service definition has changed, enable fails with the CLI error. Pin replacement requires an explicit operator reinstall with
--runtimeor--runtime-path; the app never retries with a runtime override. Disabling still uninstalls the LaunchAgent and removes its pin.Why This Change Was Made
The maintainer decision is to preserve the existing explicit pin-replacement contract. The app now makes one install request without runtime-selection flags for every resolved CLI prefix, including Bun. The automatic retry, retry-only result tag, and dedicated tagging error were removed. Invalid-pin errors include the explicit reinstall instruction in the error message that the app displays. No pin schema or persistence contract changes.
Resolved ClawSweeper P1s from the prior head:
runtime-pin-invalidemission sites and the app retry, so filesystem or executable-probe failures cannot trigger automatic pin replacement.Bun-only fallback without a pin or recorded runtime remains separate work in #160189. Release-note context: macOS Gateway enable preserves saved runtime pins and returns actionable errors when explicit repair is needed;
CHANGELOG.mdis release-owned.Evidence
/usr/bin/time -p node scripts/run-vitest.mjs src/cli/daemon-cli/install.output.integration.test.ts src/daemon/runtime-pin-state.test.ts --maxWorkers=1: 10/10 passed across two files (one file in each routed shard), 209.88 seconds total wall including worker preparation/verification. CLI shard: 7/7, 51.49 seconds; SQLite pin-state shard: 3/3, 122.52 seconds. The persisted-state tests cover reopen, stale plans, definition mismatch, and explicit replacement.pnpm tsgo:corepassed.Config health-state write failed: Shared-state admission requires the host broker; all output and no-install assertions pass.13ee9d8b09d739cbf92f384222280ff77c205b10: production +8/-29 (net -21 lines); obsolete retry coverage removed.cd apps/macos && swift test --disable-sandbox --filter GatewayLaunchAgentManagerTests: 19 tests in one suite passed (0.186 seconds execution; 327.73 seconds build-and-test wall). The retained routing test covers managed CLI, Node, absolute Bun, and PATH Bun prefixes and checks enable sends no runtime override. No Keychain prompt occurred. This is intercepted app-boundary proof, not an installed-app enable/refresh run.config/tsconfig/oxlint.core.json, Swift source format/lint, andgit diff --checkpassed. An initial oxlint invocation using the build tsconfig timed out in unnecessary extension-artifact preparation; the supported core lint lane passed.scoped-clean, no accepted/actionable findings. The only subsequent source edit restored a blank line between test declarations.fc10ab5e19f8f8a59fadb42d973441dad2b95039at 2026-09-28 09:42 UTC: both prior P1s resolved, no actionable findings, and no before-merge blockers; installed-app proof is explicitly optional.36404370042ended with one root failure inchecks-node-changed-compact-small-15(job108870424123) and a failed aggregate gate: 133 jobs succeeded, 15 were cancelled, and 18 skipped. Ten ACP lifecycle tests failed because the session-meta mock lacksprepareAcpSessionControlRead, added to the manager by main commit1ac31be00c2(fix(acp): settle Stop without overwriting replacement sessions #160035). CI tested the PR merged into main4dbabc40f6fd; this PR does not change the ACP owner or fixture. Current main reproduced the same 10 failures; fixture-only fixea6bf83e821f4808e081f8ff1ffa30b34414edd7now supplies the two missing typed mock exports. Four focused files passed 136/136 tests in 117.63 seconds, with messaging test types, scoped lint/format, and independent autoreview passing. No CI job was rerun.7e1e601bc2aeb47ee18ae73fe35e8e28152c2cdf. All runtime-pin source, test, and documentation bytes are unchanged by the merge, so their focused proof remains valid. Fresh independent review of the complete six-file PR candidate against merged main764c3e39e2f004623f9351a5210e46503ccb6405isscoped-cleanthrough P2. ClawSweeper comment 5863854195, Revision 11, reviewed this exact head at 2026-09-28 10:24 UTC: Ready for maintainer review, no findings, Before merge: None. Current-head CI remains required before merge.36408205995, attempt 1, was cancelled afterchecks-node-changed-compact-large-21-1(job108882690710) failed onlysrc/security/install-policy.test.ts/ "kills forked policy command children on no-output timeout" at 10052 ms: the overall 10000 ms deadline fired instead of the no-output deadline. The original job log confirms the failure. The fixture writes output after publishing its PID; that output can refresh the reused idle timer and cancel the manually fired deadline. The owning fix is fix(update): updates and repair fail on Bun-only installs without Node #159431, commitc1b47addc718d78fa75634801de7cf8e040ee74c, not yet on main. This PR does not change the failing fixture or policy code. Peter authorized one failed-jobs rerun for that known cause; GitHub accepted it as attempt 2 on the unchanged head. Attempt 2 completed SUCCESS on the unchanged head at 2026-09-28 11:03 UTC. The requiredopenclaw/ci-gatebecame SUCCESS at 11:05:26 UTC. ClawSweeper Revision 12 reviewed this exact head at 10:49 UTC with no findings and no before-merge blockers. The latest completed main CI run36410497689succeeded, but the fixture remains unchanged on main. Native review guard and artifact validation passed for this exact head.