~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(logpanel): do not collapse repeated warnings/errors/milestones (#4901)
S32559b714109
diff --git a/changelog.d/+logpanel-skip-content-dedup.bugfix.md b/changelog.d/+logpanel-skip-content-dedup.bugfix.mdnew file mode 100644index 0000000000..dd2796bff6--- /dev/null+++ b/changelog.d/+logpanel-skip-content-dedup.bugfix.md@@ -0,0 +1,3 @@+Fixes a subtle data-loss bug in the Research Logs panel: identical warning, error, and milestone entries were being collapsed into a single `(N×)` counter, the same way repetitive info entries like "Status: OK" already were. Collapsing diagnostic entries like that strips the recency signal — after the second identical error you can no longer tell *when* the last failure happened, and repeated retries look like a single stuck event instead of forward progress.++The content-dedup scan now applies only to `info` entries (where collapsing repetitive noise is useful). Warning / error / milestone entries always render. The id-based dedup earlier in the pipeline still catches exact retransmits with the same id, so the bypass is strictly about *content-similar-but-distinct-events* getting the same timestamp.diff --git a/src/local_deep_research/web/static/js/components/logpanel.js b/src/local_deep_research/web/static/js/components/logpanel.jsindex 1cbcd2c717..65dc04d2ab 100644--- a/src/local_deep_research/web/static/js/components/logpanel.js+++ b/src/local_deep_research/web/static/js/components/logpanel.js@@ -960,44 +960,61 @@}}- // Secondary check for duplicate by message content (for backward compatibility)+ // Secondary check for duplicate by message content (for backward+ // compatibility with logs that lack a stable id, e.g. older socket+ // payloads). The 10-newest scan only ever applies to info entries:+ // - info is high-volume / repetitive by nature ("status: ok",+ // "heartbeat") so folding identical repeats into a (N×) badge+ // actually reduces noise without losing signal.+ // - warnings / errors / milestones are diagnostic -- collapsing+ // repeated retries or repeated failures into a single counter+ // strips the recency signal (you can't tell *when* the last+ // failure occurred) and can hide progress. Always insert.const existingEntries = consoleLogContainer.querySelectorAll('.ldr-console-log-entry');if (existingEntries.length > 0) {const message = logEntry.message || logEntry.content || '';const logType = (logEntry.type || 'info').toLowerCase();- // Check 10 most recent entries. DOM order is oldest -> newest so- // column-reverse CSS can render the newest entry at the visual top.- const start = Math.max(0, existingEntries.length - 10);- for (let i = existingEntries.length - 1; i >= start; i--) {- const entry = existingEntries[i];- const entryMessage = entry.querySelector('.ldr-log-message')?.textContent;- const entryType = entry.dataset.logType;-- // If message and type match, consider it a duplicate (unless it's a milestone)- if (entryMessage === message &&- entryType === logType &&- logType !== 'milestone') {-- SafeLogger.log('Skipping duplicate log entry by content:', message);-- // Increment counter on existing entry- let counter = parseInt(entry.dataset.counter || '1', 10);- counter++;- entry.dataset.counter = counter;-- // Update visual counter badge- if (counter > 1) {- let counterBadge = entry.querySelector('.ldr-duplicate-counter');- if (!counterBadge) {- counterBadge = document.createElement('span');- counterBadge.className = 'ldr-duplicate-counter';- entry.appendChild(counterBadge);+ if (logType !== 'info') {+ // Non-info categories always render, even when the message+ // duplicates a recent entry. The id-based dedup above still+ // catches exact retransmits with the same id.+ } else {+ // Check 10 most recent entries. DOM order is oldest -> newest so+ // column-reverse CSS can render the newest entry at the visual top.+ const start = Math.max(0, existingEntries.length - 10);+ for (let i = existingEntries.length - 1; i >= start; i--) {+ const entry = existingEntries[i];+ const entryMessage = entry.querySelector('.ldr-log-message')?.textContent;+ const entryType = entry.dataset.logType;++ // If message and type match, consider it a duplicate+ // (only ever reached for info entries; the outer+ // if/else above already short-circuited warnings,+ // errors, and milestones).+ if (entryMessage === message &&+ entryType === logType) {++ SafeLogger.log('Skipping duplicate log entry by content:', message);++ // Increment counter on existing entry+ let counter = parseInt(entry.dataset.counter || '1', 10);+ counter++;+ entry.dataset.counter = counter;++ // Update visual counter badge+ if (counter > 1) {+ let counterBadge = entry.querySelector('.ldr-duplicate-counter');+ if (!counterBadge) {+ counterBadge = document.createElement('span');+ counterBadge.className = 'ldr-duplicate-counter';+ entry.appendChild(counterBadge);+ }+ counterBadge.textContent = `(${counter}×)`;}- counterBadge.textContent = `(${counter}×)`;- }- return;+ return;+ }}}}@@ -1019,7 +1036,7 @@// Prune oldest entries if over limit to prevent unbounded DOM growth.// DOM order is oldest -> newest, so the oldest entries sit at the- // head of the NodeList. Mirrors the batch-load prune above.+ // head of the NodeList.const entries = consoleLogContainer.querySelectorAll('.ldr-console-log-entry');if (entries.length > MAX_LOG_ENTRIES) {const toRemove = entries.length - MAX_LOG_ENTRIES;diff --git a/tests/js/components/logpanel.test.js b/tests/js/components/logpanel.test.jsindex 49186bc1a2..4825b01064 100644--- a/tests/js/components/logpanel.test.js+++ b/tests/js/components/logpanel.test.js@@ -501,6 +501,135 @@ describe('addLog / loadLogs — ordering invariants', () => {});});+// Content-dedup applies only to info entries. Warning / error / milestone+// entries are diagnostic — collapsing repeated retries or repeated failures+// into a single `(N×)` counter strips the recency signal (you can no longer+// tell *when* the last failure happened) and hides forward progress. The+// id-based dedup upstream still catches exact retransmits with the same id+// for those categories; this describe block locks in the content-dedup+// bypass for non-info.+describe('addLog — content dedup bypass for non-info categories', () => {+ let container;++ function messageTextsInDomOrder(c) {+ return Array.from(c.querySelectorAll('.ldr-log-message')).map(+ (el) => el.textContent+ );+ }++ beforeEach(() => {+ container = document.getElementById('console-log-container');+ window._logPanelState.expanded = true;+ vi.useFakeTimers();+ });++ afterEach(() => {+ vi.clearAllTimers();+ vi.useRealTimers();+ });++ it('inserts two identical warning entries without collapsing them', () => {+ vi.setSystemTime(new Date('2026-05-08T12:00:00Z'));+ logPanel.addLog('retry-failed', 'warning');+ vi.setSystemTime(new Date('2026-05-08T12:00:01Z'));+ logPanel.addLog('retry-failed', 'warning');++ const entries = container.querySelectorAll('.ldr-console-log-entry');+ expect(entries.length).toBe(2);+ // Each entry stays at the initial counter of 1 (no increment).+ // The `(2×)` badge is the dedup-collapse signal — it must be+ // absent because the bypass path doesn't touch the dedup scan.+ entries.forEach((entry) => {+ expect(entry.dataset.counter).toBe('1');+ expect(entry.querySelector('.ldr-duplicate-counter')).toBeNull();+ });+ const messages = messageTextsInDomOrder(container);+ expect(messages).toEqual(['retry-failed', 'retry-failed']);+ });++ it('inserts two identical error entries without collapsing them', () => {+ vi.setSystemTime(new Date('2026-05-08T12:00:00Z'));+ logPanel.addLog('lookup failed', 'error');+ vi.setSystemTime(new Date('2026-05-08T12:00:01Z'));+ logPanel.addLog('lookup failed', 'error');++ const entries = container.querySelectorAll('.ldr-console-log-entry');+ expect(entries.length).toBe(2);+ entries.forEach((entry) => {+ expect(entry.dataset.counter).toBe('1');+ expect(entry.querySelector('.ldr-duplicate-counter')).toBeNull();+ });+ const messages = messageTextsInDomOrder(container);+ expect(messages).toEqual(['lookup failed', 'lookup failed']);+ });++ it('still collapses repeated info entries into a (N×) badge', () => {+ // Regression guard: the dedup bypass must not accidentally disable+ // dedup for info entries, which is what motivated the loop in the+ // first place.+ vi.setSystemTime(new Date('2026-05-08T12:00:00Z'));+ logPanel.addLog('heartbeat', 'info');+ vi.setSystemTime(new Date('2026-05-08T12:00:01Z'));+ logPanel.addLog('heartbeat', 'info');++ const entries = container.querySelectorAll('.ldr-console-log-entry');+ expect(entries.length).toBe(1);+ // Counter increments to 2 because the second addLog took the dedup+ // branch and incremented the existing entry's counter.+ expect(entries[0].dataset.counter).toBe('2');+ const badge = entries[0].querySelector('.ldr-duplicate-counter');+ expect(badge).not.toBeNull();+ expect(badge.textContent).toBe('(2×)');+ });++ it('still inserts each milestone entry independently', () => {+ // Pre-existing contract: identical milestones already had a+ // `logType !== 'milestone'` guard inside the dedup scan, so they+ // already rendered twice. The new bypass keeps that behavior.+ vi.setSystemTime(new Date('2026-05-08T12:00:00Z'));+ logPanel.addLog('research started', 'milestone');+ vi.setSystemTime(new Date('2026-05-08T12:00:01Z'));+ logPanel.addLog('research started', 'milestone');++ const entries = container.querySelectorAll('.ldr-console-log-entry');+ expect(entries.length).toBe(2);+ entries.forEach((entry) => {+ // No counter increment, no `(2×)` badge.+ expect(entry.dataset.counter).toBe('1');+ expect(entry.querySelector('.ldr-duplicate-counter')).toBeNull();+ });+ });++ it('bypass holds even when warnings share a recent message with a preceding info', () => {+ // Defensive: the dedup scan keys on both message *and* logType, so+ // a warning with the same text as a recent info would not have+ // been caught by the old scan either. This locks in the explicit+ // no-dedup for non-info regardless of what is in the recent window.+ vi.setSystemTime(new Date('2026-05-08T12:00:00Z'));+ logPanel.addLog('connection refused', 'info');+ vi.setSystemTime(new Date('2026-05-08T12:00:01Z'));+ logPanel.addLog('connection refused', 'warning');+ vi.setSystemTime(new Date('2026-05-08T12:00:02Z'));+ logPanel.addLog('connection refused', 'warning');++ // All three survive; neither warning has the dedup badge.+ const entries = container.querySelectorAll('.ldr-console-log-entry');+ expect(entries.length).toBe(3);++ const infoEntry = entries[0];+ expect(infoEntry.dataset.logType).toBe('info');+ expect(infoEntry.dataset.counter).toBe('1');+ expect(infoEntry.querySelector('.ldr-duplicate-counter')).toBeNull();++ const warningEntries = [entries[1], entries[2]];+ warningEntries.forEach((entry) => {+ expect(entry.dataset.logType).toBe('warning');+ expect(entry.dataset.counter).toBe('1');+ expect(entry.querySelector('.ldr-duplicate-counter')).toBeNull();+ });+ });+});+/*** Toggle handler tests — locks in the contract introduced by PR #3851.*