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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Keep Assistant pending tool progress in place
rcourtman06939189a541
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.mdindex 5791b4d7cc..5e8b598145 100644--- a/docs/release-control/v6/internal/subsystems/ai-runtime.md+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md@@ -310,6 +310,15 @@ runtime cost control, and shared AI transport surfaces.chronological tool rows. Pulse adapts this with a mutable footer status andinline pending rows that show the current activity plus elapsed time whilekeeping large command output collapsed.+ The referenced OpenCode source at fetched `origin/dev` commit+ `1399323b78a04229d9bfe00c7436d7f41770fda8` updates the existing typed tool+ part through `updateToolCall` in+ `packages/opencode/src/session/processor.ts` and renders ordered assistant+ content parts through `AssistantMessage`/`AssistantTool` in+ `packages/opencode/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx`;+ Pulse pending tool progress must therefore mutate the matching row in place+ and carry separate activity freshness metadata for the footer instead of+ moving an earlier active tool row below later tools when progress arrives.Assistant experience parity claims against OpenCode must cite the inspectedOpenCode commit and source file/function anchor that defines the behaviorbeing adapted; observed UI behavior alone is not sufficient governancediff --git a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.tsindex 686a76e956..3af0d331c7 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/activeTurnStatus.test.ts@@ -90,6 +90,41 @@ describe('getAssistantActiveTurnStatus', () => {});});+ it('uses latest pending tool activity without requiring transcript reordering', () => {+ expect(+ getAssistantActiveTurnStatus(+ [+ assistantMessage({+ pendingTools: [+ {+ id: 'tool-a',+ name: 'pulse_get_nodes',+ input: '{}',+ progress: 'Reading node inventory',+ status: 'running',+ startedAt: 100,+ updatedAt: 300,+ },+ {+ id: 'tool-b',+ name: 'pulse_read',+ input: '{}',+ status: 'running',+ startedAt: 200,+ updatedAt: 200,+ },+ ],+ }),+ ],+ true,+ ),+ ).toEqual({+ type: 'tool',+ text: 'Reading node inventory',+ startedAt: 100,+ });+ });+it('keeps showing a remaining pending tool when another parallel tool completes', () => {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.tsindex 1931fd6e3b..ce28804bc8 100644--- a/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts+++ b/frontend-modern/src/components/AI/Chat/__tests__/useChat.test.ts@@ -1261,6 +1261,7 @@ describe('useChat', () => {rawInput: undefined,status: 'pending',startedAt: expect.any(Number),+ updatedAt: expect.any(Number),});dispose();});@@ -2532,7 +2533,7 @@ describe('useChat', () => {dispose();});- it('moves the most recently progressed pending tool to the active end', async () => {+ it('keeps pending tool transcript order when an earlier tool reports progress', async () => {const { getFireEvent } = setupWithEventCapture();const { value: chat, dispose } = withRoot(() => useChat({ sessionId: 's' }));@@ -2553,15 +2554,23 @@ describe('useChat', () => {});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({+ expect(assistant.pendingTools?.map((tool) => tool.id)).toEqual(['a', 'b']);+ expect(assistant.pendingTools?.[0]).toMatchObject({id: 'a',progress: 'Reading node inventory',status: 'running',});+ expect(assistant.pendingTools?.[0].updatedAt).toBeGreaterThanOrEqual(+ assistant.pendingTools?.[0].startedAt || 0,+ );expect(assistant.streamEvents?.filter((event) => event.type === 'pending_tool')).toHaveLength(2,);+ expect(+ assistant.streamEvents+ ?.filter((event) => event.type === 'pending_tool')+ .map((event) => event.pendingTool?.id),+ ).toEqual(['a', 'b']);dispose();});diff --git a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts b/frontend-modern/src/components/AI/Chat/activeTurnStatus.tsindex 52fc174d9a..471d273825 100644--- a/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts+++ b/frontend-modern/src/components/AI/Chat/activeTurnStatus.ts@@ -74,6 +74,15 @@ const activePendingToolFromEvents = (return undefined;};+const latestPendingToolActivity = (tool?: PendingTool): number =>+ tool?.updatedAt ?? tool?.startedAt ?? 0;++const activePendingToolFromState = (pendingTools?: PendingTool[]): PendingTool | undefined =>+ pendingTools?.reduce<PendingTool | undefined>((current, tool) => {+ if (!current) return tool;+ return latestPendingToolActivity(tool) >= latestPendingToolActivity(current) ? tool : current;+ }, undefined);+const hasVisibleAssistantOutput = (message: ChatMessage): boolean => {if ((message.content || '').trim() || message.error) return true;@@ -98,7 +107,8 @@ export const getAssistantActiveTurnStatus = (}const pendingTool =- assistantMessage.pendingTools?.at(-1) || activePendingToolFromEvents(assistantMessage.streamEvents);+ activePendingToolFromState(assistantMessage.pendingTools) ||+ activePendingToolFromEvents(assistantMessage.streamEvents);const pendingToolText = formatPendingToolStatus(pendingTool);if (pendingToolText) {return { type: 'tool', text: pendingToolText, startedAt: pendingTool?.startedAt };diff --git a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts b/frontend-modern/src/components/AI/Chat/hooks/useChat.tsindex f83fc97de1..655e62f9d7 100644--- a/frontend-modern/src/components/AI/Chat/hooks/useChat.ts+++ b/frontend-modern/src/components/AI/Chat/hooks/useChat.ts@@ -313,6 +313,7 @@ export function useChat(options: UseChatOptions = {}) {const status = normalizePendingToolStatus(data.phase);const progress = data.message?.trim() || undefined;const pendingTools = msg.pendingTools || [];+ const now = Date.now();const matchesTool = (tool?: PendingTool, toolId?: string) => {if (!tool) return false;@@ -328,7 +329,8 @@ export function useChat(options: UseChatOptions = {}) {rawInput: data.raw_input || tool.rawInput,status,progress: progress || tool.progress,- startedAt: tool.startedAt || Date.now(),+ startedAt: tool.startedAt || now,+ updatedAt: now,});let resolvedTool: PendingTool | undefined;@@ -337,8 +339,8 @@ export function useChat(options: UseChatOptions = {}) {pendingIndex >= 0? [...pendingTools.slice(0, pendingIndex),- ...pendingTools.slice(pendingIndex + 1),(resolvedTool = mergeTool(pendingTools[pendingIndex])),+ ...pendingTools.slice(pendingIndex + 1),]: [...pendingTools,@@ -349,7 +351,8 @@ export function useChat(options: UseChatOptions = {}) {rawInput: data.raw_input,status,progress,- startedAt: Date.now(),+ startedAt: now,+ updatedAt: now,}),];@@ -770,13 +773,15 @@ export function useChat(options: UseChatOptions = {}) {// Prefer backend tool call ID for robust matching across parallel calls.// Fall back to a local ID if backend didn't send one (older servers).const toolId = data.id || generateId();+ const startedAt = Date.now();const pendingTool: PendingTool = {id: toolId,name: data.name || 'unknown',input: data.input || '{}',rawInput: data.raw_input,status: 'pending',- startedAt: Date.now(),+ startedAt,+ updatedAt: startedAt,};// Add to streamEvents in chronological positiondiff --git a/frontend-modern/src/components/AI/Chat/types.ts b/frontend-modern/src/components/AI/Chat/types.tsindex 9acb24e396..6503906673 100644--- a/frontend-modern/src/components/AI/Chat/types.ts+++ b/frontend-modern/src/components/AI/Chat/types.ts@@ -21,6 +21,7 @@ export interface PendingTool {status?: 'pending' | 'running' | 'waiting';progress?: string;startedAt?: number;+ updatedAt?: number;}export interface PendingApproval {