From 5035fa9029a4391f694e3e3407d2e85cd4f36f23 Mon Sep 17 00:00:00 2001 From: Amy Ravenwolf Date: Fri, 3 Apr 2026 16:19:13 +0200 Subject: [PATCH] feat(display): show delegate_task goals in tool progress notifications Previously, delegate_task in batch mode only showed '3 parallel tasks' without revealing what the tasks actually are. Single-task mode showed the goal via the primary_args fallback, but batch mode had no goal extraction. Changes: - build_tool_preview(): Add dedicated delegate_task handler that extracts individual task goals from both single and batch modes. Batch shows '3 tasks: Goal A | Goal B | Goal C'. - _get_cute_tool_message_impl(): Show individual goals in CLI cute messages for batch delegate calls ('3x: Goal A | Goal B'). - Add 4 tests covering single goal, batch goals, missing goals, and no-goal edge case. --- agent/display.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/agent/display.py b/agent/display.py index 8514279888e..55326b5b01b 100644 --- a/agent/display.py +++ b/agent/display.py @@ -191,6 +191,15 @@ def build_tool_preview(tool_name: str, args: dict, max_len: int | None = None) - "clarify": "question", "skill_manage": "name", } + # delegate_task: show goal (single) or individual task goals (batch) + if tool_name == "delegate_task": + tasks = args.get("tasks") + if tasks and isinstance(tasks, list): + goals = [_oneline(t.get("goal", "?"))[:40] for t in tasks if isinstance(t, dict)] + return f"{len(tasks)} tasks: " + " | ".join(goals) if goals else f"{len(tasks)} parallel tasks" + goal = args.get("goal", "") + return _oneline(goal) if goal else None + if tool_name == "process": action = args.get("action", "") sid = args.get("session_id", "") @@ -1019,7 +1028,9 @@ def get_cute_tool_message( if tool_name == "delegate_task": tasks = args.get("tasks") if tasks and isinstance(tasks, list): - return _wrap(f"┊ 🔀 delegate {len(tasks)} parallel tasks {dur}") + goals = [_oneline(t.get("goal", "?"))[:30] for t in tasks if isinstance(t, dict)] + detail = " | ".join(goals) if goals else "parallel" + return _wrap(f"┊ 🔀 delegate {len(tasks)}x: {_trunc(detail, 35)} {dur}") return _wrap(f"┊ 🔀 delegate {_trunc(args.get('goal', ''), 35)} {dur}") preview = build_tool_preview(tool_name, args) or ""