mirror of https://github.com/garrytan/gstack.git
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:
parent
16885537c2
commit
b4deb0b81e
|
|
@ -209,6 +209,10 @@ function handleAgentEvent(entry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.type === 'agent_error') {
|
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');
|
const thinking = document.getElementById('agent-thinking');
|
||||||
if (thinking) thinking.remove();
|
if (thinking) thinking.remove();
|
||||||
updateStopButton(false);
|
updateStopButton(false);
|
||||||
|
|
@ -402,20 +406,14 @@ async function pollChat() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up orphaned thinking indicators after replay.
|
// 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');
|
const thinking = document.getElementById('agent-thinking');
|
||||||
if (thinking && data.agentStatus !== 'processing') {
|
if (thinking && data.agentStatus !== 'processing') {
|
||||||
thinking.remove();
|
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;
|
agentContainer = null;
|
||||||
agentTextEl = null;
|
agentTextEl = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Show/hide stop button based on agent status
|
// Show/hide stop button based on agent status
|
||||||
updateStopButton(data.agentStatus === 'processing');
|
updateStopButton(data.agentStatus === 'processing');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue