Watch
0
0
Fork
You've already forked hyperhive
0

swarm: list subagents from their published run state

The subagents list reads each subagent's status from the subagent-status
bucket and reports its state, when it began and the exit status. A subagent
with no status keeps the newest-row lookup, so an older daemon lists as before.
The swarm UI uses the state when there is one and the row-age guess otherwise.
This commit is contained in:
iris 2026-11-15 14:51:37 +01:00 • committed by mara
commit e9bc28fe2f

View file

@ -565,13 +565,21 @@ The agent's subagent daemon publishes each subagent's terminal rows on
into a stream named `term-sub-<agent>` that swarm-controller creates for every
declared agent. The stream keeps rows for 24 hours. swarm-controller serves the list as
`GET /api/agents/<name>/subagents`, the subagents named by the subjects in that
stream, each with `last_row_unix`, the stream's publish time of its newest row,
or `null` when that row isn't read within two seconds. Each row also carries
the `Swarm-Model` and `Swarm-Effort` message headers, the model and effort the
subagent runs with, and the list returns them from the newest row as
`model` and `effort`. A subagent on the default model has no `Swarm-Model`
header and lists `model: null`; every row has the headers, so a subagent that
runs past the 24-hour window still shows them. The lookups run
stream. The daemon also publishes whether each subagent is running, one key per
subagent in the `subagent-status` bucket. A subagent with such a status gets its
`state` (`running`, `finished`, or `stale` once the daemon hasn't refreshed a
running status for three minutes), `since_unix`, `exit`, and the `model` and
`effort` from the status. The swarm UI shows the state as it is.
A subagent with no status, as from an older daemon, gets
`last_row_unix`, the stream's publish time of its newest row, or `null` when
that row isn't read within two seconds, and `state: null`. The swarm UI then
guesses from that time: a row within 15 minutes counts as running. Each row
also carries the `Swarm-Model` and `Swarm-Effort` message headers, the model
and effort the subagent runs with, and the list returns them from the newest
row as `model` and `effort`. A subagent on the default model has no
`Swarm-Model` header and lists `model: null`; every row has the headers, so a
subagent that runs past the 24-hour window still shows them. The lookups run
concurrently, sixteen at a time, so the list waits at most two seconds for
each sixteen subagents.
swarm-controller also relays one subagent's rows as SSE on