Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ui): render friendly engine name in agent-thinking tool_call panel (#4570)

LearningCircuit956afb7caa11
diff --git a/changelog.d/4470.bugfix.md b/changelog.d/4470.bugfix.md
new file mode 100644
index 0000000000..eb4d10aae0
--- /dev/null
+++ b/changelog.d/4470.bugfix.md
@@ -0,0 +1 @@
+The research progress display and agent-thinking panel now show the actual search engine name (e.g. "DuckDuckGo") instead of the generic internal id "web_search". The LangGraph strategy keeps the stable tool id in the progress event metadata while surfacing the friendly, brand-correct engine name in the message, and the agent-thinking panel renderer now prefers that human-readable message.
diff --git a/src/local_deep_research/web/static/js/components/progress.js b/src/local_deep_research/web/static/js/components/progress.js
index e143daf8b0..a050c62893 100644
--- a/src/local_deep_research/web/static/js/components/progress.js
+++ b/src/local_deep_research/web/static/js/components/progress.js
@@ -1214,11 +1214,25 @@
label = '🔧 ACTION';
const tool = data.tool || 'unknown';
const args = data.arguments || {};
- stepContent = `Using ${tool}`;
- if (args.query) {
- stepContent += `\nQuery: "${args.query}"`;
- } else if (Object.keys(args).length > 0) {
- stepContent += `\nArgs: ${JSON.stringify(args, null, 2)}`;
+ // Prefer the human-readable message the strategy already
+ // built (e.g. LangGraph emits `🔍 Searching DuckDuckGo:
+ // "..."`, MCP emits `ACTION: Using DuckDuckGo - "..."`).
+ // These embed both the friendly engine name and the query,
+ // so when present we render it verbatim and skip the
+ // args/query append below to avoid duplicating the query.
+ // Fall back to `Using ${tool}` (+ args) only when no
+ // message was supplied — `data.tool` keeps the stable id
+ // (e.g. "web_search"), which is why it must not be the
+ // primary display source for the LangGraph path.
+ if (data.message) {
+ stepContent = data.message;
+ } else {
+ stepContent = `Using ${tool}`;
+ if (args.query) {
+ stepContent += `\nQuery: "${args.query}"`;
+ } else if (Object.keys(args).length > 0) {
+ stepContent += `\nArgs: ${JSON.stringify(args, null, 2)}`;
+ }
}
break;
}
@@ -1297,7 +1311,8 @@
// Expose components publicly for testing and debugging
window.progressComponent = {
checkProgress,
- handleCancelResearch
+ handleCancelResearch,
+ updateAgentThinking
};
// Add global error handler for WebSocket errors
diff --git a/tests/js/components/progress-agent-thinking.test.js b/tests/js/components/progress-agent-thinking.test.js
new file mode 100644
index 0000000000..c7f1ecafef
--- /dev/null
+++ b/tests/js/components/progress-agent-thinking.test.js
@@ -0,0 +1,90 @@
+/**
+ * Tests for the agent-thinking panel renderer in components/progress.js
+ * (the `updateAgentThinking` function).
+ *
+ * Regression coverage for the "Using web_search" display bug
+ * (PR #4470 / fix/display-actual-engine-name):
+ *
+ * The LangGraph strategy puts the friendly engine name in the progress
+ * event's `data.message` (e.g. `🔍 Searching DuckDuckGo: "..."`) while
+ * keeping the stable tool id in `data.tool` ("web_search"). The renderer
+ * must surface the friendly message, not "Using web_search".
+ *
+ * The MCP strategy puts the friendly label in `data.message`
+ * (`ACTION: Using DuckDuckGo - "..."`) AND also supplies `data.arguments`.
+ * The renderer must show the message verbatim without duplicating the
+ * query that's already embedded in it.
+ *
+ * When no message is supplied, the renderer falls back to
+ * `Using ${data.tool}` (+ args), so the panel never renders blank.
+ */
+
+let progressComponent;
+
+beforeAll(async () => {
+ // progress.js is an IIFE; importing it runs the module and exposes
+ // window.progressComponent (which now includes updateAgentThinking).
+ await import('@js/components/progress.js');
+ progressComponent = window.progressComponent;
+});
+
+beforeEach(() => {
+ // updateAgentThinking queries these two ids and appends step nodes.
+ document.body.innerHTML = `
+ <div id="agent-thinking-panel" style="display: none;">
+ <div id="agent-thinking-content"></div>
+ </div>
+ `;
+});
+
+function renderToolCall(data) {
+ progressComponent.updateAgentThinking({ phase: 'tool_call', ...data });
+ const step = document
+ .getElementById('agent-thinking-content')
+ .querySelector('.ldr-agent-step-content');
+ return step ? step.textContent : null;
+}
+
+describe('updateAgentThinking - tool_call rendering', () => {
+ it('shows the LangGraph friendly message instead of "Using web_search"', () => {
+ const content = renderToolCall({
+ tool: 'web_search', // stable id, must NOT be the display source
+ message: '🔍 Searching DuckDuckGo: "climate policy"',
+ iteration: 1,
+ });
+
+ expect(content).toBe('🔍 Searching DuckDuckGo: "climate policy"');
+ expect(content).not.toContain('web_search');
+ expect(content).not.toContain('Using ');
+ });
+
+ it('shows the MCP friendly message without duplicating the query', () => {
+ const content = renderToolCall({
+ tool: 'DuckDuckGo',
+ message: 'ACTION: Using DuckDuckGo - "climate policy"',
+ arguments: { query: 'climate policy' },
+ });
+
+ expect(content).toBe('ACTION: Using DuckDuckGo - "climate policy"');
+ // The query is embedded in the message; it must appear exactly once
+ // (no extra `\nQuery: "..."` appended from data.arguments).
+ const occurrences = content.split('climate policy').length - 1;
+ expect(occurrences).toBe(1);
+ expect(content).not.toContain('Query:');
+ });
+
+ it('falls back to "Using <tool>" with query when no message is present', () => {
+ const content = renderToolCall({
+ tool: 'web_search',
+ arguments: { query: 'climate policy' },
+ });
+
+ expect(content).toBe('Using web_search\nQuery: "climate policy"');
+ });
+
+ it('falls back to "Using unknown" when neither message nor tool is present', () => {
+ const content = renderToolCall({});
+
+ expect(content).toBe('Using unknown');
+ });
+});