Watch
0
0
Fork
You've already forked hyperhive
0

document the hive cut-off

This commit is contained in:
atlas 2026-11-16 22:44:27 +01:00 • committed by mara
commit b6dc46d315

View file

@ -42,6 +42,39 @@ controller's grant on `swarm/hives/+/forge/token`), then the controller host,
then the hives. A hive that starts before its token exists reads nothing, and
builds nothing, until the controller's next pass.
## A hive that leaves the roster
A hive dropped from `swarm.hives` keeps the credentials above until
swarm-controller cuts it off (`forge::hive_cutoff`). The roster is the
`SWARM_CONTROLLER_HIVES` env var, read at start, so a removal takes effect at
the next controller start. On every pass, swarm-controller cuts off each hive
that has a forge account with the hive email, or a cert-auth role
`hive-<hive>`, and isn't in the roster. A role named `hive-agent-<agent>`
belongs to an agent and never matches.
For each such hive, in this order:
1. delete its `swarm-hive` forge token,
2. remove its account from the `agent-configs/hives` team,
3. delete the store secret `swarm/hives/<hive>/forge/token`,
4. delete the cert-auth role `hive-<hive>`.
The role goes last because it marks that work remains: a step that fails
leaves the role, and the next pass runs every step again. A step that finds
nothing to remove does nothing, so a finished hive costs a few reads per pass.
The pass logs one `hive is not in the roster: its credentials are revoked` line
per hive with what it removed, and a warning for a hive whose cut-off failed.
The forge account stays, so a hive put back in the roster gets its token and
team seat from the pass above and its role from the store access
swarm-controller writes at start.
Nothing happens when the roster didn't load. An unset or unparseable
`SWARM_CONTROLLER_HIVES`, and a roster with no hive, read the same as a removal of every
hive, so the controller logs an error at start and skips the
cut-off. The attic pull token and the OIDC client secret under
`swarm/hives/<hive>/` stay, as does the forge account itself.
## Per-agent forge accounts
Each agent gets its own Forgejo user and access token. swarm-controller