swarm-controller: keep the known models in memory, and let the controller watch agent-inference
GET /api/models listed the agent-inference bucket on every request with keys(), which needs the nameless ephemeral consumer subject CONSUMER.CREATE.KV_agent-inference. The controller's NATS grant had that subject for the status, permissions and bash task buckets but not for this one, so NATS refused the create and the client waited out its timeout: the request hung every time. The controller now follows the bucket with a watch that replays each key's current value first, keeps each agent's models in memory beside the reported ones, and answers the request from there without reading the bucket. The grant adds the one create subject the watch needs, with a policy test like the other buckets'.
This commit is contained in:
parent
bceaf31f36
commit
519ed2f134
1 changed files with 184 additions and 44 deletions
|
|
@ -135,7 +135,11 @@ warning in its log, until the next `PUT` replaces it.
|
|||
any agent's stored settings (its model and its subagent models) and in the
|
||||
settings the agents reported running on, sorted. The swarm UI offers them in
|
||||
the model dropdown, so no model name lives in the UI. A swarm where no agent
|
||||
has either answers an empty list.
|
||||
has either answers an empty list. The controller keeps the list in memory: a
|
||||
watch on the `agent-inference` bucket follows every write and delete, and the
|
||||
agents' turn-state headers feed the reported side, so a request reads no bucket
|
||||
and answers at once. A restart refills the stored side from the watch within
|
||||
moments, and the reported side as each agent next publishes, within a minute.
|
||||
|
||||
An agent's own queue credential grants it
|
||||
`$JS.API.DIRECT.GET.KV_agent-inference.$KV.agent-inference.<agent>`, the
|
||||
|
|
|
|||
Loading…
Reference in a new issue