hive-subagent-mcp: check subagent models against the swarm's subagent_models
A `start` or `continue` naming a `model` now reads this agent's key in the `agent-inference` bucket and, when `subagent_models` is set, checks the model against that list instead of HIVE_AVAILABLE_MODELS (agent.nix `availableModels`). An unset field, an absent key or an absent bucket keeps today's check. A read that fails or takes over 2 s falls back to HIVE_AVAILABLE_MODELS with a warning, so a subagent start never waits on the queue. A call without a `model` is not checked and does not read. The read uses the agent's own queue credential through swarm_term's connect, and the one direct-get subject the agent is granted in that bucket. The refusal names the list and that it came from the swarm. Refs #5034 (S5)
This commit is contained in:
parent
971426a1c0
commit
90e6b984eb
9 changed files with 394 additions and 46 deletions
|
|
@ -16,8 +16,11 @@ swarmctl agent inference clear iris
|
|||
- `set` changes only the flags you pass; the other fields keep what's
|
||||
stored. A hive must declare the agent.
|
||||
- `--effort` is one of `low`, `medium`, `high`, `xhigh`, `max`.
|
||||
- `--subagent-models` takes a comma-separated list. It's stored and shown,
|
||||
but agents don't apply it yet.
|
||||
- `--subagent-models` takes a comma-separated list. It replaces the
|
||||
agent's `availableModels` as the models its subagent `start` and
|
||||
`continue` calls may name, read on each call
|
||||
([`subagent.md`](../tools/subagent.md#which-models-a-subagent-may-run-on)).
|
||||
The web UI's model picker doesn't use it.
|
||||
- `get` shows each field, naming the unset ones.
|
||||
- `clear` removes every field; the agent goes back to its own values.
|
||||
|
||||
|
|
@ -65,4 +68,8 @@ The harness (`hive-agent`'s `swarm_inference`) applies a set field to the
|
|||
in-memory model or effort without writing `hyperhive-model` or
|
||||
`hyperhive-effort`, which keep the agent's own value.
|
||||
|
||||
The subagent daemon (`hive-subagent-mcp`'s `swarm_models`) reads
|
||||
`subagent_models` with the same direct get, under the same credential, on
|
||||
each `start` or `continue` that names a model.
|
||||
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -307,6 +307,28 @@ agent that needs a stable or non-default port.
|
|||
Own systemd unit, defined alongside the other per-agent MCP daemons in
|
||||
`nix/agent-modules/mcp.nix`.
|
||||
|
||||
## Which models a subagent may run on
|
||||
|
||||
The daemon refuses a `start` or `continue` that names a `model` outside the
|
||||
agent's list before anything spawns, and the error names the list and where
|
||||
it came from. One without a `model` runs on claude's own default, which the
|
||||
daemon doesn't check. The list is:
|
||||
|
||||
- the swarm's `subagent_models` for this agent, when it sets one
|
||||
([`inference.md`](../swarm/inference.md)). It replaces the agent's own
|
||||
list, so it can name models that list leaves out.
|
||||
- otherwise `services.hyperhive.agent.availableModels`, which reaches the
|
||||
daemon as `HIVE_AVAILABLE_MODELS`. An empty list restricts nothing.
|
||||
|
||||
The daemon reads the swarm's value on each such call, so a change applies
|
||||
to the next one. When the read fails, or doesn't answer within 2 seconds,
|
||||
the daemon logs a warning and checks against `availableModels`. The same
|
||||
happens until the daemon's first connection to the swarm queue succeeds.
|
||||
The match ignores case. On an ACP agent the names are the agent's own, such
|
||||
as `<provider>/<model>` on `opencode`.
|
||||
|
||||
The web UI's model picker still offers `availableModels`.
|
||||
|
||||
## Runtime
|
||||
|
||||
A subagent runs on its parent agent's runtime
|
||||
|
|
|
|||
Loading…
Reference in a new issue