#!/bin/sh
set -eu
url="${1:?health URL required}"
# Personal memory is recoverable state, not part of the chat-serving path.
# Doctor reports its failure without taking the whole agent out of service.
supervisorctl -c /opt/agent/supervisord.conf status 2>/dev/null | awk '$1 != "hindsight" && $2 != "RUNNING" { bad=1 } END { exit bad }'
curl -fsS --max-time 4 "$url" >/dev/null
