Skip to content

fix(lore-0027): count a planned facilitator stop as a success - #163

Merged
karczuRF merged 1 commit into
developfrom
lore-0027-planned-stop-not-failure
Nov 9, 2026
Merged

karczuRF merged 1 commit into
developfrom
lore-0027-planned-stop-not-failure

Conversation

@karczuRF

@karczuRF karczuRF commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Every planned stop of x402@production (a deploy, a drain, systemctl stop) ended failed and counted facilitator_failures_total. Since the alarms went live on 2026-11-09, every deploy would fire a false facilitator-failed. Task 0027.

What happens

  1. ExecStop (docker compose stop facilitator) stops the container cleanly, with exit 0.
  2. systemd then signals the docker compose up that is still exiting, and Compose answers a signal with 130.
  3. 130 isn't a success for systemd, so the unit ends failed (Result: exit-code).
  4. ExecStopPost=x402-host-probe stopped sees SERVICE_RESULT=exit-code and writes facilitator_failures_total 1.

The evidence

  • In 0027's drill on 2026-11-09, systemctl stop x402@production at 13:26:45 ended failed: ExecStart … (code=exited, status=130), ExecStop … status=0/SUCCESS. When the agent started again, facilitator-failed fired at 13:46:53.
  • facilitator_failures_total also has a point at 2026-11-06 13:37, the third deploy's restart.

The fix

  • SuccessExitStatus=130 in deploy/systemd/x402@.service, with a comment. A planned stop now ends inactive, SERVICE_RESULT is success, and the hook writes nothing.
  • Crashes still count. The facilitator exits 0 or 1 itself (server.ts). The watchdog stops a hung container with docker stop --time 10, which ends 137. A drain past TimeoutStopSec ends in timeout, and a failed start in exit-code with another status.
  • Test: deploy/test/units.test.ts requires SuccessExitStatus=130 on x402@. Removing the line fails it (1 failed, 31 passed).
  • Docs: the runbook's watchdog section and docs/monitoring.md's facilitator-failed say that a planned stop is a success. 0027 gets a history entry.

The other compose up units (x402-db-testnet@, x402-openbao, x402-tunnel@) probably also end failed on a stop. They don't feed this alarm, so they're left as they are.

To go live

The playbook installs the unit from deploy/production, so this needs the next promotion, then a playbook run (daemon-reload). It takes effect at the next stop of the unit. Until then, a deploy fires facilitator-failed once. Expect it and say so in the channel. The server side is in Stan's lane, so a review from him is welcome.

After ExecStop, systemd signals the docker compose up that is still
exiting, and Compose answers with 130, so every deploy, drain and
systemctl stop left x402@production failed and counted
facilitator_failures_total. 0027's drill showed it: facilitator-failed
fired for the drill's own stop. The unit now lists 130 in
SuccessExitStatus. The facilitator exits 0 or 1 itself, and the
watchdog's kill of a hung process ends 137, so crashes still count.
@karczuRF
karczuRF merged commit 1c1e269 into develop Nov 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants