Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Keep Assistant status on active tool

rcourtman5398eeb79535
diff --git a/docs/release-control/v6/internal/status.json b/docs/release-control/v6/internal/status.json
index f9fc6f0353..dda84d98ce 100644
--- a/docs/release-control/v6/internal/status.json
+++ b/docs/release-control/v6/internal/status.json
@@ -6767,11 +6767,11 @@
{
"id": "codex-lane-followup-architecture-post-rc-canonicalization",
"agent_id": "codex",
- "summary": "Add live Assistant active-turn status",
+ "summary": "Keep Assistant status on the active tool",
"target_id": "v6-product-lane-expansion",
"claimed_at": "2026-06-05T21:57:48Z",
- "heartbeat_at": "2026-06-06T01:14:47Z",
- "expires_at": "2026-06-06T03:14:47Z",
+ "heartbeat_at": "2026-06-06T01:23:29Z",
+ "expires_at": "2026-06-06T03:23:29Z",
"work_item": {
"kind": "lane-followup",
"id": "architecture-post-rc-canonicalization"
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
index e4cf94ecb6..522684a1ac 100644
--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -218,6 +218,10 @@ runtime cost control, and shared AI transport surfaces.
that as an active-turn status strip: no idle diagnostics, but while a turn is
loading it must show waiting, current tool/workflow progress, or generating
status even when the transcript already contains an in-flight assistant row.
+ When multiple governed tools are pending, completed tools must not blank the
+ status while another tool is still running, and the status heartbeat should
+ follow the latest progressed pending tool without reordering the transcript's
+ chronological tool rows.
The referenced OpenCode source at commit
`f750deaa3e95098fdde5fb00305b273e43c5b2cd` mutates a single tool part from
`pending` input through `running` progress to completed/error in
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
index b5b9352d47..006d2b9358 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts
@@ -66,6 +66,54 @@ describe('getAssistantActiveTurnStatus', () => {
});
});
+ it('keeps showing a remaining pending tool when another parallel tool completes', () => {
+ expect(
+ getAssistantActiveTurnStatus(
+ [
+ assistantMessage({
+ streamEvents: [
+ {
+ type: 'pending_tool',
+ pendingTool: {
+ id: 'tool-a',
+ name: 'pulse_get_nodes',
+ input: '{}',
+ status: 'running',
+ },
+ toolId: 'tool-a',
+ },
+ {
+ type: 'pending_tool',
+ pendingTool: {
+ id: 'tool-b',
+ name: 'pulse_read',
+ input: '{}',
+ progress: 'Reading storage layout',
+ status: 'running',
+ },
+ toolId: 'tool-b',
+ },
+ {
+ type: 'tool',
+ toolId: 'tool-a',
+ tool: {
+ name: 'pulse_get_nodes',
+ input: '{}',
+ output: 'ok',
+ success: true,
+ },
+ },
+ ],
+ }),
+ ],
+ true,
+ ),
+ ).toEqual({
+ type: 'tool',
+ text: 'Reading storage layout',
+ });
+ });
+
it('surfaces neutral workflow progress while a turn is active', () => {
expect(
getAssistantActiveTurnStatus(
diff --git a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
index bf456dc4d6..8d018aa7bb 100644
--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts
@@ -2370,5 +2370,38 @@ describe('useChat', () => {
expect(assistant.toolCalls).toHaveLength(2);
dispose();
});
+
+ it('moves the most recently progressed pending tool to the active end', async () => {
+ const { getFireEvent } = setupWithEventCapture();
+ const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));
+
+ await chat.sendMessage('hi');
+ const fire = getFireEvent();
+
+ fire({ type: 'tool_start', data: { id: 'a', name: 'tool_a', input: '{}' } });
+ fire({ type: 'tool_start', data: { id: 'b', name: 'tool_b', input: '{}' } });
+ fire({
+ type: 'tool_progress',
+ data: {
+ id: 'a',
+ name: 'tool_a',
+ input: '{}',
+ phase: 'running',
+ message: 'Reading node inventory',
+ },
+ });
+
+ const assistant = chat.messages().find((m) => m.role === 'assistant')!;
+ expect(assistant.pendingTools?.map((tool) => tool.id)).toEqual(['b', 'a']);
+ expect(assistant.pendingTools?.at(-1)).toMatchObject({
+ id: 'a',
+ progress: 'Reading node inventory',
+ status: 'running',
+ });
+ expect(assistant.streamEvents?.filter((event) => event.type === 'pending_tool')).toHaveLength(
+ 2,
+ );
+ dispose();
+ });
});
});
diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
index f576b45e89..88ba6473b9 100644
--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts
@@ -47,14 +47,26 @@ const formatPendingToolStatus = (tool?: PendingTool): string => {
const activePendingToolFromEvents = (
events?: StreamDisplayEvent[],
): PendingTool | undefined => {
+ const completedToolKeys = new Set<string>();
+
for (let index = (events?.length || 0) - 1; index >= 0; index -= 1) {
const event = events?.[index];
if (!event) continue;
if (event.type === 'pending_tool' && event.pendingTool) {
- return event.pendingTool;
+ const keys = [event.toolId, event.pendingTool.id, event.pendingTool.name]
+ .map((value) => value?.trim())
+ .filter((value): value is string => !!value);
+ if (!keys.some((key) => completedToolKeys.has(key))) {
+ return event.pendingTool;
+ }
}
if (event.type === 'tool') {
- return undefined;
+ for (const key of [event.toolId, event.tool?.name]) {
+ const normalized = key?.trim();
+ if (normalized) {
+ completedToolKeys.add(normalized);
+ }
+ }
}
}
diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
index 7eb40c3721..ef1eee76c0 100644
--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts
@@ -305,11 +305,11 @@ export function useChat(options: UseChatOptions = {}) {
const pendingIndex = pendingTools.findIndex((tool) => matchesTool(tool, tool.id));
const updatedPendingTools =
pendingIndex >= 0
- ? pendingTools.map((tool, index) => {
- if (index !== pendingIndex) return tool;
- resolvedTool = mergeTool(tool);
- return resolvedTool;
- })
+ ? [
+ ...pendingTools.slice(0, pendingIndex),
+ ...pendingTools.slice(pendingIndex + 1),
+ (resolvedTool = mergeTool(pendingTools[pendingIndex])),
+ ]
: [
...pendingTools,
(resolvedTool = {
@@ -792,7 +792,7 @@ export function useChat(options: UseChatOptions = {}) {
}
return true;
});
- updatedEvents.push({ type: 'tool', tool: newToolCall });
+ updatedEvents.push({ type: 'tool', tool: newToolCall, toolId: data.id });
} else {
// No approval - just replace pending_tool in place
updatedEvents = [...events];
@@ -804,7 +804,7 @@ export function useChat(options: UseChatOptions = {}) {
? evt.toolId === data.id
: normalizeChatToolName(evt.pendingTool?.name || '') === normalizedEndName)
) {
- updatedEvents[i] = { type: 'tool', tool: newToolCall };
+ updatedEvents[i] = { type: 'tool', tool: newToolCall, toolId: data.id };
break;
}
}