~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): fix [object Object] error logging and CI test stability (#2744)
LearningCircuit26bbb9c3e3a7
diff --git a/.gitleaksignore b/.gitleaksignoreindex f796140f15..fe567155ed 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -567,3 +567,9 @@ src/local_deep_research/research_library/search/routes/search_routes.py:generic-# Auto-conversion hook — db_password variable name (false positive)src/local_deep_research/web/queue/processor_v2.py:generic-secret:357src/local_deep_research/web/queue/processor_v2.py:generic-secret:358++# search_routes.py — db_password variable (shifted line numbers, false positive)+src/local_deep_research/research_library/search/routes/search_routes.py:generic-secret:51+src/local_deep_research/research_library/search/routes/search_routes.py:generic-secret:146+src/local_deep_research/research_library/search/routes/search_routes.py:generic-secret:189+src/local_deep_research/research_library/search/routes/search_routes.py:generic-secret:273diff --git a/src/local_deep_research/web/static/js/components/research.js b/src/local_deep_research/web/static/js/components/research.jsindex bff1ac7b51..6b9251dc05 100644--- a/src/local_deep_research/web/static/js/components/research.js+++ b/src/local_deep_research/web/static/js/components/research.js@@ -1113,7 +1113,7 @@resolve(modelOptions);}).catch(error => {- SafeLogger.error('Error fetching model from database:', error);+ SafeLogger.error('Error fetching model from database:', error.message || error);// Continue with model selection using localStorageselectModelBasedOnProvider(resetSelectedModel, lastSelectedModel);resolve(modelOptions);@@ -1660,7 +1660,7 @@if (!isInitializing) onInitializationComplete();}).catch(error => {- SafeLogger.error('Error loading strategy:', error);+ SafeLogger.error('Error loading strategy:', error.message || error);// Fallback to localStorageconst lastStrategy = null; // Strategy loaded from DB@@ -1830,7 +1830,7 @@}}).catch(error => {- SafeLogger.error('Error loading models:', error);+ SafeLogger.error('Error loading models:', error.message || error);// Remove loading class on errorif (modelInput && modelInput.parentNode) {@@ -2038,7 +2038,7 @@}}).catch(error => {- SafeLogger.error('Error loading search engines:', error);+ SafeLogger.error('Error loading search engines:', error.message || error);// Remove loading class on errorif (searchEngineInput && searchEngineInput.parentNode) {diff --git a/src/local_deep_research/web/static/js/components/results.js b/src/local_deep_research/web/static/js/components/results.jsindex 9087fa3147..582890176e 100644--- a/src/local_deep_research/web/static/js/components/results.js+++ b/src/local_deep_research/web/static/js/components/results.js@@ -192,7 +192,7 @@checkContextOverflow();} catch (error) {- SafeLogger.error('Error loading research results:', error);+ SafeLogger.error('Error loading research results:', error.message || error);showError(`Error loading research results: ${error.message}`);// Disable export buttonsdiff --git a/src/local_deep_research/web/static/js/components/settings.js b/src/local_deep_research/web/static/js/components/settings.jsindex cdea850ad5..d12339213a 100644--- a/src/local_deep_research/web/static/js/components/settings.js+++ b/src/local_deep_research/web/static/js/components/settings.js@@ -4467,7 +4467,7 @@return modelOptions;}).catch(error => {- SafeLogger.error('Error loading model options:', error);+ SafeLogger.error('Error loading model options:', error.message || error);// Log but don't throw, so we can continue with default models if neededif (!modelOptions || modelOptions.length === 0) {SafeLogger.log('Using fallback model options due to error');diff --git a/src/local_deep_research/web/static/js/embedding_settings.js b/src/local_deep_research/web/static/js/embedding_settings.jsindex 34b90953bf..e0d67d2205 100644--- a/src/local_deep_research/web/static/js/embedding_settings.js+++ b/src/local_deep_research/web/static/js/embedding_settings.js@@ -64,7 +64,7 @@ async function loadAvailableModels() {showError('Failed to load available models: ' + data.error);}} catch (error) {- SafeLogger.error('Error loading models:', error);+ SafeLogger.error('Error loading models:', error.message || error);showError('Failed to load available models');}}diff --git a/src/local_deep_research/web/static/js/security/safe-logger.js b/src/local_deep_research/web/static/js/security/safe-logger.jsindex a77a8c7b38..5c87ae1d49 100644--- a/src/local_deep_research/web/static/js/security/safe-logger.js+++ b/src/local_deep_research/web/static/js/security/safe-logger.js@@ -105,6 +105,20 @@stack: value.stack};}+ // Extract .message from error-like objects (e.g., Response, custom errors)+ // so catch blocks logging raw error objects show useful text+ if (value && typeof value === 'object' && typeof value.message === 'string') {+ return value.message;+ }+ // For other objects (e.g. {error: "not found"}), stringify to avoid+ // console showing [object Object]+ if (value && typeof value === 'object') {+ try {+ return JSON.stringify(value);+ } catch (e) {+ return String(value);+ }+ }return value;}@@ -135,6 +149,11 @@};}+ // Error-like objects (e.g., Response, custom errors) — show error name+ if (value && typeof value === 'object' && typeof value.message === 'string') {+ return { name: value.name || 'Error', message: REDACTED };+ }+// Arrays - show structure but not contentsif (Array.isArray(value)) {return '[Array(' + value.length + ')]';diff --git a/src/local_deep_research/web/static/js/services/socket.js b/src/local_deep_research/web/static/js/services/socket.jsindex c17c4a2dd2..6ec7f0fee5 100644--- a/src/local_deep_research/web/static/js/services/socket.js+++ b/src/local_deep_research/web/static/js/services/socket.js@@ -56,7 +56,7 @@ window.socket = (function() {setupSocketEvents();SafeLogger.log('Socket.IO initialized with websocket+polling strategy');} catch (error) {- SafeLogger.error('Error initializing Socket.IO:', error);+ SafeLogger.error('Error initializing Socket.IO:', error.message || error);// Set a flag that we're not connected - will use polling for updatesusingPolling = true;}diff --git a/tests/ui_tests/puppeteer_config.js b/tests/ui_tests/puppeteer_config.jsindex 1724f322bf..61ae5f101e 100644--- a/tests/ui_tests/puppeteer_config.js+++ b/tests/ui_tests/puppeteer_config.js@@ -38,7 +38,11 @@ function getPuppeteerLaunchOptions(additionalOptions = {}) {'--disable-accelerated-2d-canvas','--no-first-run','--no-zygote',- '--disable-gpu'+ '--disable-gpu',+ '--disable-features=site-per-process',+ '--disable-background-timer-throttling',+ '--disable-renderer-backgrounding',+ '--disable-backgrounding-occluded-windows']};diff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.jsindex 16f5900e48..6af3f706e0 100644--- a/tests/ui_tests/run_all_tests.js+++ b/tests/ui_tests/run_all_tests.js@@ -23,8 +23,10 @@ function ts(date = new Date()) {* Prevents cascade failures when a previous test stressed the server* (e.g., registration creating encrypted databases).*/-async function waitForServer(maxWaitMs = 30000) {+async function waitForServer(maxWaitMs = 60000) {const startTime = Date.now();+ let delay = 1000;+ let wasDown = false;while (Date.now() - startTime < maxWaitMs) {try {const ok = await new Promise((resolve) => {@@ -35,13 +37,18 @@ async function waitForServer(maxWaitMs = 30000) {req.on('error', () => resolve(false));req.on('timeout', () => { req.destroy(); resolve(false); });});- if (ok) return true;+ if (ok) {+ if (wasDown) console.log('Server recovered after being unresponsive');+ return true;+ }+ wasDown = true;} catch (e) {- // ignore+ wasDown = true;}- await new Promise(r => setTimeout(r, 2000));+ await new Promise(r => setTimeout(r, delay));+ delay = Math.min(delay * 2, 8000);}- console.log(`⚠️ Server did not respond within ${maxWaitMs/1000}s, proceeding anyway...`);+ console.log(`Server did not respond within ${maxWaitMs/1000}s — subsequent tests may fail`);return false;}@@ -204,7 +211,8 @@ const tests = [{name: 'News Feed CI Tests',file: 'test_news_feed_ci.js',- description: 'Tests feed, filters, templates, subscription management'+ description: 'Tests feed, filters, templates, subscription management',+ skipCI: true, // Intermittent 60s navigation timeouts; core coverage in test_news_subscriptions_ci.js},{name: 'Settings Interactions CI Tests',@@ -247,7 +255,8 @@ const tests = [{name: 'Concurrent Limit Test',file: 'test_concurrent_limit.js',- description: 'Tests concurrent research limits'+ description: 'Tests concurrent research limits',+ skipCI: true, // Requires LLM backend — always fails without model server},// Consolidated from extended-ui-tests.yml (validation + features)@@ -267,27 +276,32 @@ const tests = [{name: 'Research Form Validation Test',file: 'test_research_form_validation.js',- description: 'Tests research form field validation'+ description: 'Tests research form field validation',+ skipCI: true, // Redundant with test_research_form_ci.js; auth frame-detachment in Docker},{name: 'Form Validation ARIA Tests',file: 'test_form_validation_aria_ci.js',- description: 'Tests inline form validation with ARIA support'+ description: 'Tests inline form validation with ARIA support',+ skipCI: true, // Auth frame-detachment in Docker causes intermittent 120s timeout},{name: 'Research Simple Test',file: 'test_research_simple.js',- description: 'Tests basic research flow'+ description: 'Tests basic research flow',+ skipCI: true, // Requires LLM backend to complete research submission},{name: 'Research Form Test',file: 'test_research_form.js',- description: 'Tests research form interactions'+ description: 'Tests research form interactions',+ skipCI: true, // Diagnostic test — requires LLM for form submission},{name: 'Research API Test',file: 'test_research_api.js',- description: 'Tests research API endpoints via UI'+ description: 'Tests research API endpoints via UI',+ skipCI: true, // Diagnostic test — requires functioning LLM API},{name: 'History Page Test',@@ -302,7 +316,8 @@ const tests = [{name: 'Queue Simple Test',file: 'test_queue_simple.js',- description: 'Tests research queue functionality'+ description: 'Tests research queue functionality',+ skipCI: true, // Requires LLM backend — always fails without model server},// Consolidated from mobile-ui-tests.ymldiff --git a/tests/ui_tests/test_auth_comprehensive_ci.js b/tests/ui_tests/test_auth_comprehensive_ci.jsindex 62f66549af..49ecac2641 100644--- a/tests/ui_tests/test_auth_comprehensive_ci.js+++ b/tests/ui_tests/test_auth_comprehensive_ci.js@@ -125,7 +125,7 @@ const LoginPageTests = {// Submit the formawait Promise.all([page.click('button[type="submit"], input[type="submit"], .btn-primary'),- page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 5000 })+ page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 10000 }).catch(() => {})]);await delay(1000); // Extra delay for error message to appear@@ -235,7 +235,7 @@ const LoginPageTests = {// Click and navigateawait Promise.all([page.click('a[href*="register"]'),- page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 5000 })+ page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 10000 }).catch(() => {})]);const onRegisterPage = page.url().includes('register');@@ -573,7 +573,7 @@ const SessionTests = {// Click logoutawait Promise.all([page.click('a[href*="logout"]').catch(() => page.click('.logout-btn')),- page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 5000 })+ page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 10000 }).catch(() => {})]);// Verify logged outdiff --git a/tests/ui_tests/test_concurrent_limit.js b/tests/ui_tests/test_concurrent_limit.jsindex 45c54203bc..483e2b1cc9 100644--- a/tests/ui_tests/test_concurrent_limit.js+++ b/tests/ui_tests/test_concurrent_limit.js@@ -102,6 +102,8 @@ async function submitResearchBatch(page, queries) {const page = await browser.newPage();+ let testPassed = false;+try {// Authenticate (tries CI user first, falls back to registration)const auth = new AuthHelper(page);@@ -143,6 +145,7 @@ async function submitResearchBatch(page, queries) {if (started === 3 && queued === 2) {console.log('\n✅ SUCCESS: Concurrent limit working correctly!');+ testPassed = true;} else {console.log('\n❌ FAILURE: Expected 3 started and 2 queued');}@@ -151,5 +154,6 @@ async function submitResearchBatch(page, queries) {console.error('Test failed:', error);} finally {await browser.close();+ process.exit(testPassed ? 0 : 1);}})();diff --git a/tests/ui_tests/test_login_validation.js b/tests/ui_tests/test_login_validation.jsindex fbc2deec05..40a3140ea7 100644--- a/tests/ui_tests/test_login_validation.js+++ b/tests/ui_tests/test_login_validation.js@@ -320,7 +320,11 @@ async function testLoginValidation() {await browser.close();console.log('\n✅ Test completed successfully');+ process.exit(0);}// Run the test-testLoginValidation().catch(console.error);+testLoginValidation().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_queue_simple.js b/tests/ui_tests/test_queue_simple.jsindex 6660b5f3ca..c9ed33a63b 100644--- a/tests/ui_tests/test_queue_simple.js+++ b/tests/ui_tests/test_queue_simple.js@@ -111,6 +111,8 @@ async function submitResearch(page, query, index) {console.log('PAGE CRASH:', error.message);});+ let testPassed = false;+try {// Register and loginconst auth = new AuthHelper(page);@@ -153,18 +155,18 @@ async function submitResearch(page, query, index) {// In CI, network issues might cause some to failif (started >= 1 && (started + queued) >= 3) {console.log('\n✅ SUCCESS: Queue system working correctly!');+ testPassed = true;} else if (started >= 2) {console.log('\n✅ SUCCESS: Multiple researches started successfully');+ testPassed = true;} else {console.log(`\n❌ FAILED: Only ${started} started, ${queued} queued, ${failed} failed`);}- // Keep browser open for 5 seconds to see results- await new Promise(resolve => setTimeout(resolve, 5000));-} catch (error) {console.error('Test failed:', error);} finally {await browser.close();+ process.exit(testPassed ? 0 : 1);}})();diff --git a/tests/ui_tests/test_register_full_flow.js b/tests/ui_tests/test_register_full_flow.jsindex 87062a480c..f9c905b2f2 100644--- a/tests/ui_tests/test_register_full_flow.js+++ b/tests/ui_tests/test_register_full_flow.js@@ -442,7 +442,11 @@ async function testRegisterFullFlow() {await browser.close();console.log('\n✅ Test completed successfully');+ process.exit(0);}// Run the test-testRegisterFullFlow().catch(console.error);+testRegisterFullFlow().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_register_validation.js b/tests/ui_tests/test_register_validation.jsindex 0b9c4000d1..bff1860f32 100644--- a/tests/ui_tests/test_register_validation.js+++ b/tests/ui_tests/test_register_validation.js@@ -610,7 +610,11 @@ async function testRegisterValidation() {await browser.close();console.log('\n✅ Test completed successfully');+ process.exit(0);}// Run the test-testRegisterValidation().catch(console.error);+testRegisterValidation().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_research_api.js b/tests/ui_tests/test_research_api.jsindex 4c73ee0ab8..399b643eb5 100644--- a/tests/ui_tests/test_research_api.js+++ b/tests/ui_tests/test_research_api.js@@ -190,7 +190,11 @@ async function testResearchAPI() {await browser.close();console.log('\n🏁 Test completed');+ process.exit(0);}// Run the test-testResearchAPI().catch(console.error);+testResearchAPI().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_research_form.js b/tests/ui_tests/test_research_form.jsindex fbab6b4b3c..06aa09b522 100644--- a/tests/ui_tests/test_research_form.js+++ b/tests/ui_tests/test_research_form.js@@ -225,12 +225,13 @@ async function testResearchForm() {console.error('\n❌ Test failed:', error.message);}- console.log('\n⏸️ Keeping browser open for inspection...');- await new Promise(resolve => setTimeout(resolve, 10000));-await browser.close();console.log('🏁 Test ended');+ process.exit(0);}// Run the test-testResearchForm().catch(console.error);+testResearchForm().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_research_form_validation.js b/tests/ui_tests/test_research_form_validation.jsindex a49020e94b..6bbbf11477 100644--- a/tests/ui_tests/test_research_form_validation.js+++ b/tests/ui_tests/test_research_form_validation.js@@ -239,7 +239,11 @@ async function testResearchFormValidation() {await browser.close();console.log('\n✅ Test completed successfully');+ process.exit(0);}// Run the test-testResearchFormValidation().catch(console.error);+testResearchFormValidation().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_research_simple.js b/tests/ui_tests/test_research_simple.jsindex 506fc9cfe9..5cf76690da 100644--- a/tests/ui_tests/test_research_simple.js+++ b/tests/ui_tests/test_research_simple.js@@ -18,6 +18,7 @@ async function testSimpleResearch() {const page = await browser.newPage();const baseUrl = 'http://127.0.0.1:5000';const authHelper = new AuthHelper(page, baseUrl);+ let testPassed = false;console.log('🔬 Simple Research Test\n');@@ -168,6 +169,7 @@ async function testSimpleResearch() {if (finalState.url.includes('/research/') || finalState.url.includes('/progress')) {console.log('\n✅ Research started successfully!');console.log(` Research ID: ${finalState.url.split('/').pop()}`);+ testPassed = true;} else if (finalState.alerts.some(a => a.type === 'error')) {console.log('\n❌ Research failed to start - error shown');} else {@@ -181,7 +183,11 @@ async function testSimpleResearch() {await browser.close();console.log('\n🏁 Test completed');+ process.exit(testPassed ? 0 : 1);}// Run the test-testSimpleResearch().catch(console.error);+testSimpleResearch().catch(error => {+ console.error('Fatal error:', error);+ process.exit(1);+});diff --git a/tests/ui_tests/test_results_exports_ci.js b/tests/ui_tests/test_results_exports_ci.jsindex 8c4334a695..1eab10383e 100644--- a/tests/ui_tests/test_results_exports_ci.js+++ b/tests/ui_tests/test_results_exports_ci.js@@ -14,20 +14,17 @@ const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeou// Helper to find a completed research// ============================================================================async function findCompletedResearch(page, baseUrl) {- await navigateTo(page, `${baseUrl}/history`);-- return await page.evaluate(() => {- // Look for completed research with results link- const resultsLink = document.querySelector('a[href*="/results/"]');- if (resultsLink) {- const match = resultsLink.href.match(/\/results\/([a-zA-Z0-9-]+)/);- return match ? match[1] : null;+ return await page.evaluate(async (url) => {+ try {+ const response = await fetch(`${url}/history/api`);+ if (!response.ok) return null;+ const data = await response.json();+ const completed = data.items?.find(item => item.status === 'completed');+ return completed?.id || null;+ } catch (e) {+ return null;}-- // Try data attributes- const item = document.querySelector('[data-research-id], [data-id]');- return item?.dataset?.researchId || item?.dataset?.id;- });+ }, baseUrl);}// ============================================================================