From 8126e0fffafa94f260b80fce273081e209772d22 Mon Sep 17 00:00:00 2001 From: atlas Date: Thu, 29 Oct 2026 03:17:16 +0100 Subject: [PATCH] mint a live agent's missing store identity from the renewal pass, and log the step a mint stopped at --- docs/swarm/README.md | 8 +- docs/swarm/credentials-reference.md | 2 +- swarm-controller/src/agent_identity.rs | 146 +++++++++++++++++++++---- swarm-controller/src/agent_renewal.rs | 64 +++++++++-- swarm-controller/src/jobq.rs | 105 +++++++++++++++++- 5 files changed, 286 insertions(+), 39 deletions(-) diff --git a/docs/swarm/README.md b/docs/swarm/README.md index c7c6f044..19e93411 100644 --- a/docs/swarm/README.md +++ b/docs/swarm/README.md @@ -59,9 +59,11 @@ the agent roster and their wanted state, and the job graph. Creating an agent from the swarm UI or `swarmctl agent create --hive ` — queues its SSO identity, forge user, config repo, store identity and matrix account, then sends the hive a deploy message. A new agent starts `paused`. A store identity -that fails to mint logs `swarm jobq: mint_agent_identity failed` with the agent -and the error, which the Grafana alert rule `hh-agent-identity-mint-failed` -fires on. The agent is still created, without a store identity. +that fails to mint logs `swarm jobq: mint_agent_identity failed` with the agent, +the step it stopped at and the error, which the Grafana alert rule +`hh-agent-identity-mint-failed` fires on. The agent is still created, without a +store identity, and the controller's five-minute credential pass mints one for +it as long as the agent isn't `Destroyed`. `services.hyperhive.deploy.swarm-controller.enable` runs it on this host; `singleHostSwarm` turns it on. **Otherwise off: set it on the one host that diff --git a/docs/swarm/credentials-reference.md b/docs/swarm/credentials-reference.md index 57d3134e..c0024fdc 100644 --- a/docs/swarm/credentials-reference.md +++ b/docs/swarm/credentials-reference.md @@ -27,7 +27,7 @@ the rest of the cell says how. | `swarm/controller/swarm-controller/forge/token` | the forge, once | `swarm-controller` | ❌ minted once; delete `/var/lib/forgejo/swarm-controller-token-name` in the forge container to mint a new one | ✅ re-read on a 401 | | `swarm/controller/swarm-controller/grafana/token` | `swarm-bao-grafana-controller-token` on Grafana's host | `swarm-controller` | ✅ every 10 minutes, when Grafana refuses it or none is stored | ✅ re-read on a 401 | | `swarm/controller/swarm-controller/forge/webhook-secret` | `swarm-controller`, at start, from its old `webhook-secret` file; a new one only when there is no file | `swarm-controller` | ❌ minted once; a rotated secret fails every delivery until the forge hooks are re-registered | ❌ read at start | -| `swarm/agents//bao-mtls` | the store's agent PKI mount (`deploy.bao.agentPkiMountPath`), at agent creation | `hive-c0re`, then the agent | ✅ re-issued every 5 minutes once past half its 7-day validity | ✅ the agent re-reads every 10 minutes; it renews only while its current leaf is valid | +| `swarm/agents//bao-mtls` | the store's agent PKI mount (`deploy.bao.agentPkiMountPath`), at agent creation, and by the renewal pass when none is stored | `hive-c0re`, then the agent | ✅ re-issued every 5 minutes once past half its 7-day validity; minted when none is stored, for agents not `Destroyed` | ✅ the agent re-reads every 10 minutes; it renews only while its current leaf is valid | | `swarm/agents//queue` | `swarm-controller`, at agent creation | the agent; the queue, log and metrics auth services | ✅ re-minted at 45 days; skipped for `Destroyed` agents, whose path is deleted | ✅ read on every reconnect; an open connection keeps the old secret for up to an hour; the log and metrics stores honour a replaced secret for up to `deploy.victorialogs.authVerdictTtl` and `deploy.victoriametrics.agentAuthVerdictTtl` (60 s by default) | | `swarm/agents//forge-token` | `swarm-controller`, at agent creation and every 5 minutes | the agent | ✅ when missing or no longer matching the forge | ✅ every 10 minutes | | `swarm/agents//forge/