← Back to Kontasks
SSE Disconnect Thrashing Fix Deployed
Output
✅ SSE Disconnect Thrashing Fixed
Root Cause Analysis
The dashboard console was getting stuck in a DISCONNECTED/RECONNECTING loop due to:
- No retry limit - EventSource auto-reconnect had no maximum, causing infinite loops when server returned errors at turn completion
- Direct state mutation -
startHeartbeat()bypassed the state machine, causing inconsistent state
Fixes Applied
| console-ui.ts:597 | Replace direct state.connectionState = 'streaming' with dispatch({ type: 'stream_start' }) |
| console-streaming.ts | Add MAX_EVENTSOURCE_RETRIES = 5 to prevent infinite reconnect loops |
| Status bar | Show retry count: "Reconnecting (2/5)..." |
| Retry counter | Reset on successful connect and when starting new requests |
Behavior Change
Before: EventSource would keep retrying forever, thrashing the status between DISCONNECTED ↔ RECONNECTING
After: After 5 failed attempts, gives up and falls back to HTTP polling for final status check
Commit: 5c49a227 - Konui has been restarted with the fix
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
consolessebugfix
Created
7 Jan 2026, 7:00 pm
Updated
7 Jan 2026, 7:00 pm
Created By
claude
Raw Data
{
"id": "5c6d20a0-4133-4f70-8fe5-fa59f8bd0f33",
"type": "general",
"status": "completed",
"title": "SSE Disconnect Thrashing Fix Deployed",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:sans-serif;\">\n<h2 style=\"color:#22c55e;margin:0 0 16px 0;\">✅ SSE Disconnect Thrashing Fixed</h2>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"margin:0 0 12px 0;color:#fff;\">Root Cause Analysis</h3>\n<p style=\"color:#e0e0e0;margin:0 0 8px 0;\">The dashboard console was getting stuck in a DISCONNECTED/RECONNECTING loop due to:</p>\n<ol style=\"color:#e0e0e0;margin:0;padding-left:20px;line-height:1.8;\">\n<li><strong style=\"color:#f97316;\">No retry limit</strong> - EventSource auto-reconnect had no maximum, causing infinite loops when server returned errors at turn completion</li>\n<li><strong style=\"color:#f97316;\">Direct state mutation</strong> - <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">startHeartbeat()</code> bypassed the state machine, causing inconsistent state</li>\n</ol>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"margin:0 0 12px 0;color:#fff;\">Fixes Applied</h3>\n<table style=\"width:100%;border-collapse:collapse;\">\n<tr style=\"border-bottom:1px solid #444;\">\n<td style=\"padding:8px 0;color:#61afef;\">console-ui.ts:597</td>\n<td style=\"padding:8px 0;\">Replace direct <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">state.connectionState = 'streaming'</code> with <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">dispatch({ type: 'stream_start' })</code></td>\n</tr>\n<tr style=\"border-bottom:1px solid #444;\">\n<td style=\"padding:8px 0;color:#61afef;\">console-streaming.ts</td>\n<td style=\"padding:8px 0;\">Add <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">MAX_EVENTSOURCE_RETRIES = 5</code> to prevent infinite reconnect loops</td>\n</tr>\n<tr style=\"border-bottom:1px solid #444;\">\n<td style=\"padding:8px 0;color:#61afef;\">Status bar</td>\n<td style=\"padding:8px 0;\">Show retry count: \"Reconnecting (2/5)...\"</td>\n</tr>\n<tr>\n<td style=\"padding:8px 0;color:#61afef;\">Retry counter</td>\n<td style=\"padding:8px 0;\">Reset on successful connect and when starting new requests</td>\n</tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"margin:0 0 12px 0;color:#fff;\">Behavior Change</h3>\n<p style=\"color:#e0e0e0;margin:0;\"><strong>Before:</strong> EventSource would keep retrying forever, thrashing the status between DISCONNECTED ↔ RECONNECTING</p>\n<p style=\"color:#e0e0e0;margin:8px 0 0 0;\"><strong>After:</strong> After 5 failed attempts, gives up and falls back to HTTP polling for final status check</p>\n</div>\n\n<div style=\"background:#1a3d1a;padding:12px;border-radius:6px;border:1px solid #22c55e;\">\n<p style=\"margin:0;color:#22c55e;\"><strong>Commit:</strong> <code style=\"background:#2d2d2d;padding:2px 6px;border-radius:4px;\">5c49a227</code> - Konui has been restarted with the fix</p>\n</div>\n</div>",
"choices": [
{
"label": "Test with a prompt",
"value": "Send a test prompt to verify the SSE disconnect fix is working",
"primary": true
},
{
"label": "View commit diff",
"value": "Show me the git diff for commit 5c49a227"
},
{
"label": "Push to remote",
"value": "Push the SSE disconnect fix to the remote repository"
}
]
},
"createdBy": "claude",
"createdAt": "2026-01-07T09:00:30.841Z",
"updatedAt": "2026-01-07T09:00:31.099Z",
"scope": "vibetools",
"tags": [
"console",
"sse",
"bugfix"
],
"targetUser": "claude"
}