Skip to content

[Bug]: exec tool does not inherit gateway's environment variables (launchd) #40179

@tannensj-stack

Description

@tannensj-stack

Bug type

Regression (worked before, now fails)

Summary

The exec tool does not properly inherit environment variables set in the launchd plist. Even after a full system reboot, exec commands receive stale/old environment variables instead of the current gateway process environment.

Steps to reproduce

  1. Add a new environment variable (e.g., OP_SERVICE_ACCOUNT_TOKEN) to the launchd plist
  2. Reload the service: launchctl bootout / launchctl bootstrap
  3. Verify launchd has the correct environment: launchctl print gui/$(id -u)/ai.openclaw.gateway
  4. Use the exec tool to check the environment variable

Expected behavior

The exec tool should see the same environment variables that launchd loaded into the gateway process.

Actual behavior

The exec tool sees an old/stale environment variable value, even though launchctl print shows the correct value.

OpenClaw version

2026.3.7

Operating system

macOS 26.3 (arm64)

Install method

v22.22.0, LaunchAgent (launchd)

Logs, screenshots, and evidence

My exec env token hash: d5a7584a5b771db0
Launchd token hash: e4707cd640c7f60b (correct)
Zshrc token hash: e4707cd640c7f60b (correct)
Workaround

source ~/.zshrc && <command>

Impact and severity

1Password CLI integration fails. Any tool relying on plist environment variables will fail.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now failsstaleMarked 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