host: answer the agent's request for leave to use the room's own tools #79
Loading…
Reference in a new issue
No description provided.
Delete branch "room-own-permissions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.toolNameof the request's tool call ismcp__room__<tool>; goose, thetool_callupdate that precedes the request carries_meta.goose.toolCall.toolNameroom__<tool>and the request'stoolCallIdleads to it (the request itself has only a title "room: attach · chart.png"). The tool must be onroomTools(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
attachis not the room's (CutPrefix), with its test.dae9b953db68c8e6f34eRead at
68c8e6f: the host's tests pass here under-raceand five times withGOMAXPROCS=1, and the order holds: the tap sees a request before the connection hands it toRequestPermission, soisOwnknows it in time.One defect.
claudeRoomToolreturnsstrings.TrimPrefix(name, "mcp__room__"), which gives the name back unchanged when the prefix is not there, so a Claude tool named plainlyattachis taken for the room's. Tried onownRequests.seewith a request whose_meta.claudeCode.toolNameis each of these:Claude Code has no tool of that plain name today; the check is still wrong, and
roomToolsis to grow. Usestrings.CutPrefixand its ok, asgooseRoomTooldoes, 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'sattachanswered 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.68c8e6f34e5e96a06eec