openclaw - ✅(Solved) Fix openclaw gateway restart can return false failure after healthy systemd restart [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#66675Fetched 2026-04-15 06:25:03
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

openclaw gateway restart can return a false failure on Linux/systemd even when the gateway restarts successfully and is immediately healthy afterward.

Error Message

After running:

Root Cause

openclaw gateway restart can return a false failure on Linux/systemd even when the gateway restarts successfully and is immediately healthy afterward.

Fix Action

Workaround

For now, the reliable operator workaround is:

openclaw gateway restart
openclaw gateway status
openclaw gateway probe

and treat status / probe as authoritative if they are healthy, instead of trusting the restart exit code alone.

PR fix notes

PR #66685: Suppress expired exec approval followup warnings

Description (problem / solution / changelog)

Summary

Suppress exec approval followup warning logs when the approval id is already gone (unknown or expired approval id).

Why

During investigation of #66675, I repeatedly saw restart/reporting flows where the gateway came back healthy but log noise included:

  • exec approval followup dispatch failed
  • unknown or expired approval id

This patch does not claim to fully solve the false non-zero restart on its own, but it removes one clearly benign error path that can fire after approval lifecycle completion and muddy the operator signal.

OpenClaw already has isApprovalNotFoundError(...) for this exact class of benign approval lookup failure in other paths, so this makes followup dispatch handling consistent with the rest of the codebase.

Change

  • import and use isApprovalNotFoundError(...) in sendExecApprovalFollowupResult(...)
  • silently ignore approval-not-found followup dispatch errors
  • continue deduped warning logs for real failures like missing channel, transport errors, etc.

Test

Added targeted coverage in:

  • src/agents/bash-tools.exec-host-shared.test.ts

New assertion:

  • unknown or expired approval id does not emit a warning log

I also ran:

corepack pnpm vitest run src/agents/bash-tools.exec-host-shared.test.ts

and the targeted test file passes.

Issue

  • Closes #66675? not necessarily
  • Related to #66675

Changed files

  • src/agents/bash-tools.exec-host-shared.test.ts (modified, +15/-0)
  • src/agents/bash-tools.exec-host-shared.ts (modified, +4/-0)

Code Example

openclaw gateway restart

---

openclaw gateway restart
openclaw gateway status
openclaw gateway probe
RAW_BUFFERClick to expand / collapse

Summary

openclaw gateway restart can return a false failure on Linux/systemd even when the gateway restarts successfully and is immediately healthy afterward.

Environment

  • OpenClaw: 2026.4.12 and still reproducible after updating to 2026.4.14
  • Platform: Linux + systemd user service
  • Gateway bind: loopback 127.0.0.1:18789
  • Service command: /usr/bin/node /usr/lib/node_modules/openclaw/dist/index.js gateway --port 18789

Observed behavior

After running:

openclaw gateway restart

I can hit this pattern:

  • systemd stop/start succeeds
  • openclaw gateway status reports runtime running and RPC probe: ok
  • openclaw gateway probe reports connect ok / RPC ok
  • dashboard remains reachable
  • but the restart command itself still returns a non-zero / failure result

Observed error noise around the failures included:

  • exec approval followup dispatch failed
  • unknown or expired approval id
  • Session followup failed: gateway timeout after 60000ms

Why this looks like a false negative

After the reported restart failure, the gateway is healthy:

  • openclaw gateway status -> running, RPC ok
  • openclaw gateway probe -> reachable yes, connect ok, RPC ok
  • dashboard HTTP checks succeed

I also rebooted the host during investigation, upgraded the kernel, and re-verified the same general pattern on the healthy post-reboot install.

Narrowed code regions

I narrowed the likely reporting path to these areas in the current npm build:

  • dist/daemon-cli-87pputG1.js
    • runDaemonRestart(...)
  • dist/lifecycle-core-BZacBWkW.js
    • runServiceRestart(...)
  • dist/restart-health-CGx4SqG5.js
    • waitForGatewayHealthyRestart(...)
    • inspectGatewayRestart(...)
  • dist/bash-tools-CEAaYnEc.js
    • sendExecApprovalFollowupResult(...)
  • dist/server.impl-BbJvXoPb.js
    • approval resolution path returning unknown or expired approval id

Specific suspicion

There seem to be two overlapping signals:

  1. The CLI restart/post-restart path can throw hard on a post-restart health/reporting branch.
  2. The exec approval followup machinery appears to sometimes try to send a completion followup against an approval id that is already resolved/expired, producing:
    • exec approval followup dispatch failed
    • unknown or expired approval id

My working theory is that a successful restart is getting contaminated by a stale/expired exec approval followup path or adjacent post-restart reporting path, which causes the command to surface failure even though the service is healthy.

Workaround

For now, the reliable operator workaround is:

openclaw gateway restart
openclaw gateway status
openclaw gateway probe

and treat status / probe as authoritative if they are healthy, instead of trusting the restart exit code alone.

Additional note

I also confirmed that the systemd restart helper itself looks straightforward (systemctl --user restart ...) and the gateway comes back with a healthy runtime + probe, so this does not look like a real service restart failure.

If useful, I can help test a candidate patch or provide a more surgical repro if you want a build to try.

extent analysis

TL;DR

The openclaw gateway restart command may return a false failure due to a stale/expired exec approval followup path, despite the gateway restarting successfully.

Guidance

  • Investigate the waitForGatewayHealthyRestart and inspectGatewayRestart functions in dist/restart-health-CGx4SqG5.js to see if they are correctly handling the post-restart health check.
  • Verify that the sendExecApprovalFollowupResult function in dist/bash-tools-CEAaYnEc.js is not attempting to send a completion followup against an already resolved or expired approval ID.
  • Check the approval resolution path in dist/server.impl-BbJvXoPb.js to ensure it is correctly handling the unknown or expired approval id error.
  • Consider adding logging or debugging statements to the suspected code regions to gain more insight into the issue.

Example

No code snippet is provided as the issue is more related to the logic and functionality of the code rather than a specific syntax error.

Notes

The provided workaround of running openclaw gateway status and openclaw gateway probe after the restart command can be used to verify the gateway's health, but a more permanent fix should be investigated to prevent false failures.

Recommendation

Apply the workaround of running openclaw gateway status and openclaw gateway probe after the restart command, as it provides a reliable way to verify the gateway's health despite the false failure.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix openclaw gateway restart can return false failure after healthy systemd restart [1 pull requests, 1 participants]