mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-05 05:05:08 +02:00
fix: suppress fake "session ended" and timeout errors in sidebar
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.
This commit is contained in:
+8
-10
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user