From b4deb0b81e6ccd53986542c609483bfa874d399b Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 2 Apr 2026 19:18:26 -0700 Subject: [PATCH] fix: suppress fake "session ended" and timeout errors in sidebar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two issues making the sidebar look broken when it's actually working: 1. "Timed out after 300s" error displayed after agent_done — this is a cleanup timer, not a real error. Now suppressed when no active session. 2. "(session ended)" text appended on every idle poll — removed entirely. The thinking spinner is cleaned up silently instead. --- extension/sidepanel.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/extension/sidepanel.js b/extension/sidepanel.js index 963a9d91..888f9d35 100644 --- a/extension/sidepanel.js +++ b/extension/sidepanel.js @@ -209,6 +209,10 @@ function handleAgentEvent(entry) { } if (entry.type === 'agent_error') { + // Suppress timeout errors that fire after agent_done (cleanup noise) + if (entry.error && entry.error.includes('Timed out') && !agentContainer) { + return; + } const thinking = document.getElementById('agent-thinking'); if (thinking) thinking.remove(); updateStopButton(false); @@ -402,19 +406,13 @@ async function pollChat() { } // Clean up orphaned thinking indicators after replay. + // Only show "(session ended)" if there's actually a thinking spinner + // to clean up (not on every idle poll, which would spam the chat). const thinking = document.getElementById('agent-thinking'); if (thinking && data.agentStatus !== 'processing') { thinking.remove(); - if (agentContainer) { - const notice = document.createElement('div'); - notice.className = 'agent-text'; - notice.style.color = 'var(--text-meta)'; - notice.style.fontStyle = 'italic'; - notice.textContent = '(session ended)'; - agentContainer.appendChild(notice); - agentContainer = null; - agentTextEl = null; - } + agentContainer = null; + agentTextEl = null; } // Show/hide stop button based on agent status