host: answer the agent's request for leave to use the room's own tools #79

Closed
mikluko wants to merge 5 commits from room-own-permissions into room-attach
Owner

specs-18's decision on spec-bb1.39: the host answers the agent's request for leave to use the room's own tools, and the room does not show it.

Attribution, per agent, by what the agent itself calls the tool, written in ownperm.go: Claude Code through claudeacp, _meta.claudeCode.toolName of the request's tool call is mcp__room__<tool>; goose, the tool_call update that precedes the request carries _meta.goose.toolCall.toolName room__<tool> and the request's toolCallId leads to it (the request itself has only a title "room: attach · chart.png"). The tool must be on roomTools (a test checks the list is what the room serves); another server's tool, a title that only looks like it, a tool of the room that is not on the list, all go to the owner. The answer is allow-once; a request with no allow-once option goes to the owner.

Who answered: the copy of the request that goes to the server carries _meta.roomcity.answeredBy = "host" in its tool call (the agent gets the request as it wrote it). For roomcity-ee: the room's renderer and the transcripts page should not show a permission request with that key as a question; the transcript can say "answered by the host". The permission request frame still has its place in the stream.

Tested: unit tests of the attribution on goose- and Claude-shaped frames; the host end to end with a helper agent (it is answered with no instruction from the server and the server's copy carries the key); the real goose, twice, with the gated test, without my answering: the file arrived and the recorded request had the key. A first real run had the model not call the tool at all, which is the model's. Claude Code's own request I read from claudeacp's source and did not see in a run under acceptEdits (my earlier run was in bypassPermissions).

Goes out with roomcity-ee's #81, which makes the room not show a request carrying that key; neither alone is wanted (this one alone answers the agent and still shows the owner a question that is already answered; #81 alone has nothing to hide).
Fixed after review: a Claude tool named plainly attach is not the room's (CutPrefix), with its test.

specs-18's decision on spec-bb1.39: the host answers the agent's request for leave to use the room's own tools, and the room does not show it. Attribution, per agent, by what the agent itself calls the tool, written in `ownperm.go`: Claude Code through claudeacp, `_meta.claudeCode.toolName` of the request's tool call is `mcp__room__<tool>`; goose, the `tool_call` update that precedes the request carries `_meta.goose.toolCall.toolName` `room__<tool>` and the request's `toolCallId` leads to it (the request itself has only a title "room: attach · chart.png"). The tool must be on `roomTools` (a test checks the list is what the room serves); another server's tool, a title that only looks like it, a tool of the room that is not on the list, all go to the owner. The answer is allow-once; a request with no allow-once option goes to the owner. Who answered: the copy of the request that goes to the server carries `_meta.roomcity.answeredBy = "host"` in its tool call (the agent gets the request as it wrote it). **For roomcity-ee**: the room's renderer and the transcripts page should not show a permission request with that key as a question; the transcript can say "answered by the host". The permission request frame still has its place in the stream. Tested: unit tests of the attribution on goose- and Claude-shaped frames; the host end to end with a helper agent (it is answered with no instruction from the server and the server's copy carries the key); the real goose, twice, with the gated test, without my answering: the file arrived and the recorded request had the key. A first real run had the model not call the tool at all, which is the model's. Claude Code's own request I read from claudeacp's source and did not see in a run under acceptEdits (my earlier run was in bypassPermissions). **Goes out with roomcity-ee's #81**, which makes the room not show a request carrying that key; neither alone is wanted (this one alone answers the agent and still shows the owner a question that is already answered; #81 alone has nothing to hide). Fixed after review: a Claude tool named plainly `attach` is not the room's (CutPrefix), with its test.
host: answer the agent's request for leave to use the room's own tools
All checks were successful
image / image (pull_request) Successful in 16s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 1m10s
dae9b953db
Asking the owner in the room for leave to show him a file is noise, and what the
tool does is visible to him as it happens. The host answers allow-once to a
permission request that its agent names as a tool of the room's server on the
list of tools it answers for (roomTools): mcp__room__<tool> in claudeCode's
toolName for Claude Code, room__<tool> in the goose toolCall of the tool_call
that precedes the request. A request not so named goes to the owner.

The copy of the request that goes to the server carries
_meta.roomcity.answeredBy "host" in its tool call, so that the room and the
transcript can tell who answered.

Assisted-By: Claude <noreply@anthropic.com>
mikluko force-pushed room-own-permissions from dae9b953db
All checks were successful
image / image (pull_request) Successful in 16s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 1m10s
to 68c8e6f34e
All checks were successful
image / image (pull_request) Successful in 19s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 1m20s
2026-11-16 09:49:42 +00:00
Compare
Author
Owner

Read at 68c8e6f: the host's tests pass here under -race and five times with GOMAXPROCS=1, and the order holds: the tap sees a request before the connection hands it to RequestPermission, so isOwn knows it in time.

One defect. claudeRoomTool returns strings.TrimPrefix(name, "mcp__room__"), which gives the name back unchanged when the prefix is not there, so a Claude tool named plainly attach is taken for the room's. Tried on ownRequests.see with a request whose _meta.claudeCode.toolName is each of these:

attach                 answered by the host   wrong
mcp__room__attach      answered by the host
mcp__other__attach     to the owner
Bash                   to the owner

Claude Code has no tool of that plain name today; the check is still wrong, and roomTools is to grow. Use strings.CutPrefix and its ok, as gooseRoomTool does, with the plain name in the test.

For the map, not for this pull request: the attribution rests on the name the agent's own program gives the server, room. An agent that could make its program load another MCP server under that name would have that server's attach answered for it; for goose that is a change of its extensions, which asks the owner, and for Claude Code a change of its MCP configuration.

Until the room's renderer knows _meta.roomcity.answeredBy, a request the host answers is shown in the room as a question and then as answered; it goes out in one release with roomcity-ee's side, so say in the description which pull request that is.

Read at 68c8e6f: the host's tests pass here under `-race` and five times with `GOMAXPROCS=1`, and the order holds: the tap sees a request before the connection hands it to `RequestPermission`, so `isOwn` knows it in time. One defect. `claudeRoomTool` returns `strings.TrimPrefix(name, "mcp__room__")`, which gives the name back unchanged when the prefix is not there, so a Claude tool named plainly `attach` is taken for the room's. Tried on `ownRequests.see` with a request whose `_meta.claudeCode.toolName` is each of these: attach answered by the host wrong mcp__room__attach answered by the host mcp__other__attach to the owner Bash to the owner Claude Code has no tool of that plain name today; the check is still wrong, and `roomTools` is to grow. Use `strings.CutPrefix` and its ok, as `gooseRoomTool` does, with the plain name in the test. For the map, not for this pull request: the attribution rests on the name the agent's own program gives the server, `room`. An agent that could make its program load another MCP server under that name would have that server's `attach` answered for it; for goose that is a change of its extensions, which asks the owner, and for Claude Code a change of its MCP configuration. Until the room's renderer knows `_meta.roomcity.answeredBy`, a request the host answers is shown in the room as a question and then as answered; it goes out in one release with roomcity-ee's side, so say in the description which pull request that is.
mikluko force-pushed room-own-permissions from 68c8e6f34e
All checks were successful
image / image (pull_request) Successful in 19s
test / changelog (pull_request) Successful in 6s
test / go (pull_request) Successful in 1m20s
to 5e96a06eec
All checks were successful
image / image (pull_request) Successful in 4s
test / go (pull_request) Successful in 1m17s
test / changelog (pull_request) Successful in 6s
2026-11-16 09:56:40 +00:00
Compare
mikluko closed this pull request 2026-11-16 09:57:34 +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!79
No description provided.