#13014: feat(infra): add systemd WatchdogSec integration
docs
gateway
size: S
Implements systemd WatchdogSec and Type=notify integration for OpenClaw. This allows systemd to monitor the gateway health and automatically restart it if it hangs.
Referencing GitHub Discussion #12026.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds systemd `Type=notify` / `WatchdogSec` integration by introducing `src/infra/systemd-notify.ts` (READY/WATCHDOG notifications via `NOTIFY_SOCKET`) and wiring it into gateway startup (`notifyReady()` in `src/gateway/server.impl.ts`) and the existing maintenance tick loop (`notifyWatchdog()` in `src/gateway/server-maintenance.ts`). It also adds docs with a sample unit file and new Vitest coverage.
Before merging, the new tests need to be made runnable: `src/infra/crypto-store.test.ts` currently imports a non-existent `./crypto-store.js`, and `src/infra/systemd-notify.ts` includes an unused `node:fs` import that is likely to trip CI lint/typecheck rules.
<h3>Confidence Score: 2/5</h3>
- This PR is not safe to merge as-is because CI is likely to fail due to a broken test import and an unused import.
- Core feature wiring is small and localized, but the added `crypto-store.test.ts` references a missing module (`./crypto-store.js`), which will fail module resolution, and `systemd-notify.ts` has an unused `fs` import that may fail lint/typecheck. Fixing these should make the PR much lower risk.
- src/infra/crypto-store.test.ts, src/infra/systemd-notify.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11974: [FEATURE] feat: integrate systemd WatchdogSec for gateway hang dete...
by mcaxtr · 2026-02-08
87.4%
#16016: fix: update systemd unit version on gateway restart
by jbold · 2026-02-14
77.8%
#12694: Devin/1770645191 add elizaos adapter
by latamapac · 2026-02-09
74.1%
#21212: fix: detect and manage systemd system services (rebased)
by growthringsadvisory · 2026-02-19
73.9%
#14259: fix(discord): add timeout to restart to prevent duplicate responses
by George5562 · 2026-02-11
73.7%
#10030: Guard network interface enumeration
by TheAxumite · 2026-02-06
73.7%
#20561: feat: add Sisyphus-style orchestration features
by dfggggx198601 · 2026-02-19
73.3%
#7892: Claude/setup agent firewall ww xsv
by starwreckntx · 2026-02-03
73.0%
#8876: Confirmaciones para equipo de IT
by m4xjunior · 2026-02-04
72.9%
#9036: fix: add systemd restart limits to prevent infinite crash-loops
by joetomasone · 2026-02-04
72.7%