server: dispatch, wait, result, claim and done, the tools that hand work between sessions #90

Merged
mikluko merged 3 commits from room-work into main 2026-11-16 10:40:36 +00:00
Owner

The server's side of the four tools of spec-bb1.40, on main (replaces #87, which stood on #86).

  • Proto: HostService.Dispatch, Wait, Result, Claim, Done (Result is the foreman's read of what done stored, closed or not) (the shape proposed to roomcity-5e, who adds the host's side to the room server).
  • internal/gcwork: each tool as gc's command (sling <pool> --stdin --json, session wait --on-beads, hook --claim --drain-ack --json then bd show --json, bd update --notes=, bd close, runtime drain-ack), tested against a gc stub script. The claimed task is a session mark, so done(result) takes nothing else; a failed close leaves the task claimed and does not drain.
  • gchandler.Handler.Exec: gc run as a session with the identity the server kept of its start; Run shares the runner.
  • [agents.<name>] tools, checked at the server per call (PermissionDenied otherwise), and passed to the pod as ROOMCITY_ROOM_TOOLS for the host to register.

Shapes read from gc's source, not run: that gc session wait takes the session from GC_SESSION_ID (it does, cmd_wait.go) and that bd show --json prints a list of beads. The sandbox run shows them.

The server's side of the four tools of spec-bb1.40, on main (replaces #87, which stood on #86). - Proto: `HostService.Dispatch`, `Wait`, `Result`, `Claim`, `Done` (`Result` is the foreman's read of what `done` stored, closed or not) (the shape proposed to roomcity-5e, who adds the host's side to the `room` server). - `internal/gcwork`: each tool as gc's command (`sling <pool> --stdin --json`, `session wait --on-beads`, `hook --claim --drain-ack --json` then `bd show --json`, `bd update --notes=`, `bd close`, `runtime drain-ack`), tested against a gc stub script. The claimed task is a session mark, so `done(result)` takes nothing else; a failed close leaves the task claimed and does not drain. - `gchandler.Handler.Exec`: gc run as a session with the identity the server kept of its start; `Run` shares the runner. - `[agents.<name>] tools`, checked at the server per call (PermissionDenied otherwise), and passed to the pod as `ROOMCITY_ROOM_TOOLS` for the host to register. Shapes read from gc's source, not run: that `gc session wait` takes the session from `GC_SESSION_ID` (it does, cmd_wait.go) and that `bd show --json` prints a list of beads. The sandbox run shows them.
HostService gets the four calls. gcwork is the one place that turns each
into gc's commands, with the identity the server kept of the session's
start (gchandler.Handler.Exec, which Run now shares); a claimed task is
the session's mark, so done needs no argument but the result. Which tools
a session has is the agent's `tools` in roomcity.toml; the server refuses
the others whatever the host registers.

The task goes to sling on standard input and the result is --notes=<text>,
so no word of either is read as a flag.

Assisted-By: Claude <noreply@anthropic.com>
server: result, the foreman's read of what a worker's done stored
Some checks failed
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 2m7s
test / changelog (pull_request) Failing after 6s
bf1869a164
After wait the foreman is nudged that the task closed, and would have had
to read the answer with gc bd show, which asks the owner. Result says
whether the task is closed, its state, and the notes done stored; before
the close it says so, not an empty result. Read-only, for the agents whose
tools list it.

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

Read at bf1869a: the suite passes here under -race, gcwork, server and gchandler five times with GOMAXPROCS=1. The shape holds: each tool is gc's own command run as the session with the server's record of who it is, the task goes to gc on standard input so that no word of it is a flag, a claimed task is the session's mark, and a close that fails leaves it claimed and does not drain.

Two things before it merges.

  1. A task's id from the agent is put on gc's command line as it comes. In Result it is a positional argument, gc bd show <id> --json, and an id that begins with a dash is a flag to bd; in Wait it is the value of --on-beads. A session has the whole of gc through the stand-in anyway, so this gives it nothing new, but the tools are the bounded way and should not carry flags: refuse an id that is not the shape of a bead's id, with a line in the test.

  2. The CHANGELOG's entry announces the server's side of tools no agent has yet: the host's side is roomcity-5e's and comes after. As with Send (#74, #80), leave the entry to the pull request that gives an agent the tools, where it can say what a foreman and a worker do with them.

It stays out of main until the release with attach is cut, so that it does not go out half made; I merge it right after.

Not run against a real gc, as the description says: what gc sling --stdin --json and bd show --json print is read from the source. The sandbox's run is where that is seen.

Read at bf1869a: the suite passes here under `-race`, gcwork, server and gchandler five times with `GOMAXPROCS=1`. The shape holds: each tool is gc's own command run as the session with the server's record of who it is, the task goes to gc on standard input so that no word of it is a flag, a claimed task is the session's mark, and a close that fails leaves it claimed and does not drain. Two things before it merges. 1. A task's id from the agent is put on gc's command line as it comes. In `Result` it is a positional argument, `gc bd show <id> --json`, and an id that begins with a dash is a flag to bd; in `Wait` it is the value of `--on-beads`. A session has the whole of gc through the stand-in anyway, so this gives it nothing new, but the tools are the bounded way and should not carry flags: refuse an id that is not the shape of a bead's id, with a line in the test. 2. The CHANGELOG's entry announces the server's side of tools no agent has yet: the host's side is roomcity-5e's and comes after. As with `Send` (#74, #80), leave the entry to the pull request that gives an agent the tools, where it can say what a foreman and a worker do with them. It stays out of main until the release with `attach` is cut, so that it does not go out half made; I merge it right after. Not run against a real gc, as the description says: what `gc sling --stdin --json` and `bd show --json` print is read from the source. The sandbox's run is where that is seen.
mikluko force-pushed room-work from bf1869a164
Some checks failed
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 2m7s
test / changelog (pull_request) Failing after 6s
to 7f0fa97e49
All checks were successful
test / changelog (pull_request) Successful in 4s
image / image (pull_request) Successful in 29s
test / go (pull_request) Successful in 1m42s
2026-11-16 10:33:55 +00:00
Compare
mikluko deleted branch room-work 2026-11-16 10:40:36 +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!90
No description provided.