Skip to content

[Bug]: LaunchAgent plist missing HTTP_PROXY/HTTPS_PROXY — gateway cannot reach Telegram API behind proxy #27228

@wanzhirsj-byte

Description

@wanzhirsj-byte

Summary

On macOS, when the system routes internet traffic through a local proxy (e.g., Clash Verge / mihomo on port 7897), the generated LaunchAgent plist does not include HTTP_PROXY / HTTPS_PROXY environment variables. This causes the gateway process to fail silently when connecting to external APIs (e.g., Telegram setMyCommands, polling).

Environment

  • macOS 15.4 (Darwin 25.2.0, arm64, Mac mini M4)
  • OpenClaw 2026.2.25
  • Node.js v24.13.0
  • Proxy: Clash Verge (mihomo), mixed port 7897
  • Install method: npm global

Steps to Reproduce

  1. Run macOS with a local proxy (e.g., Clash Verge on port 7897)
  2. Install OpenClaw and set up Telegram channel
  3. Run openclaw gateway install (generates the LaunchAgent plist)
  4. Start the gateway via launchd
  5. Gateway fails to connect to Telegram API — Network request for 'setMyCommands' failed!

Root Cause

LaunchAgent processes do not inherit the user's shell environment variables. The proxy is configured at the system/app level (Clash Verge sets system proxy), but launchd-managed processes bypass this entirely.

The generated plist at ~/Library/LaunchAgents/ai.openclaw.gateway.plist has an EnvironmentVariables dict but does not include HTTP_PROXY or HTTPS_PROXY.

DNS resolving to 198.18.0.x (Clash virtual IPs) confirms the system-level proxy is active, but the gateway process cannot use it without explicit env vars.

Workaround

Manually add to the plist EnvironmentVariables:

<key>HTTP_PROXY</key>
<string>http://127.0.0.1:7897</string>
<key>HTTPS_PROXY</key>
<string>http://127.0.0.1:7897</string>

Problem: Every openclaw gateway install --force or version upgrade overwrites the plist, requiring manual re-patching each time.

Suggested Fix

  1. During openclaw gateway install, detect if HTTP_PROXY / HTTPS_PROXY / ALL_PROXY are set in the current shell and propagate them into the generated plist.
  2. Or provide a config option (e.g., gateway.proxy) that gets written into the plist automatically.
  3. At minimum, document this gotcha for users behind proxies (especially common in China where proxies are near-universal).

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions