remove vestigial agent-ports.json tcp web-port map

This commit is contained in:
damocles 2026-06-22 11:59:05 +02:00
commit ad6b39b425
7 changed files with 33 additions and 209 deletions

View file

@ -120,36 +120,19 @@ idempotent — skips the rename when content is unchanged. Failed reloads
are retried automatically on subsequent poll ticks via
`gateway_nginx::reload_if_pending`.
## Agent port map (`agent-ports.json`)
## TCP loopback fallback
`/var/lib/hyperhive/run/agent-ports.json` is a flat JSON object keyed by
logical agent name → TCP web port:
While an agent's unix-socket marker is absent, the gateway routes its
`/agent/<name>/` traffic to a TCP loopback upstream in `agents.conf`. The
port is derived on the fly from `lifecycle::agent_web_port(name)` — a pure
FNV-1a hash of the name, reproducible from the name alone, no name
special-cased (so no on-disk port map is needed). Once the agent binds its
unix socket — every agent does, via `HIVE_WEB_SOCKET` — the gateway
switches to the socket upstream from `agent-sockets.json`. The root agent's
UI is routed at `/agent/root/`.
```json
{
"iris": 8178,
"atlas": 8304,
"argus": 8267,
"damocles": 8549
}
```
Written alongside `agents.conf` on every topology change. Ports come from
`lifecycle::agent_web_port(name)` — a pure FNV-1a hash of the name,
reproducible from the name alone. Every agent gets an entry — no name is
special-cased. Note this TCP map is now a fallback the gateway no longer
reaches: all agents bind a unix-socket web UI (`HIVE_WEB_SOCKET`) and the
gateway routes via `agent-sockets.json`, picking the socket upstream
whenever one exists. The root agent's UI is routed at `/agent/root/`.
The file doubles as a human-readable audit artifact — `cat agent-ports.json`
shows every registered sub-agent and its deterministic port assignment. TCP
loopback upstreams in `agents.conf` reference these ports for agents that
haven't opted into unix-socket mode yet.
Both `agent-ports.json` and `agents.conf` use atomic `<path>.tmp` +
`rename()` writes so a crashing c0re process never leaves a partial or
unparseable file behind.
`agents.conf` uses atomic `<path>.tmp` + `rename()` writes so a crashing
c0re process never leaves a partial or unparseable file behind.
## Dashboard link shape (gateway vs direct)