The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(conversations): update chat tool part tests
Steven Enamakela722301647a1
diff --git a/app/src/features/conversations/components/ChatToolParts.test.tsx b/app/src/features/conversations/components/ChatToolParts.test.tsxindex 1aa5c2dd93..4819005a8d 100644--- a/app/src/features/conversations/components/ChatToolParts.test.tsx+++ b/app/src/features/conversations/components/ChatToolParts.test.tsx@@ -166,9 +166,11 @@ describe('ChatToolParts', () => {/>);- expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Searched the web');- await userEvent.click(screen.getByRole('button', { name: /Searched the web/ }));- expect(screen.getByText(/Lean open conjectures/)).toBeInTheDocument();+ expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent(+ 'Searching: Lean open conjectures'+ );+ await userEvent.click(screen.getByRole('button', { name: /Searching: Lean open conjectures/ }));+ expect(screen.getAllByText(/Lean open conjectures/).length).toBeGreaterThan(0);expect(screen.queryByText('Query', { exact: true })).not.toBeInTheDocument();expect(screen.getByText('Found 12 candidate problems')).toBeInTheDocument();});@@ -189,28 +191,75 @@ describe('ChatToolParts', () => {/>);- await userEvent.click(screen.getByRole('button', { name: /Fetched from the web/ }));+ await userEvent.click(screen.getByRole('button', { name: /Fetching/ }));expect(screen.getByRole('strong')).toHaveTextContent('Example Domain');expect(screen.queryByText('Content', { exact: true })).not.toBeInTheDocument();});- it('infers web search labels when a persisted tool name degraded to tool', () => {+ /**+ * The label comes from the tool's identity, never from a substring of its+ * name or from which argument keys it has. The old guess labelled all of+ * these "Searched the web": an email turn that found its Gmail action with+ * `tool_search` read as a web search from start to finish.+ */+ function renderTool(toolName: string, args: Record<string, unknown>, extra = {}) {render(<ChatToolFallbacktype="tool-call"- toolName="tool"- toolCallId="search-generic"- args={{ query: 'latest world news' } as never}- argsText={'{"query":"latest world news"}'}- result="# Search results\n\n- Headline"+ toolName={toolName}+ toolCallId={`call-${toolName}`}+ args={args as never}+ argsText={JSON.stringify(args)}+ result="ok"status={{ type: 'complete' }}addResult={() => {}}resume={() => {}}respondToApproval={() => {}}+ {...extra}/>);+ return screen.getByTestId('assistant-ui-tool-call');+ }++ it('labels tool discovery as a tool search, not a web search', () => {+ const card = renderTool('tool_search', { query: 'send an email with gmail' });+ expect(card).toHaveTextContent('Searching tools');+ expect(card).not.toHaveTextContent(/web/i);+ });++ it('labels a Composio action with a query argument by its service', () => {+ const card = renderTool('GMAIL_FETCH_EMAILS', { query: 'from:broker' });+ expect(card).toHaveTextContent('Making requests to your Gmail account');+ expect(card).not.toHaveTextContent(/web/i);+ });++ it('labels a tool_call bridge by the tool it invokes', () => {+ const card = renderTool('tool_call', {+ name: 'GMAIL_SEND_EMAIL',+ arguments: { recipient_email: '[email protected]', subject: 'AAPL' },+ });+ expect(card).toHaveTextContent('Making requests to your Gmail account');+ expect(card).not.toHaveTextContent(/web/i);+ });++ it('labels memory searches as memory, not the web', () => {+ const card = renderTool('memory_hybrid_search', { query: 'apple stock' });+ expect(card).toHaveTextContent('Searching memory');+ expect(card).not.toHaveTextContent(/web/i);+ });++ it('prefers the label the row carries on the part artifact', () => {+ const card = renderTool(+ 'stock_quote',+ { symbol: 'AAPL' },+ { artifact: { displayName: 'Stock quote', detail: 'AAPL' } }+ );+ expect(card).toHaveTextContent('Stock quote');+ expect(card).toHaveTextContent('AAPL');+ });- expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Searched the web');- expect(screen.getByTestId('assistant-ui-tool-call')).not.toHaveTextContent(/^Tool done$/);+ it('humanises an unknown tool rather than guessing its category', () => {+ const card = renderTool('tool', { query: 'latest world news' });+ expect(card).not.toHaveTextContent(/web/i);});});diff --git a/app/src/features/conversations/components/aui/ChatSources.test.tsx b/app/src/features/conversations/components/aui/ChatSources.test.tsxindex 489f4851d6..8fda731759 100644--- a/app/src/features/conversations/components/aui/ChatSources.test.tsx+++ b/app/src/features/conversations/components/aui/ChatSources.test.tsx@@ -212,6 +212,8 @@ describe('inline turn sources', () => {// One row, not two: the `javascript:` entry is dropped by// `extractAgentSources`, so it is never counted and never linked.expect(sourceHrefs()).toEqual(['https://example.com/safe']);- expect(document.body.innerHTML).not.toContain('javascript:');+ // The fetch card may show the raw argument as text; it must never be a link.+ const hrefs = Array.from(document.querySelectorAll('a[href]')).map(a => a.getAttribute('href'));+ expect(hrefs.some(href => href?.startsWith('javascript:'))).toBe(false);});});