Watch
0
0
Fork
You've already forked hyperhive
0

matrix daemon: stay up when the primary account is down and say why in the tools

This commit is contained in:
damocles 2026-11-28 02:37:21 +01:00 • committed by mara
commit 73ef63a5e5
2 changed files with 159 additions and 81 deletions

View file

@ -683,13 +683,14 @@ Without the path-trigger sibling
(`systemd.paths.hive-matrix-daemon`, `PathExistsGlob =
<this agent's state dir>/matrix-token*` — the trailing `*` also catches
a declared secondary token file like `matrix-token-ccc`), the daemon
would exit 0 quietly the first time it ran and the MCP would have no
daemon until the next restart. The `.path` unit makes the appearance
of the token re-fire the service so the daemon comes alive in the
would only notice a new token on its next retry. The `.path` unit makes the
appearance of the token re-fire the service so the daemon comes alive in the
same boot cycle as
provisioning. A token in the store changes no file, so a store-backed agent
also gets a timer that restarts the daemon five minutes after it last
exited. A running daemon re-lists its linked accounts in the store
provisioning. A daemon whose primary account has no token, or whose homeserver
is down, doesn't exit: it keeps serving the matrix tools, which answer with
why the account is down, and it tries the primary again every two minutes. A token in the store changes no
file, so that retry (and a restart) is how the daemon picks up one the swarm
minted. A running daemon re-lists its linked accounts in the store
every two minutes and, when the set changed, exits with status
75, which the unit's `RestartForceExitStatus` restarts. On the same
two-minute tick it tries again each secondary account that didn't come

View file

@ -112,10 +112,12 @@ directly over streamable-http on `services.hyperhive.agent.mcp.matrixHttpPort`
`{ type = "http"; url = ...; }`). Same shape as `hive-bash-daemon` and
the built-in `hyperhive` surface (`hive-mcp-http`) — claude reconnects
to the stable URL every turn instead of respawning a stdio child.
Silently exits when the primary account has no token yet; the
`systemd.paths.hive-matrix-daemon` watcher restarts it when a token file
appears, and, on an agent with a store, a timer restarts it while it's
down so it re-reads a token the swarm minted into the store.
When the primary account has no token yet, or the homeserver rejects it
or is down, the daemon stays up and serves the tools anyway: a call that
needs the account fails with `matrix account "<name>" is not up: <why>`,
and the daemon retries the account every two minutes until it joins. The
`systemd.paths.hive-matrix-daemon` watcher also restarts the daemon when a
token file appears, so a fresh token doesn't wait for the next retry.
**Sync protocol**: when the homeserver advertises sliding sync (MSC4186,
`org.matrix.simplified_msc3575` in `/versions`) the daemon uses it: one