From 9d2571c86a7dae2bb526ca22233fe5309c23d53d Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 30 May 2026 12:54:41 +0530 Subject: [PATCH] fix: surface /agents nudge while delegate_task is in-flight (TUI + CLI) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The subagent spawn-observability overlay added a `(/agents)` hint, but only on the standalone "Spawn tree" panel, gated behind `!inlineDelegateKey` โ€” it never showed for a single delegate_task call, and only appeared once subagents had already registered. A nudge that arrives at the end (or only after spawn) is useless for the actual goal: letting users open the live monitor *while* delegation is running. Surface it the moment delegation starts, on both surfaces: TUI (ui-tui/src/components/thinking.tsx) - Show `(/agents)` on any "Delegate Task" tool group as soon as it appears (in-flight, before any subagent registers), not gated on subagents already existing. Same `startsWith('Delegate Task')` predicate already used for delegateGroups. CLI (agent/tool_executor.py) - Append `ยท /agents to monitor` to the delegate spinner label, which is displayed for the full duration of the delegate_task call. The previous attempt put the hint on the completion line (get_cute_tool_message), which only renders after the call finishes โ€” reverted. TUI tsc clean (pre-existing execFileNoThrow type errors unrelated); subagentTree 35/35; display.py reverted to upstream. --- agent/tool_executor.py | 8 ++++++-- ui-tui/src/components/thinking.tsx | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/agent/tool_executor.py b/agent/tool_executor.py index 358c1a0a8..b249de3de 100644 --- a/agent/tool_executor.py +++ b/agent/tool_executor.py @@ -753,10 +753,14 @@ def execute_tool_calls_sequential(agent, assistant_message, messages: list, effe elif function_name == "delegate_task": tasks_arg = function_args.get("tasks") if tasks_arg and isinstance(tasks_arg, list): - spinner_label = f"๐Ÿ”€ delegating {len(tasks_arg)} tasks" + spinner_label = f"๐Ÿ”€ delegating {len(tasks_arg)} tasks ยท (/agents to monitor)" else: goal_preview = (function_args.get("goal") or "")[:30] - spinner_label = f"๐Ÿ”€ {goal_preview}" if goal_preview else "๐Ÿ”€ delegating" + spinner_label = ( + f"๐Ÿ”€ {goal_preview} ยท (/agents to monitor)" + if goal_preview + else "๐Ÿ”€ delegating ยท (/agents to monitor)" + ) spinner = None if agent._should_emit_quiet_tool_messages() and agent._should_start_quiet_spinner(): face = random.choice(KawaiiSpinner.get_waiting_faces()) diff --git a/ui-tui/src/components/thinking.tsx b/ui-tui/src/components/thinking.tsx index 0d9ecee87..ce90cca21 100644 --- a/ui-tui/src/components/thinking.tsx +++ b/ui-tui/src/components/thinking.tsx @@ -1073,6 +1073,10 @@ export const ToolTrail = memo(function ToolTrail({ const branch: TreeBranch = index === groups.length - 1 ? 'last' : 'mid' const childRails = nextTreeRails(rails, branch) const hasInlineSubagents = inlineDelegateKey === group.key + // Surface the /agents hint the moment a delegate group appears โ€” + // while it's still in-flight and before any subagent has + // registered โ€” so users can open the live monitor immediately. + const isDelegateGroup = group.label.startsWith('Delegate Task') return ( @@ -1083,6 +1087,11 @@ export const ToolTrail = memo(function ToolTrail({ <> โ— {toolLabel(group)} + {isDelegateGroup ? ( + + {' (/agents to monitor)'} + + ) : null} } rails={rails}