operate: a session of a pool is of its template's agent, not of its instance #96

Merged
mikluko merged 2 commits from pool-agent into main 2026-11-16 10:57:06 +00:00
Owner

Found in the first foreman-to-worker run on 0.9.0: the worker's pod (roomcity-worker-sa-wisp-sbd2z-…) mounts only the dolt Secret; the foreman's mounts claude too. The per-session Secret has GC_AGENT and GC_TEMPLATE among its keys; [agents.worker] is looked up by the first, which for a pool's session is the instance (sa-wisp-sbd2z), so it matched nothing, and goose had no OPENAI_API_KEY. The same name is what the registry, the rooms and the journal call the agent.

GC_TEMPLATE is the agent's name whatever the instance (and GC_AGENT's own for a named session, so the foreman is unchanged). operate takes it for [agents.*], the process check, always_on, tools, the Job's agent and the registry.

Test: a start with GC_AGENT=sa-wisp-sbd2z, GC_TEMPLATE=worker is the agent worker in the registry and the Job, and gets its tools.

Not seen on the cluster, only read: the values of GC_AGENT and GC_TEMPLATE (Secret values are not read here); that the Job is named for the agent follows from the mounts.

Found in the first foreman-to-worker run on 0.9.0: the worker's pod (`roomcity-worker-sa-wisp-sbd2z-…`) mounts only the `dolt` Secret; the foreman's mounts `claude` too. The per-session Secret has `GC_AGENT` and `GC_TEMPLATE` among its keys; `[agents.worker]` is looked up by the first, which for a pool's session is the instance (`sa-wisp-sbd2z`), so it matched nothing, and goose had no `OPENAI_API_KEY`. The same name is what the registry, the rooms and the journal call the agent. `GC_TEMPLATE` is the agent's name whatever the instance (and `GC_AGENT`'s own for a named session, so the foreman is unchanged). `operate` takes it for `[agents.*]`, the process check, `always_on`, `tools`, the Job's agent and the registry. Test: a start with `GC_AGENT=sa-wisp-sbd2z`, `GC_TEMPLATE=worker` is the agent `worker` in the registry and the Job, and gets its tools. Not seen on the cluster, only read: the values of `GC_AGENT` and `GC_TEMPLATE` (Secret values are not read here); that the Job is named for the agent follows from the mounts.
operate: a session of a pool is of its template's agent, not of its instance
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 1m6s
bb9de62908
GC_AGENT of a pool's session names the instance (sa-wisp-sbd2z), so
[agents.worker] matched nothing: the worker's pod got no kimi Secret and
goose failed to authenticate, and the registry, the rooms and the journal
named the agent by the bead's id. GC_TEMPLATE is the agent's name for
every instance, and GC_AGENT's own for a named session.

Assisted-By: Claude <noreply@anthropic.com>
Author
Owner

Read at bb9de62. Green here under -race, the new test five times with GOMAXPROCS=1.

The cluster agrees with the reading, without a Secret's value: gc's own log of that start says session=worker-sa-wisp-sbd2z template=worker, and the foreman's Job is recorded for the agent foreman, so a named session is unchanged.

One name everywhere: agentOf feeds the process check, always_on, the tools put in the pod, the Job's agent (its Secrets, and #95's annotations) and the registry; from the registry's Agent come the server's check of a tool at each call, the Matrix user, the room's title and the journal's lines. Nothing else reads GC_AGENT to decide anything; it stays among the marks gc is given back, as the instance, which is what gc needs.

Before it merges:

  1. Agent.Process's doc in internal/config/config.go still says the table's name is matched against "the agent's name as gc gives it in GC_AGENT". It is GC_TEMPLATE now, with GC_AGENT when gc sets none.
  2. Rebase over main: CHANGELOG.md conflicts with #94's ### Added.

Not proved anywhere yet: what GC_TEMPLATE is for a service of an imported pack (core.*, bd.dog), which the city keeps at none. If it differs from GC_AGENT there, a process = true pattern would have to follow it; say so in the README when a city first runs one.

Read at bb9de62. Green here under `-race`, the new test five times with `GOMAXPROCS=1`. The cluster agrees with the reading, without a Secret's value: gc's own log of that start says `session=worker-sa-wisp-sbd2z template=worker`, and the foreman's Job is recorded for the agent `foreman`, so a named session is unchanged. One name everywhere: `agentOf` feeds the process check, `always_on`, the tools put in the pod, the Job's agent (its Secrets, and #95's annotations) and the registry; from the registry's `Agent` come the server's check of a tool at each call, the Matrix user, the room's title and the journal's lines. Nothing else reads `GC_AGENT` to decide anything; it stays among the marks gc is given back, as the instance, which is what gc needs. Before it merges: 1. `Agent.Process`'s doc in `internal/config/config.go` still says the table's name is matched against "the agent's name as gc gives it in GC_AGENT". It is `GC_TEMPLATE` now, with `GC_AGENT` when gc sets none. 2. Rebase over main: CHANGELOG.md conflicts with #94's `### Added`. Not proved anywhere yet: what `GC_TEMPLATE` is for a service of an imported pack (`core.*`, `bd.dog`), which the city keeps at none. If it differs from `GC_AGENT` there, a `process = true` pattern would have to follow it; say so in the README when a city first runs one.
mikluko force-pushed pool-agent from bb9de62908
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 1m6s
to 64a0751cf5
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 15s
test / go (pull_request) Successful in 1m2s
2026-11-16 10:55:11 +00:00
Compare
mikluko deleted branch pool-agent 2026-11-16 10:57:07 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/roomcity!96
No description provided.