Show 'Waiting for the first of N agents' for mode-any waits

The wait_agents title ignored the mode argument, so an any-mode wait over
three agents read 'Waiting for 3 agents' while the model narrated waiting for
the first — contradicting the transcript.
This commit is contained in:
Siddharth Ganesan
2026-08-14 11:05:45 -07:00
parent e0a14840c0
commit 63bc10816a
+7 -2
View File
@@ -610,12 +610,17 @@ function waitTitle(args: ToolArgs): string {
return formatWaitTitle(requestedWaitSeconds(args), stringArg(args, 'reason'))
}
/** Title for a wait_agents sleep, naming the agent(s) being collected. */
/** Title for a wait_agents sleep, naming the agent(s) being collected and honoring mode "any". */
function waitAgentsTitle(args: ToolArgs): string {
const raw = args?.agent_ids
const ids = Array.isArray(raw) ? raw.filter((id): id is string => typeof id === 'string') : []
const anyMode = stringArg(args, 'mode') === 'any'
if (ids.length === 1) return `Waiting for ${ids[0]}`
if (ids.length > 1) return `Waiting for ${ids.length} agents`
if (ids.length > 1) {
return anyMode
? `Waiting for the first of ${ids.length} agents`
: `Waiting for ${ids.length} agents`
}
return 'Waiting for agents'
}