Repository navigation
Conversation
GoDiao
left a comment
There was a problem hiding this comment.
Thanks @jay23606, and welcome to DreamCoder! The main fix is right. With agent teams off, a plain-text message to an agent id now reaches the subagent: queued while it runs, resumed when it has stopped, resumed from the transcript when its task is gone, and a well-formed id that doesn't exist gets success: false. The new Agent wording is accurate, since only background agents started with a name are registered. Behaviour with agent teams on is unchanged. We ran bun test SendMessageTool here without a stub preload: 25 pass, also in shuffled order, and 4 of the new tests fail with the base code. A few things before we merge.
Should fix
1. Structured messages now pass validation too, and the model gets a false "sent". isSubagentReference (SendMessageTool.ts:56-58) accepts any to that looks like an agent id or a registered name, whatever the message is. call() only routes to a subagent when the message is a string (:789). With agent teams off (the desktop default), the input schema still offers shutdown_request, so a model that wants to stop a background subagent can send
{ "to": "a1234567890abcdef", "message": { "type": "shutdown_request" } }Before this PR, validation rejected it. Now it passes, call() skips the subagent branch and reaches handleShutdownRequest (:875-876), which writes the request to a team inbox nobody reads and returns "Shutdown request sent". The subagent keeps running.
The check also duplicates the resolution in call(): validation uses toAgentId(to) !== null || agentNameRegistry.has(to), routing uses agentNameRegistry.get(to) ?? toAgentId(to). Please put the resolution in one helper that both use, accept a subagent reference only when the message is a string, and add a test that a structured message to an agent id is still rejected with agent teams off.
2. SendMessage's own text still says only session addresses work. With agent teams off, the to description (describeRecipient, :60-62), the validation error (:667) and the tool prompt describe only session:<id>, while the Agent tool now tells the model to pass the agent's id. A model that reads SendMessage's description will keep using session addresses, and one that gets an id slightly wrong is told to use a session address. Please mention agent ids, and names of background agents started with one, in all three when agent teams are off. T-TOOL-01 in docs/features/harness/prompt/tools.md lists these as part of the fix.
3. Docs and CHANGELOG.
docs/features/harness/prompt/tools.md:66still reads "状态:维护者已定(2026-11-18):…". Fixed findings carry a status line like- 状态:已修复(#NNN):…; please change it to- 状态:已修复(#298):followed by what changed. Line 72, which you mentioned, is in the "现状" part that records the behaviour before the fix, so it stays as it is.- The CHANGELOG entry should reference the PR and end with a thank-you, like the other external entries:
(#298). Thanks @jay23606.Please also word it as what the user sees, for example "The agent can continue a subagent it started when agent teams are off".
Notes
- Please drop the "Regression test: untested: CONTRIBUTING does not mention tests" line from the PR description; it contradicts the tests the PR adds.
- Two paths have no test yet: delivery by name through
call()(the name case is only validated), and resuming a subagent whose task has been removed. Worth adding while you're in the file.
Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
|
No change this round: the structured-message check, the shared subagent resolver, the recipient, validation and prompt wording, the tools.md status line, and the CHANGELOG ending "(#298). Thanks @jay23606." were already in place, and the subagent tests cover a structured message to an agent id. The request after "Please also word" is cut off, so the CHANGELOG sentence is unchanged. |
Problem
The Agent tool tells the model to continue a subagent with SendMessage and its id. With agent teams off, SendMessage's input check rejected anything but
session:<id>, so the routing that queues a message to a running subagent or resumes a stopped one never ran.Change
*still require agent teams.Testing
git diff --checkpasses.bun install --frozen-lockfileinvendor/showai,bun test src/tools/SendMessageTool --randomize --seed=1from the repository root passed: 28 tests, 0 failures (Bun 1.4.5).Fixes #272