Files
openclaw/src/daemon
Miorbnli 5e1e70e423 fix(systemd): clear start-limit latch before gateway start (#116178)
* fix(systemd): clear start-limit latch before gateway start

systemd latches a unit into failed/start-limit-hit after a crash loop,
then refuses systemctl start until reset-failed clears the latch. The
reset-failed step only ran for the restart action, so the natural
recovery command `openclaw gateway start` failed on a crash-looped
gateway while `openclaw gateway restart` recovered it.

Run reset-failed before both start and restart (stop is unchanged),
mirroring launchd's startLaunchAgent which calls launchctl enable before
kickstart. reset-failed is idempotent and a no-op on a healthy unit.

* test(systemd): cover start-limit latch clearing on system-scope start

Mirrors the existing system-scope restart test: when startSystemdService
targets a system unit as root, it must emit reset-failed before start so
a crash-looped gateway recovers via `openclaw gateway start` too.

* test(systemd): assert healthy start tolerates reset-failed no-op

reset-failed is idempotent on a non-failed unit (systemd returns success
without changing unit state), so prepending it to start cannot regress a
healthy gateway. Covers the merge-risk concern that every start now
depends on an extra reset-failed call.

* test(systemd): cover reset failure and stop controls

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-30 12:47:56 +08:00
..