Type=notify systemd unit and the gateway tells systemd when it is really serving, proves its event loop is alive, and announces clean drains — with no new config.
There is no new config key, CLI flag, env var, or Python export. systemd sets
$NOTIFY_SOCKET for Type=notify units, and that alone switches the notifier on. Without it, the notifier task is never created.Quick Start
1
Define your agent as usual
2
Install the generated unit
Type=notify, NotifyAccess=main, and WatchdogSec=30, so systemctl start returns only once the gateway is accepting connections.3
Or hand-write the unit
How It Works
The notifier runs as a task on the gateway’s own event loop, so a wedged loop stops the pings.What the gateway sends
All of this is a no-op when
$NOTIFY_SOCKET is unset. Delivery is non-blocking and fail-open: a socket error never stalls or crashes the gateway. If the unit has no WatchdogSec, WATCHDOG=1 is never sent; READY=1, the pre-ready EXTEND_TIMEOUT_USEC, and STOPPING=1 still are.
Generated vs hand-written unit
Both units use the same three notify settings.- Generated
- Hand-written
~/.config/systemd/user/praisonai-bot.service (written by praisonai-bot gateway install):Type=simple and keep working. Re-run praisonai-bot gateway install to regenerate the unit with Type=notify.
Interaction with existing features
The systemd watchdog is externally enforced and complements the in-process safety nets.Troubleshooting
systemctl status stays at 'activating (start)'
systemctl status stays at 'activating (start)'
systemd has not received
READY=1. Check that ExecStart runs Python directly (required by NotifyAccess=main) and that the gateway actually reaches serving — a port bind failure or crash before uvicorn starts means readiness is never sent. After editing the unit, run systemctl --user daemon-reload.Service is killed after exactly WatchdogSec
Service is killed after exactly WatchdogSec
The gateway event loop is wedged and stopped sending
WATCHDOG=1. The journal shows a Watchdog timeout entry; enable the in-process Event-Loop Watchdog to get stack dumps that show where the loop is blocked.Running in a container
Running in a container
The container must receive
$NOTIFY_SOCKET and the socket itself — for example podman run --sdnotify=container, or an sd-notify-aware init in place of tini/dumb-init. Abstract-namespace sockets (NOTIFY_SOCKET=@name) are supported.Best Practices
No opt-out needed
No opt-out needed
Outside systemd the notifier never starts, so there is nothing to disable. Use
Type=simple in a hand-written unit only if you do not want readiness gating.Keep WatchdogSec at 30s or more
Keep WatchdogSec at 30s or more
Shorter deadlines can trip on long first-boot pauses and cause flaky restarts.
Pair Type=notify with RestartPreventExitStatus=78
Pair Type=notify with RestartPreventExitStatus=78
The watchdog pulls you out of wedges; the exit-code contract keeps you out of config-error crash loops.
Re-install the unit after upgrading
Re-install the unit after upgrading
An existing unit is not changed by upgrading the package. Run
praisonai-bot gateway install again to rewrite it with Type=notify.Related
Gateway Exit Codes
Exit 0 / 75 / 78 contract for supervisors
Event-Loop Watchdog
In-process wedge detection with stack dumps
Startup Watchdog
Guard the pre-loop startup window
24/7 Production Minimal
Minimal always-on deployment guide

