Run the bot service as one launchd user agent on the Studio #9

Open
opened 2026-11-10 02:51:41 +00:00 by bryan · 1 comment
Owner

Problem / Motivation

The bot service that replaces Hermes's cron and Matrix gateway needs to be kept alive on the Studio. Pi Durable also needs to find its send command once hermes is gone.

Proposed behavior

One launchd user agent keeps the bot service running. That one service runs the clock, the Matrix bridge, and starts the bots Rex session. It is a user agent because jobs need the login session for Reminders and the Claude login.

Scope

In scope

  • A services module for the bot service, modelled on launchd.user.agents.pi-durable-sgg.
  • The service's metrics file read by node_exporter's textfile collector, and alert rules: service down, a bot's Pi down, an account not syncing, the clock silent.
  • Pi Durable's environment finding the bot service's command instead of hermes (modules/services/pi-durable.nix).

Out of scope

  • One launchd entry per job. Jobs are files the service reads, so adding one needs no rebuild.

Implementation hints

  • The fseventsd watchdog module is the model for metrics file plus "went silent" rule.
  • User agents start only after login, and no auto-login setting exists in this repository. What happens after a reboot needs deciding.
  • Service code: bryan/dotfiles-workspace#31.

Acceptance criteria

  • The service starts at login and restarts after being killed.
  • Stopping the service raises an alert by email.
  • Pi Durable's services resolve the send command.

Decision record: vault/decisions/2026-11-09-pi-as-primary-harness.md in bryan/dotfiles-workspace (commit 321ed03).

Parent: bryan/dotfiles-workspace#30.

Pieces

Each piece is one Pi session. The full breakdown and the loop's rules are in vault/plans/pi-primary-harness-work-breakdown.md in bryan/dotfiles-workspace.

  • N9.1 (nix-configs; Loop; rebuild batched): Service module: one launchd user agent, metrics directory, alert rules. Done when: merged; the host builds. Merged in 2ff3842 (#17); live 2026-11-10.
  • N9.2 (nix-configs; Loop; rebuild batched): Pi Durable's services find the bot service's command. Done when: merged; the host builds. Merged in 4cf9454 (#18): /run/current-system/sw/bin/pi-bots; live after the next update-system.
## Problem / Motivation The bot service that replaces Hermes's cron and Matrix gateway needs to be kept alive on the Studio. Pi Durable also needs to find its send command once `hermes` is gone. ## Proposed behavior One launchd user agent keeps the bot service running. That one service runs the clock, the Matrix bridge, and starts the `bots` Rex session. It is a user agent because jobs need the login session for Reminders and the Claude login. ## Scope ### In scope - A `services` module for the bot service, modelled on `launchd.user.agents.pi-durable-sgg`. - The service's metrics file read by node_exporter's textfile collector, and alert rules: service down, a bot's Pi down, an account not syncing, the clock silent. - Pi Durable's environment finding the bot service's command instead of `hermes` (`modules/services/pi-durable.nix`). ### Out of scope - One launchd entry per job. Jobs are files the service reads, so adding one needs no rebuild. ## Implementation hints - The `fseventsd` watchdog module is the model for metrics file plus "went silent" rule. - User agents start only after login, and no auto-login setting exists in this repository. What happens after a reboot needs deciding. - Service code: bryan/dotfiles-workspace#31. ## Acceptance criteria - [x] The service starts at login and restarts after being killed. - [x] Stopping the service raises an alert by email. - [ ] Pi Durable's services resolve the send command. Decision record: `vault/decisions/2026-11-09-pi-as-primary-harness.md` in `bryan/dotfiles-workspace` (commit 321ed03). Parent: bryan/dotfiles-workspace#30. ## Pieces Each piece is one Pi session. The full breakdown and the loop's rules are in `vault/plans/pi-primary-harness-work-breakdown.md` in `bryan/dotfiles-workspace`. - [x] **N9.1** (nix-configs; Loop; rebuild batched): Service module: one launchd user agent, metrics directory, alert rules. Done when: merged; the host builds. Merged in 2ff3842 (#17); live 2026-11-10. - [x] **N9.2** (nix-configs; Loop; rebuild batched): Pi Durable's services find the bot service's command. Done when: merged; the host builds. Merged in 4cf9454 (#18): `/run/current-system/sw/bin/pi-bots`; live after the next `update-system`.
Author
Owner

The "clock silent" rule from this issue's scope landed in #22 (c861ef1, with N10.4 on #10): PiBotsClockSilent (no clock tick for over a minute while the service runs, 5 min), plus PiBotsJobFailed, PiBotsJobWaiting and PiBotsJobFileUnusable. Merged and Studio builds; live after the next update-system.

The "clock silent" rule from this issue's scope landed in #22 (`c861ef1`, with N10.4 on #10): `PiBotsClockSilent` (no clock tick for over a minute while the service runs, 5 min), plus `PiBotsJobFailed`, `PiBotsJobWaiting` and `PiBotsJobFileUnusable`. Merged and Studio builds; live after the next `update-system`.
Sign in to join this conversation.
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bryan/nix-configs#9
No description provided.