← Back to PRs

#23584: fix(daemon): improve gateway service detection to avoid false positives

by mohandshamada open 2026-02-22 13:20 View on GitHub →
gateway size: XS
## Summary - Improves `findExtraGatewayServices` to only flag services actually running gateway commands - Adds `isGatewayCommand` check that examines ExecStart command in service files - Prevents unrelated services (voice pipelines, custom daemons) from being flagged ## Problem The `findExtraGatewayServices` function was flagging **any** user-scoped systemd service containing "openclaw", "clawdbot", or "moltbot" as "gateway-like", including unrelated services like voice pipelines on custom ports. Worse, the cleanup hints suggested disabling/removing the **real gateway**, which would kill the running agent. ## Solution Added an `isGatewayCommand` check that ensures only services actually running gateway commands (e.g., "openclaw gateway", "clawdbot gateway") are flagged as extra gateway services. The check examines the ExecStart command in the service file and matches against known gateway command patterns: - `openclaw ... gateway` - `openclaw-gateway` - `clawdbot ... gateway` - `moltbot ... gateway` This prevents: - Voice pipelines on custom ports from being flagged - Any unrelated service mentioning "openclaw" from being flagged - Cleanup hints suggesting removal of the actual running gateway Fixes #23550 <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds `isGatewayCommand` function to prevent false positives when detecting extra gateway services, addressing an issue where any service mentioning "openclaw" was flagged as a gateway service. **Key issues found:** - The `isGatewayCommand` regex logic doesn't correctly parse macOS plist files. It attempts to extract `ExecStart` (Linux-only), then falls back to matching the entire file content, which can cause false positives when service labels contain "gateway" but commands don't. - Windows task detection doesn't use `isGatewayCommand`, leaving it vulnerable to the same false positives the PR aims to fix. <h3>Confidence Score: 2/5</h3> - This PR has logical errors that will cause it to not work correctly on macOS - The implementation has a critical flaw in the macOS code path where `isGatewayCommand` incorrectly handles plist files by matching against the entire XML content rather than parsing ProgramArguments. This defeats the purpose of the fix and can still produce false positives. Additionally, Windows task detection is inconsistent with the stated goal. - src/daemon/inspect.ts requires fixes to properly parse macOS plist files and add Windows task filtering <sub>Last reviewed commit: 688d7f4</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs