Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
The openclaw-weixin plugin's sidecar child process calls cleanStaleGatewayProcessesSync() during startup, which finds and kills the parent gateway process on port 18789, causing an infinite restart loop (exit code 1 → systemd restart → repeat every ~45s).
Steps to reproduce
- Install @tencent-weixin/openclaw-weixin plugin (tested v2.1.3 and v2.1.8)
- Enable it in plugins.allow in openclaw.json
- Start gateway: systemctl start openclaw-gateway
- Observe crash loop in journalctl -u openclaw-gateway -f
- Disable plugin → gateway stabilizes immediately (confirmed)
Expected behavior
Sidecar should detect it is running inside an active gateway and skip port bind + stale cleanup. cleanStaleGatewayProcessesSync should exclude the parent gateway PID.
Actual behavior
Sidecar child binds port 18789 → EADDRINUSE → calls triggerOpenClawRestart() → cleanStaleGatewayProcessesSync() kills parent gateway → process.exit(1) → systemd restarts → infinite loop.
OpenClaw version
2026.4.15 (041266a)
Operating system
Ubuntu 22.04
Install method
npm global
Model
minimax-portal/MiniMax-M2.7
Provider / routing chain
openclaw → minimax-portal → MiniMax
Additional provider/model setup details
No response
Logs, screenshots, and evidence
[gateway] ready (10 plugins: ..., openclaw-weixin, ...; 22.8s)
[gateway] starting channels and sidecars...
Gateway failed to start: another gateway instance is already listening on ws://127.0.0.1:18789
- pid 2676529 root: openclaw-gateway (127.0.0.1:18789)
{"subsystem":"restart"} killing 1 stale gateway process(es) before restart: 2676529
[gateway] service-mode: cleared 1 stale gateway pid(s) before bind on port 18789
Main process exited, code=exited, status=1/FAILURE
Source: dist/restart-stale-pids-HQYy2vGd.js — cleanStaleGatewayProcessesSync() uses lsof to find ALL openclaw processes on port 18789 and kills them, including the parent gateway.
Impact and severity
Affected: All users running openclaw-weixin plugin
Severity: High (gateway completely unusable, infinite crash loop)
Frequency: Always (100% reproducible)
Consequence: Gateway never stays running; all channels (Discord, Telegram, etc.) are unavailable
Additional information
- Tested with openclaw-weixin v2.1.3 and v2.1.8 — both affected
- Tested with OpenClaw 2026.4.14 and 2026.4.15 — both affected
- Workaround: disable openclaw-weixin plugin (plugins.entries.openclaw-weixin.enabled = false)
- The sidecar child process inherits the gateway binary name, so parsePidsFromLsofOutput() matches it as an "openclaw" process
- Suggested fix: cleanStaleGatewayProcessesSync should exclude process.kill(process.ppid) or accept an exclude PID list
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
The openclaw-weixin plugin's sidecar child process calls cleanStaleGatewayProcessesSync() during startup, which finds and kills the parent gateway process on port 18789, causing an infinite restart loop (exit code 1 → systemd restart → repeat every ~45s).
Steps to reproduce
Expected behavior
Sidecar should detect it is running inside an active gateway and skip port bind + stale cleanup. cleanStaleGatewayProcessesSync should exclude the parent gateway PID.
Actual behavior
Sidecar child binds port 18789 → EADDRINUSE → calls triggerOpenClawRestart() → cleanStaleGatewayProcessesSync() kills parent gateway → process.exit(1) → systemd restarts → infinite loop.
OpenClaw version
2026.4.15 (041266a)
Operating system
Ubuntu 22.04
Install method
npm global
Model
minimax-portal/MiniMax-M2.7
Provider / routing chain
openclaw → minimax-portal → MiniMax
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
Affected: All users running openclaw-weixin plugin
Severity: High (gateway completely unusable, infinite crash loop)
Frequency: Always (100% reproducible)
Consequence: Gateway never stays running; all channels (Discord, Telegram, etc.) are unavailable
Additional information