🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(chat): scope tool execution timers to their message (#20656)
Nekoaf33126273cb
diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/ExecutionTime.test.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/ExecutionTime.test.tsxindex 88a4d6a127f..03cbba2c4f7 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/ExecutionTime.test.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/ExecutionTime.test.tsx@@ -5,6 +5,10 @@ import { act, cleanup, render, screen } from '@testing-library/react';import { afterEach, describe, expect, it, vi } from 'vitest';import ExecutionTime from './ExecutionTime';+import Inspectors from './index';++vi.mock('./StatusIndicator', () => ({ default: () => null }));+vi.mock('./ToolTitle', () => ({ default: () => null }));describe('ExecutionTime', () => {afterEach(() => {@@ -128,4 +132,36 @@ describe('ExecutionTime', () => {expect(screen.getByText('0ms')).toBeTruthy();});++ it('keeps separate inspector clocks for messages that reuse a native tool id', () => {+ // Codex numbers items per run, so `item_1` appears in every topic and resumed turn.+ vi.useFakeTimers();+ vi.setSystemTime(10_000);+ const renderTool = (messageId: string) =>+ render(+ <Inspectors+ isToolCalling+ apiName="exec"+ identifier="codex"+ messageId={messageId}+ toolCallId="item_1"+ />,+ );++ const first = renderTool('message-a');+ act(() => {+ vi.advanceTimersByTime(2500);+ });+ first.unmount();+ act(() => {+ vi.advanceTimersByTime(1000);+ });++ const second = renderTool('message-b');+ expect(screen.getByText('0ms')).toBeTruthy();+ second.unmount();++ renderTool('message-a');+ expect(screen.getByText('3.5s')).toBeTruthy();+ });});diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsxindex acc4b058ab8..8996cdf3d9d 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/Inspector/index.tsx@@ -37,6 +37,8 @@ interface InspectorProps {* Whether the tool is currently executing (from operation state)*/isToolCalling?: boolean;+ /** Owning message; native tool ids such as Codex `item_1` repeat across messages. */+ messageId: string;result?: { content: string | null; error?: any; state?: any };toolCallId: string;toolCallStartTime?: number;@@ -52,6 +54,7 @@ const Inspectors = memo<InspectorProps>(isArgumentsStreaming,isExpanded,isToolCalling,+ messageId,toolCallId,toolCallStartTime,}) => {@@ -156,7 +159,7 @@ const Inspectors = memo<InspectorProps>(<ExecutionTimeisExecuting={showExecutionTimer}startTime={toolCallStartTime}- timerKey={toolCallId}+ timerKey={`${messageId}:${toolCallId}`}/></Flexbox>);diff --git a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsxindex 22c585da2eb..0e538b288ee 100644--- a/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx+++ b/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx@@ -189,6 +189,7 @@ const Tool = memo<GroupToolProps>(({ assistantMessageId, disableEditing, id }) =isArgumentsStreaming={isArgumentsStreaming}isExpanded={isToolDetailExpand}isToolCalling={isToolCalling}+ messageId={assistantMessageId}result={result}toolCallId={id}toolCallStartTime={toolCallStartTime}diff --git a/src/features/Conversation/Messages/Tool/Tool/index.tsx b/src/features/Conversation/Messages/Tool/Tool/index.tsxindex 5c8bad5f0c2..5ed06967ce5 100644--- a/src/features/Conversation/Messages/Tool/Tool/index.tsx+++ b/src/features/Conversation/Messages/Tool/Tool/index.tsx@@ -127,6 +127,7 @@ const Tool = memo<InspectorProps>(<InspectorsapiName={apiName}identifier={identifier}+ messageId={messageId}result={result}toolCallId={toolCallId}/>