Repository navigation
fix(daemon): clear self-referencing OPENCLAW_WRAPPER on macOS gateway install - #144053
Conversation
… install buildGatewayInstallPlan already cleared OPENCLAW_WRAPPER when it pointed at the generated Windows task script, but had no equivalent guard for macOS. When OPENCLAW_WRAPPER (via --wrapper or a persisted env var) points at the generated LaunchAgent env-wrapper script, resolveCliProgramArguments treats it as a custom wrapper and substitutes it for the Node runtime + entrypoint. prepareLaunchAgentProgramArguments then prepends another copy of the same wrapper, producing a self-referencing ProgramArguments array that exits immediately when launchd starts it (fixes openclaw#144001).
|
🦞👀 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 17, 2026, 12:13 AM ET / 04:13 UTC (Revision 3). ClawSweeper reviewWhat this changesPrevents macOS Gateway installation from selecting its generated environment launcher as a custom wrapper, with registered-command coverage for explicit, persisted, and legitimate custom wrappers. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v2026.9.4 still lack the macOS guard. No actionable patch defects were found, and the recorded native installation and upgrade observations address the earlier proof gap. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway installer turns CLI options and existing service settings into a runtime command and environment. The macOS service writer wraps that command in an environment loader before handing it to launchd. flowchart TD
A[CLI options and saved settings] --> B[Shared install planner]
B --> C{Generated launcher selected?}
C -->|Yes| D[Select runtime and Gateway entrypoint]
C -->|No| E[Preserve valid custom wrapper]
D --> F[macOS environment loader]
E --> F
F --> G[launchd starts Gateway]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -8, Tests +129. Total +121 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep generated-launcher rejection in the shared planner while preserving custom wrappers, private environment loading, and direct reinstall recovery. Do we have a high-confidence way to reproduce the issue? Yes, from source: selecting the generated macOS launcher through --wrapper or persisted OPENCLAW_WRAPPER produces the malformed command on current main. This review did not execute that failure. Is this the best way to solve the issue? Yes. Extending the existing generated-script guard repairs command construction at its shared owner without replacing the documented custom-wrapper contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c964f99a2444. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
The 3 failing checks are unrelated to this diff — confirmed from job logs, not just the base-rate table:
None touch On the requested native macOS proof: this session runs in a Linux sandbox with no macOS host, so I can't produce a real |
|
landpr-approve-admin-merge |
|
landpr-approve-admin-merge |
|
Thanks chelsealong! Proof: Isolated macOS installs recovered explicit and persisted generated-launcher paths. Repeat reinstall, genuine custom wrappers, authentication and environment retention passed. The published 2026.9.3 updater passed from a normal runtime definition plus the bad persisted wrapper value. It cannot identify an already-recursive definition; direct candidate reinstall is the proven recovery.
|
… install (openclaw#144053) Closes openclaw#144001 ## What Problem This Solves macOS Gateway reinstall fails when `OPENCLAW_WRAPPER` points to OpenClaw's generated environment launcher. ## User Impact Reinstall restores the runtime and Gateway entrypoint instead of nesting the launcher. Genuine custom wrappers still work. ## Why This Change Was Made The shared install planner rejects generated launchers before selecting runtime arguments and environment. This setting has one writer. Production code shrinks by eight lines. ## Evidence On isolated macOS services, `gateway install --force --runtime node --wrapper "$launcher"` produced duplicate arguments, exit 2 and no health before the fix; afterward, health returned 200. Persisted-input and repeat reinstall, fresh install, a genuine custom wrapper, authentication and environment retention passed. The unmodified published 2026.9.3 updater completed with a normal runtime definition plus the invalid persisted wrapper value. The installed candidate answered health and authenticated status. An already-recursive definition is unidentifiable to that old updater; direct candidate reinstall is the proven recovery. No package was published. The installer patch is unchanged from these native observations at `cebb120f`. ## Compatibility Windows generated-script rejection is unchanged. No new configuration or migration. ## Consumers Install, startup repair, Doctor and setup share the planner. ## Invalidation Existing service owners regenerate arguments and environment. ## Tests Registered-command cases fail on the original main implementation. After integrating main, 657 installer/update tests and 600 current catalog/release/inventory tests pass. Full build, type-aware preflight, formatting, both line limits, unused-file/export and architecture checks pass. Earlier CI run 35153572691 failed; the exact formatting repair from openclaw#150330 is included. New hosted checks must complete. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #144001
What Problem This Solves
macOS Gateway reinstall fails when
OPENCLAW_WRAPPERpoints to OpenClaw's generated environment launcher.User Impact
Reinstall restores the runtime and Gateway entrypoint instead of nesting the launcher. Genuine custom wrappers still work.
Why This Change Was Made
The shared install planner rejects generated launchers before selecting runtime arguments and environment. This setting has one writer. Production code shrinks by eight lines.
Evidence
On isolated macOS services,
gateway install --force --runtime node --wrapper "$launcher"produced duplicate arguments, exit 2 and no health before the fix; afterward, health returned 200. Persisted-input and repeat reinstall, fresh install, a genuine custom wrapper, authentication and environment retention passed.The unmodified published 2026.9.3 updater completed with a normal runtime definition plus the invalid persisted wrapper value. The installed candidate answered health and authenticated status. An already-recursive definition is unidentifiable to that old updater; direct candidate reinstall is the proven recovery. No package was published.
The installer patch is unchanged from these native observations at
cebb120f.Compatibility
Windows generated-script rejection is unchanged. No new configuration or migration.
Consumers
Install, startup repair, Doctor and setup share the planner.
Invalidation
Existing service owners regenerate arguments and environment.
Tests
Registered-command cases fail on the original main implementation. After integrating main, 657 installer/update tests and 600 current catalog/release/inventory tests pass. Full build, type-aware preflight, formatting, both line limits, unused-file/export and architecture checks pass.
Earlier CI run 35153572691 failed; the exact formatting repair from #150330 is included. New hosted checks must complete.