Skip to content

fix(daemon): stabilize LaunchAgent restart and proxy env passthrough#27276

Merged
gumadeiras merged 4 commits intoopenclaw:mainfrom
frankekn:fix/launchagent-stability-proxy-env
Feb 26, 2026
Merged

fix(daemon): stabilize LaunchAgent restart and proxy env passthrough#27276
gumadeiras merged 4 commits intoopenclaw:mainfrom
frankekn:fix/launchagent-stability-proxy-env

Conversation

@frankekn
Copy link
Copy Markdown
Contributor

Summary

  • forward proxy-related env vars into service environments (HTTP_PROXY/HTTPS_PROXY/NO_PROXY/ALL_PROXY + lowercase forms)
  • change LaunchAgent plist keepalive policy to crash-only with ThrottleInterval=5
  • harden launchd restart flow to print -> bootout -> wait old pid exit -> bootstrap -> kickstart
  • add regression coverage for proxy env passthrough, LaunchAgent plist policy, and restart command ordering

Testing

  • bunx vitest run --config vitest.unit.config.ts src/daemon/service-env.test.ts src/daemon/launchd.test.ts
  • pnpm check

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR stabilizes the LaunchAgent restart flow and adds proxy environment variable passthrough to service environments.

Key improvements:

  • Changed LaunchAgent KeepAlive policy from always-on to crash-only (SuccessfulExit=false) with 5-second ThrottleInterval to prevent restart loops when the service exits cleanly
  • Hardened restart flow from simple kickstart -k to explicit print -> bootout -> wait for pid exit -> bootstrap -> kickstart sequence, preventing race conditions where a new instance starts before the old one fully terminates
  • Added proxy environment variable forwarding (HTTP_PROXY, HTTPS_PROXY, NO_PROXY, ALL_PROXY and lowercase variants) to both gateway and node service environments, enabling services to work behind corporate proxies
  • Added comprehensive test coverage for all changes including plist policy verification, restart command ordering, and proxy env passthrough

Implementation quality:

  • The waitForPidExit helper polls with 200ms interval up to 10 second timeout, using process.kill(pid, 0) signal to check process existence
  • Error handling is defensive and appropriate for service management context
  • All changes are backward-compatible and follow existing patterns

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The implementation is solid with comprehensive test coverage, addresses real stability issues (crash-loop prevention and restart race conditions), and includes defensive error handling. All changes are well-scoped to daemon service management and follow established patterns. The proxy environment forwarding is a straightforward feature addition with proper test coverage.
  • No files require special attention

Last reviewed commit: 90578e5

@gumadeiras gumadeiras self-assigned this Feb 26, 2026
@gumadeiras gumadeiras force-pushed the fix/launchagent-stability-proxy-env branch from 38f8b92 to b08797a Compare February 26, 2026 07:40
@gumadeiras gumadeiras merged commit b975711 into openclaw:main Feb 26, 2026
9 checks passed
@gumadeiras
Copy link
Copy Markdown
Member

Merged via squash.

Thanks @frankekn!

steipete pushed a commit that referenced this pull request Feb 26, 2026
…27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
execute008 pushed a commit to execute008/openclaw that referenced this pull request Feb 27, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vincentkoc pushed a commit to Sid-Qin/openclaw that referenced this pull request Feb 28, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vincentkoc pushed a commit to rylena/rylen-openclaw that referenced this pull request Feb 28, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
steipete pushed a commit to Sid-Qin/openclaw that referenced this pull request Mar 2, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
robertchang-ga pushed a commit to robertchang-ga/openclaw that referenced this pull request Mar 2, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
dorgonman pushed a commit to kanohorizonia/openclaw that referenced this pull request Mar 3, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
thebenjaminlee pushed a commit to escape-velocity-ventures/openclaw that referenced this pull request Mar 7, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
john-ver pushed a commit to apmcoin/apmclaw that referenced this pull request Mar 9, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 12, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
alexey-pelykh added a commit to remoteclaw/remoteclaw that referenced this pull request Mar 12, 2026
…penclaw#27276) (#1077)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a


Reviewed-by: @gumadeiras

Co-authored-by: Frank Yang <[email protected]>
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
…penclaw#27276)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: b08797a
Co-authored-by: frankekn <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants