Skip to content

Commit a36d8c4

Browse files
committed
feat(chat): step counter on running task, surface sibling tasks
Stop suppressing tool-call events whose id differs from the active task when the call itself is another task — sibling parallel-audit subagents were being dropped on the floor, leaving the matching TOOL_CALL_RESULT with nothing to bind to until a page reload rehydrated from checkpoint. For genuinely inner tool calls, tick an innerToolsCount on the parent task segment so the user has some live signal during the long quiet window, surfaced as a small "N steps" chip on the running task card.
1 parent 967a6c0 commit a36d8c4

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

daiv/chat/static/chat/js/chat-stream.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,17 @@
571571
seg.endedAt = Date.now();
572572
}
573573
} else if (type === AGUI.TOOL_CALL_START) {
574-
// If a parent task is running and this isn't the task's own id, suppress.
575-
if (activeTask && evt.toolCallId !== activeTask.id) return;
574+
// Inner subagent tool calls collapse onto the running task card —
575+
// tick a progress counter so the user has *some* signal during the
576+
// long quiet window. Sibling task tool calls (parallel audit
577+
// subagents, etc.) MUST surface: suppressing them here drops the
578+
// segment, and the matching TOOL_CALL_RESULT then has nothing to
579+
// bind to, so the sibling task is invisible until a page reload
580+
// rehydrates from the checkpoint.
581+
if (activeTask && evt.toolCallId !== activeTask.id && evt.toolCallName !== "task") {
582+
activeTask.innerToolsCount = (activeTask.innerToolsCount || 0) + 1;
583+
return;
584+
}
576585
// ag_ui_langgraph re-emits START/ARGS/END from OnToolEnd whenever its
577586
// `has_function_streaming` flag got reset to False by an inner tool
578587
// completion — which happens for every parent tool that wraps a
@@ -597,14 +606,16 @@
597606
status: "running",
598607
});
599608
} else {
600-
turn.segments.push({
609+
const seg = {
601610
type: "tool_call",
602611
id: evt.toolCallId,
603612
name: evt.toolCallName,
604613
args: "",
605614
result: null,
606615
status: "running",
607-
});
616+
};
617+
if (evt.toolCallName === "task") seg.innerToolsCount = 0;
618+
turn.segments.push(seg);
608619
}
609620
this._toolIndex.set(evt.toolCallId, turn.segments.length - 1);
610621
} else if (type === AGUI.TOOL_CALL_ARGS) {

daiv/chat/templates/chat/chat_detail.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ <h1 class="chat-hero__title">{% trans "What are we building today?" %}</h1>
134134
</span>
135135
<span class="chat-tool__name" x-text="toolSignature(seg).label"></span>
136136
<span class="chat-tool__path" x-text="toolSignature(seg).path"></span>
137+
<template x-if="seg.name === 'task' && seg.status === 'running' && seg.innerToolsCount">
138+
<span class="chat-tool__progress" x-text="`${seg.innerToolsCount} step${seg.innerToolsCount === 1 ? '' : 's'}`"></span>
139+
</template>
137140
<template x-for="b in toolSignature(seg).badges" :key="b.text">
138141
<span class="chat-tool__badge" :class="`chat-tool__badge--${b.tone}`" x-text="b.text"></span>
139142
</template>

daiv/static_src/css/input.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,13 @@ a, button, [role="button"] {
10961096
.chat-tool__badge--violet { background: rgba(167, 139, 250, 0.12); color: #c4b5fd; }
10971097
.chat-tool__badge--neutral { background: rgba(255, 255, 255, 0.04); color: #94a3b8; }
10981098

1099+
.chat-tool__progress {
1100+
font-size: 10.5px;
1101+
color: rgba(251, 191, 36, 0.8);
1102+
font-variant-numeric: tabular-nums;
1103+
flex-shrink: 0;
1104+
}
1105+
10991106
.chat-tool__chev {
11001107
color: #475569;
11011108
transition: transform 0.2s ease;

0 commit comments

Comments
 (0)