| Filename | Latest commit message | Latest commit date |
|---|---|---|
Three follow-ups to argus's review of #5237: - A down secondary's retry runs `restore` under RESTORE_TIMEOUT (2 min). Tries run one per tick on one future, so a restore that never resolved held back every other down account's retries for good; a try that outlasts the timeout now counts as a failure like any other. - `client::build_and_restore` warns about a rejected token only for the primary, which exits right after. For a secondary it logs at debug: the retry loop already warns once per outage (`DownAccounts::failed` is news on the first failure and on a changed reason, and an account that came up starts afresh), so the extra warn repeated on every try. - `a_secondary_that_comes_up_late_does_not_wipe_the_todos` runs the late bring-up in a child process of the test binary with HIVE_AGENT_SOCKET pointed at the test's listener. In-process the variable was unset, so a wipe placed back in the bring-up path was a no-op and the test passed. New tests: a_second_rejection_in_a_row_does_not_warn_again (captured logs, alone in a child process since tracing caches callsite interest process-wide; a stub whoami answering M_UNKNOWN_TOKEN, the real build_and_restore), a_failure_after_the_account_came_up_is_news_again, and an_account_whose_restore_hangs_does_not_hold_back_the_others (paused time). |
||
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
hive-matrix-mcp
Per-agent matrix integration: a long-running daemon
(hive-matrix-daemon) that holds a matrix-sdk Client + sync loop per
configured account and serves the matrix tool surface (send_message,
send_dm, list_rooms, read_room, …) directly over streamable-http.
No stdio bridge, no per-turn respawn — claude reconnects to the same
stable URL every turn.
When to use it
Look here when changing matrix tool behaviour, multi-account handling,
or the incoming-event → todo/wake path. The daemon owns the whole
lifecycle: per-account bring-up (accounts.rs, client.rs), the sync
loop that sweeps invites/unread rooms into the harness's in-agent todo
socket (timeline.rs, wake.rs), and the MCP tool router itself
(mcp.rs).
Shape
One bin (hive-matrix-daemon, src/main.rs) built from the crate's
own lib (src/lib.rs):
accounts.rs— multi-account config + the account→Clientdispatch registry (mainis always the hive-internal primary; extras come fromHIVE_MATRIX_ACCOUNTS).client.rs— session restore, stale-token recovery, avatar sync, cross-signing bootstrap.timeline.rs/wake.rs— per-sync-callback invite/unread sweeps that push todos ontoHIVE_AGENT_SOCKET.handlers.rs— per-tool dispatch, returnsprotocol::DaemonResponse.mcp.rs— thermcptool router +serve_http, resolving each call's optionalaccountarg against the registry before calling intohandlers.paths.rs— per-agent path resolution (token file, matrix-sdk state dir, homeserver URL, accounts snapshot).