[AI-assisted] fix(gateway): recognize shell-wrapped LaunchAgent command#81847
[AI-assisted] fix(gateway): recognize shell-wrapped LaunchAgent command#81847IWhatsskill wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this draft PR overlaps the same shell-wrapped LaunchAgent gateway-status bug already covered by the canonical open PR at #81778, which is non-draft, has real macOS terminal proof, and has already been reviewed as proof-sufficient. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Use #81778 as the canonical fix path, then close the linked issue after that PR lands. Do we have a high-confidence way to reproduce the issue? Yes. Current main passes LaunchAgent Is this the best way to solve the issue? No for this PR as the merge path. The better solution is the already-open canonical PR, which covers the same bug with stronger proof and a smaller duplicate-review footprint. Security review: Security review cleared: The diff only changes local TypeScript service-audit parsing and tests; it adds no dependencies, workflows, secrets handling, install scripts, or command execution. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 1f45b37fe17c. |
Summary
gateway statuscan reportService command does not include the gateway subcommandfor macOS LaunchAgent commands wrapped as/bin/zsh -lc "... exec node .../dist/index.js gateway --port ...".Change Type
Scope
Linked Issue/PR
Real behavior proof
exec node .../dist/index.js gateway --port ...no longer producesgateway-command-missing.v22.16.0and pnpm11.1.0; local Windows checkout for targeted diff/format checks.gatewayoutside the actual OpenClaw argv.gateway, so/bin/zsh -lcstored the subcommand inside one shell payload string and triggered the false positive.Root Cause
hasGatewaySubcommandonly checked top-levelProgramArgumentsentries for an exactgatewaytoken.-cpayload./bin/zsh -lcwrappers remained opaque to the audit.Regression Test Plan
src/daemon/service-audit.test.tsexecsnode .../dist/index.js gateway --port ...must not producegateway-command-missing.User-visible / Behavior Changes
gateway statusno longer shows the misleading missing-gateway-subcommand service config issue for supported shell-wrapped LaunchAgent commands that execute the OpenClaw gateway.Diagram
N/A
Security Impact
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
v22.16.0, pnpm11.1.0/bin/zsh -lcSteps
programArgumentsshaped like/bin/zsh,-lc,exec node /opt/openclaw/dist/index.js gateway --port 18890.Expected
gateway-command-missingissue when the shell payload executes the OpenClaw gateway command.Actual
Evidence
Human Verification
gatewayoutside the OpenClaw argv still reportsgateway-command-missing.Review Conversations
Compatibility / Migration
Risks and Mitigations
-cwrappers are inspected, the payload is split into command segments, and each candidate segment must pass the existing OpenClaw gateway argv recognizer instead of a broad substring check.