~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(ui): render the progress page's error toasts instead of dropping them (#7015)
Ziyang Guo10014cd17f11
diff --git a/changelog.d/+progress-error-toast-arity.bugfix.md b/changelog.d/+progress-error-toast-arity.bugfix.mdnew file mode 100644index 0000000000..278467312a--- /dev/null+++ b/changelog.d/+progress-error-toast-arity.bugfix.md@@ -0,0 +1 @@+Cancelling research from the progress page now reports the failure instead of leaving the user with a re-enabled Cancel button and no explanation, and reaching the progress page without a research id now explains the redirect home rather than performing it silently. Both paths called the shared `window.ui.showError` helper with the message as its only argument, but that helper's first argument is a **container id** — so it resolved no element and rendered nothing. Both now route through `window.ui.showMessage(message, 'error')`, the toast API the rest of the progress page already uses.diff --git a/src/local_deep_research/web/static/js/components/progress.js b/src/local_deep_research/web/static/js/components/progress.jsindex 4e1a03c048..bfd4f39af6 100644--- a/src/local_deep_research/web/static/js/components/progress.js+++ b/src/local_deep_research/web/static/js/components/progress.js@@ -41,7 +41,16 @@if (!currentResearchId) {SafeLogger.error('No research ID found');- if (window.ui) window.ui.showError('No active research found. Please start a new research.');+ // Route through showMessage, not window.ui.showError: that one+ // takes a CONTAINER id as its first argument, so handing it the+ // message resolves no element and renders nothing — the user+ // would get the redirect with no explanation for it.+ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage(+ 'No active research found. Please start a new research.',+ 'error'+ );+ }setTimeout(() => {URLValidator.safeAssign(window.location, 'href', '/');}, 3000);@@ -875,9 +884,15 @@cancelButton.innerHTML = '<i class="fas fa-stop-circle"></i> Cancel Research';}- // Show error message- if (window.ui) {- window.ui.showError('Failed to cancel research. Please try again.');+ // Show error message. showMessage, not window.ui.showError: the+ // latter takes a container id as its first argument, so passing+ // the message there resolves no element and the user is left+ // with a re-enabled button and no explanation.+ if (window.ui && window.ui.showMessage) {+ window.ui.showMessage(+ 'Failed to cancel research. Please try again.',+ 'error'+ );}}}diff --git a/tests/js/components/progress-cancellation-runtime.test.js b/tests/js/components/progress-cancellation-runtime.test.jsindex 4e9804f37f..f121fd3ec4 100644--- a/tests/js/components/progress-cancellation-runtime.test.js+++ b/tests/js/components/progress-cancellation-runtime.test.js@@ -134,10 +134,15 @@ it('restores the cancel control and reports an API failure', async () => {expect(cancelButton.style.display).not.toBe('none');expect(document.getElementById('status-text').textContent).toBe('In progress');- expect(window.ui.showError).toHaveBeenCalledWith(+ // showMessage(message, 'error'), NOT window.ui.showError(message): the+ // shared helper's first argument is a container id, so a bare message+ // resolves no element and renders nothing. Mocking showError let that+ // pass while production dropped the message on the floor.+ expect(window.ui.showError).not.toHaveBeenCalled();+ expect(window.ui.showMessage).toHaveBeenCalledWith('Failed to cancel research. Please try again.',+ 'error',);- expect(window.ui.showMessage).not.toHaveBeenCalled();});it.each(['success', 'failure'])('keeps completion when the pending Cancel ends in %s', async outcome => {diff --git a/tests/js/components/progress-fallback-runtime.test.js b/tests/js/components/progress-fallback-runtime.test.jsindex 5a98e1a08f..5614be1711 100644--- a/tests/js/components/progress-fallback-runtime.test.js+++ b/tests/js/components/progress-fallback-runtime.test.js@@ -83,6 +83,7 @@ afterEach(() => {delete window.addConsoleLog;delete window.progressComponent;delete window.showNotification;+ delete window.ui;delete window.ResearchStates;delete window.RESEARCH_STATUS;});@@ -175,3 +176,33 @@ it('cleans service-owned polling before preserving a navigation callback', asyncexpect(clearIntervalSpy).toHaveBeenCalledWith(pollingTimer);expect(originalNavigation).toHaveBeenCalledOnce();});++it('explains the missing-research-id redirect with an error toast', async () => {+ vi.stubGlobal('URLBuilder', window.URLBuilder);+ vi.stubGlobal('URLValidator', { safeAssign: vi.fn() });+ vi.stubGlobal('ResearchStates', window.ResearchStates);+ vi.stubGlobal('Notification', { permission: 'denied' });+ vi.spyOn(window.URLBuilder, 'extractResearchIdFromPattern')+ .mockReturnValue(null);+ const showMessage = vi.fn();+ const showError = vi.fn();+ window.ui = { showMessage, showError };++ await importAndInitializeProgress();++ // window.ui.showError takes a CONTAINER id as its first argument, so+ // passing the message there resolves no element and renders nothing —+ // the redirect landed with no explanation for it.+ expect(showError).not.toHaveBeenCalled();+ expect(showMessage).toHaveBeenCalledWith(+ 'No active research found. Please start a new research.',+ 'error',+ );++ await vi.advanceTimersByTimeAsync(3000);+ expect(window.URLValidator.safeAssign).toHaveBeenCalledWith(+ window.location,+ 'href',+ '/',+ );+});