Skip to content

fix: avoid systemd-supervised gateway retry loop in owned launcher#700

Merged
ashione merged 1 commit intoValueCell-ai:mainfrom
ashione:fix/695-systemd
Mar 28, 2026
Merged

fix: avoid systemd-supervised gateway retry loop in owned launcher#700
ashione merged 1 commit intoValueCell-ai:mainfrom
ashione:fix/695-systemd

Conversation

@ashione
Copy link
Copy Markdown
Contributor

@ashione ashione commented Mar 27, 2026

Summary

  • In electron/gateway/config-sync.ts, strip systemd supervisor marker environment variables before spawning the gateway child process.
  • This prevents openclaw gateway from mis-detecting the owned ClawX child process as a supervised systemd instance and entering the 5s retry loop (already running under systemd).

Risk / Tradeoff

  • This change intentionally drops systemd hint env vars only in ClawX-owned gateway launches.
  • Risk: if external/system-managed invocation paths rely on these env vars for gateway behavior, those paths should continue to pass through direct CLI paths unchanged, so impact is scoped to spawned gateway from ClawX.
  • Existing behavior is still preserved when not launching from ClawX-owned context.

Tests

  • pnpm exec tsc -p tsconfig.json --noEmit
  • pnpm exec vitest run tests/unit/config-sync.test.ts

Notes

  • Added helper for sanitizer coverage:
    • stripSystemdSupervisorEnv.
  • Added unit tests in tests/unit/config-sync.test.ts to cover marker removal, unrelated-key preservation, and immutability.

Copilot AI review requested due to automatic review settings March 27, 2026 17:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents the ClawX-owned gateway child process from inheriting systemd “supervisor marker” environment variables, which can cause the openclaw gateway process to mis-detect itself as systemd-supervised and enter a retry loop.

Changes:

  • Added stripSystemdSupervisorEnv helper to remove systemd marker env vars before spawning the gateway process.
  • Updated gateway launch env construction to apply the sanitizer.
  • Added unit tests covering key removal, preservation of unrelated keys, and immutability.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
electron/gateway/config-sync.ts Introduces env sanitizer and applies it to the gateway fork environment.
tests/unit/config-sync.test.ts Adds unit coverage for the new env-sanitizing helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ashione ashione merged commit 514a6c4 into ValueCell-ai:main Mar 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants