chat: say what the room's work tools did #105

Merged
mikluko merged 1 commit from work-in-words into main 2026-11-16 13:09:02 +00:00
Owner

Summary

 ACP tool_call metadata
+  exact mcp__room__<tool> / room__<tool> work-tool name
+    -> one notice in words, with task id/text and a folded result where needed
   any other tool
     -> existing start and result notices

Covers dispatch, wait, result, claim and done for Claude Code and goose. Tool-call updates carry no host-issued canonical tool identity, so recognition uses the agents' exact metadata names, never display titles. The host and Matrix driver are unchanged. Failed calls retain their error output; a claim that finds no task says so.

Evidence

  • Before: 🔧 mcp__room__dispatch, then ✅ done with the tool's answer.
    After: Handed to a worker: Fix the parser (task sa-8uw).
  • Recorded-shape ACP frame tests cover all five tools for both agents, failed calls, an empty claim, task truncation, title-only lookalikes, other MCP servers and the unchanged attach tool.
  • go test -race ./... -count=1 passed against local Tuwunel with ROOMCITY_TEST_REQUIRE_HOMESERVER=1; its container was removed.
  • make lint, golangci-lint run ./internal/chat/... and go tool changelog -base main -fragments '' passed.

Merge Danger

Door: two-way

Blast Radius: chat and transcript notices for the five recognized work tools; all other tool rendering is unchanged.

## Summary ```diff ACP tool_call metadata + exact mcp__room__<tool> / room__<tool> work-tool name + -> one notice in words, with task id/text and a folded result where needed any other tool -> existing start and result notices ``` Covers dispatch, wait, result, claim and done for Claude Code and goose. Tool-call updates carry no host-issued canonical tool identity, so recognition uses the agents' exact metadata names, never display titles. The host and Matrix driver are unchanged. Failed calls retain their error output; a claim that finds no task says so. ## Evidence - **Before:** `🔧 mcp__room__dispatch`, then `✅ done` with the tool's answer. **After:** `Handed to a worker: Fix the parser (task sa-8uw)`. - Recorded-shape ACP frame tests cover all five tools for both agents, failed calls, an empty claim, task truncation, title-only lookalikes, other MCP servers and the unchanged `attach` tool. - `go test -race ./... -count=1` passed against local Tuwunel with `ROOMCITY_TEST_REQUIRE_HOMESERVER=1`; its container was removed. - `make lint`, `golangci-lint run ./internal/chat/...` and `go tool changelog -base main -fragments ''` passed. ## Merge Danger **Door:** two-way **Blast Radius:** chat and transcript notices for the five recognized work tools; all other tool rendering is unchanged.
chat: say what the room's work tools did
All checks were successful
image / image (pull_request) Successful in 19s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m22s
01f5c2fd51
Tool-call updates carry no host-issued canonical tool name, so recognize the exact Claude Code and goose metadata names rather than display titles. Same-named tools of other servers keep the generic rendering.

Assisted-By: Kimi <noreply@moonshot.ai>
Author
Owner

Review at 01f5c2f, by the reviewing session (specs-58). The suite is green here under go test -race ./..., the renderer's tests ten times with GOMAXPROCS=1.

The names were checked against the city, which the tests could not do: I took the tool frames the two sessions recorded in the loop of 12:13Z (foreman on Claude Code, worker-sa-wisp-1sz3z on goose) and ran them through this renderer. What the rooms would have shown:

foreman   Handed to a worker: In your container, run these two commands and report their exact output, verbatim, in your final answer: (task sa-8uw)
          Waiting to be told when task sa-8uw is closed
          Read the result of task sa-8uw                 (the result folded)
worker    Took task sa-8uw: In your container, run these two commands …
          Closed its task with the result                (the result folded)

So _meta.claudeCode.toolName = mcp__room__<tool> and _meta.goose.toolCall.toolName = room__<tool> are what the agents send, and the sentences the renderer reads out of the tools' answers are the host's. Two facts of the recorded frames that the test's built frames do not have, both handled: Claude Code sends the arguments in a second frame after an empty first one, and goose puts its _meta and arguments on the first frame only, the ending frame carrying neither.

On where the map lives: the renderer is the right place. The host knows a room's tool by the same two names and by nothing else (internal/host/ownperm.go reads exactly these fields), so a tag from the host would be the same evidence at one remove, and a tag would not exist in streams recorded before it, which the transcript pages render with this renderer.

Three changes before it merges.

1. A work tool that fails must say which act failed

With no notice at the start, a failed call now shows only

❌ failed        (the error folded)

and nothing in the room says what was tried; before this change the tool's name stood above it. A handing over that failed is the case the owner most needs in words. Say it for each of the five, with the reason folded as now, for instance:

❌ Could not hand to a worker: <first line of the task>
❌ Could not wait for task <id>
❌ Could not read the result of task <id>
❌ Could not take a task
❌ Could not close its task

The same for a call the owner refused or cancelled (denial), and for claim when its answer is not in the shape the renderer reads: today that falls back to a bare ✅ done, again with no name. TestRendererKeepsAWorkToolsFailureVisible asserts the nameless form and changes with it.

2. A renderer that begins in the middle of a call leaves holes

The server takes a session's stream up from its cursor when it starts again, so the frames that began a call may never reach this renderer. Tried with the recorded frames, giving it only the frame that ends each call:

Handed to a worker:  (task sa-8uw)
Waiting to be told when task  is closed

Make each sentence whole from what the ending frame has: without the task's text, "Handed to a worker (task sa-8uw)"; for wait and result, take the id from the arguments when they are there and leave the id out of the sentence when they are not. A test that feeds only the ending frame of a Claude call. (For goose the ending frame names no tool at all, so its notice is the generic one, as for every goose tool across a restart; that is not this pull request's to mend.)

3. Tie the sentences to the host's

The renderer reads three of the host's sentences by their exact wording: "Handed to a worker as task ", "Task :" and "There is no task for you; this session is ending." They are literals in internal/host/room.go and again here, and a rewording there silently turns "Took task …" into the fallback. #104 is rewording that file's answers now (not these three). Put the three in one place both packages take them from, or add a test that fails when they part.

Small:

  • The changelog entry uses curly quotes; the file's other entries use straight ones and backticks.

Not asked: one notice for a call means a call in flight shows nothing. The host bounds each call at two minutes and then fails it, which with change 1 is said in words, so that is acceptable as it is.

It will conflict with #104 in CHANGELOG.md; whichever is second rebases.

Review at 01f5c2f, by the reviewing session (specs-58). The suite is green here under `go test -race ./...`, the renderer's tests ten times with `GOMAXPROCS=1`. The names were checked against the city, which the tests could not do: I took the tool frames the two sessions recorded in the loop of 12:13Z (foreman on Claude Code, worker-sa-wisp-1sz3z on goose) and ran them through this renderer. What the rooms would have shown: foreman Handed to a worker: In your container, run these two commands and report their exact output, verbatim, in your final answer: (task sa-8uw) Waiting to be told when task sa-8uw is closed Read the result of task sa-8uw (the result folded) worker Took task sa-8uw: In your container, run these two commands … Closed its task with the result (the result folded) So `_meta.claudeCode.toolName` = `mcp__room__<tool>` and `_meta.goose.toolCall.toolName` = `room__<tool>` are what the agents send, and the sentences the renderer reads out of the tools' answers are the host's. Two facts of the recorded frames that the test's built frames do not have, both handled: Claude Code sends the arguments in a second frame after an empty first one, and goose puts its `_meta` and arguments on the first frame only, the ending frame carrying neither. On where the map lives: the renderer is the right place. The host knows a room's tool by the same two names and by nothing else (`internal/host/ownperm.go` reads exactly these fields), so a tag from the host would be the same evidence at one remove, and a tag would not exist in streams recorded before it, which the transcript pages render with this renderer. Three changes before it merges. ### 1. A work tool that fails must say which act failed With no notice at the start, a failed call now shows only ❌ failed (the error folded) and nothing in the room says what was tried; before this change the tool's name stood above it. A handing over that failed is the case the owner most needs in words. Say it for each of the five, with the reason folded as now, for instance: ❌ Could not hand to a worker: <first line of the task> ❌ Could not wait for task <id> ❌ Could not read the result of task <id> ❌ Could not take a task ❌ Could not close its task The same for a call the owner refused or cancelled (`denial`), and for `claim` when its answer is not in the shape the renderer reads: today that falls back to a bare `✅ done`, again with no name. `TestRendererKeepsAWorkToolsFailureVisible` asserts the nameless form and changes with it. ### 2. A renderer that begins in the middle of a call leaves holes The server takes a session's stream up from its cursor when it starts again, so the frames that began a call may never reach this renderer. Tried with the recorded frames, giving it only the frame that ends each call: Handed to a worker: (task sa-8uw) Waiting to be told when task is closed Make each sentence whole from what the ending frame has: without the task's text, "Handed to a worker (task sa-8uw)"; for `wait` and `result`, take the id from the arguments when they are there and leave the id out of the sentence when they are not. A test that feeds only the ending frame of a Claude call. (For goose the ending frame names no tool at all, so its notice is the generic one, as for every goose tool across a restart; that is not this pull request's to mend.) ### 3. Tie the sentences to the host's The renderer reads three of the host's sentences by their exact wording: "Handed to a worker as task ", "Task <id>:" and "There is no task for you; this session is ending." They are literals in `internal/host/room.go` and again here, and a rewording there silently turns "Took task …" into the fallback. #104 is rewording that file's answers now (not these three). Put the three in one place both packages take them from, or add a test that fails when they part. Small: - The changelog entry uses curly quotes; the file's other entries use straight ones and backticks. Not asked: one notice for a call means a call in flight shows nothing. The host bounds each call at two minutes and then fails it, which with change 1 is said in words, so that is acceptable as it is. It will conflict with #104 in CHANGELOG.md; whichever is second rebases.
mikluko force-pushed work-in-words from 01f5c2fd51
All checks were successful
image / image (pull_request) Successful in 19s
test / changelog (pull_request) Successful in 5s
test / go (pull_request) Successful in 1m22s
to cc3ec35eb9
All checks were successful
test / changelog (pull_request) Successful in 5s
image / image (pull_request) Successful in 16s
test / go (pull_request) Successful in 42s
2026-11-16 13:04:55 +00:00
Compare
mikluko deleted branch work-in-words 2026-11-16 13:09:02 +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!105
No description provided.