← Back to Kontasks
SSE Recovery Bug Fixed
Found and fixed the currentRequestId undefined error causing recovery failures
Output
🎯 Bug Found and Fixed!
Root Cause
ReferenceError: currentRequestId is not defined // The bug was in checkForNewKontask() and checkForProgress(): const requestId = currentRequestId || localStorage.getItem(...); ↑ undefined variable! // Should have been: const requestId = state.currentRequestId || localStorage.getItem(...);
What Was Happening
From your server logs at 07:45-07:47:
07:45:33 ✓ Stream complete - Claude finished 07:45:33 ⚠ reconnect → start_polling 07:45:33 ✗ Stream error: "currentRequestId is not defined" 07:45:36 ✗ Poll error #1: "currentRequestId is not defined" 07:45:39 ✗ Poll error #2: "currentRequestId is not defined" ... (30 total poll errors) 07:47:03 ⚠ Polling timed out 07:47:47 ✓ Page refresh → history loaded → kontask found
Every poll attempt threw an exception because currentRequestId wasn't a defined variable. The fallback to localStorage was never reached.
The Fix
Two lines changed in dashboard-console.ts:
| Line 1895 | currentRequestId → state.currentRequestId |
| Line 1964 | currentRequestId → state.currentRequestId |
Why This Slipped Through
The bug only manifested when:
- SSE stream ended successfully
- But connection dropped before kontask card rendered
- Recovery polling triggered via
reconnectevent - Polling loop tried to check for kontask
- Exception thrown → poll failed → 30 retries all failed
Normal happy path (no disconnect) never hit this code path.
What's Next?
Konui has been restarted with the fix. Try triggering a disconnect scenario again to verify recovery works.
Should I commit this fix?
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
consolessebugfix
Created
2 Jan 2026, 5:54 pm
Updated
2 Jan 2026, 5:54 pm
Created By
claude
Raw Data
{
"id": "ae4b8916-5fb4-4383-8793-3adb9a19f6ed",
"type": "general",
"status": "completed",
"title": "SSE Recovery Bug Fixed",
"description": "Found and fixed the currentRequestId undefined error causing recovery failures",
"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;\">🎯 Bug Found and Fixed!</h2>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h4 style=\"margin:0 0 12px 0;color:#ef4444;\">Root Cause</h4>\n<pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;font-family:monospace;font-size:0.8rem;overflow-x:auto;margin:0;color:#e0e0e0;\"><span style=\"color:#ef4444;\">ReferenceError: currentRequestId is not defined</span>\n\n<span style=\"color:#7f848e;\">// The bug was in checkForNewKontask() and checkForProgress():</span>\nconst requestId = <span style=\"color:#ef4444;\">currentRequestId</span> || localStorage.getItem(...);\n <span style=\"color:#ef4444;\">↑ undefined variable!</span>\n\n<span style=\"color:#7f848e;\">// Should have been:</span>\nconst requestId = <span style=\"color:#22c55e;\">state.currentRequestId</span> || localStorage.getItem(...);</pre>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h4 style=\"margin:0 0 12px 0;color:#61afef;\">What Was Happening</h4>\n<p style=\"color:#9ca3af;margin:0 0 8px 0;\">From your server logs at 07:45-07:47:</p>\n<pre style=\"background:#1a1a1a;padding:12px;border-radius:4px;font-family:monospace;font-size:0.75rem;overflow-x:auto;margin:0;color:#e0e0e0;\">07:45:33 <span style=\"color:#22c55e;\">✓</span> Stream complete - Claude finished\n07:45:33 <span style=\"color:#f59e0b;\">⚠</span> reconnect → start_polling\n07:45:33 <span style=\"color:#ef4444;\">✗</span> Stream error: \"currentRequestId is not defined\"\n07:45:36 <span style=\"color:#ef4444;\">✗</span> Poll error #1: \"currentRequestId is not defined\"\n07:45:39 <span style=\"color:#ef4444;\">✗</span> Poll error #2: \"currentRequestId is not defined\"\n... <span style=\"color:#7f848e;\">(30 total poll errors)</span>\n07:47:03 <span style=\"color:#f59e0b;\">⚠</span> Polling timed out\n07:47:47 <span style=\"color:#22c55e;\">✓</span> Page refresh → history loaded → kontask found</pre>\n<p style=\"color:#9ca3af;margin:12px 0 0 0;\">Every poll attempt threw an exception because <code style=\"background:#3d3d5c;padding:2px 6px;border-radius:4px;\">currentRequestId</code> wasn't a defined variable. The fallback to localStorage was never reached.</p>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h4 style=\"margin:0 0 12px 0;color:#22c55e;\">The Fix</h4>\n<p style=\"color:#9ca3af;margin:0 0 8px 0;\">Two lines changed in <code style=\"background:#3d3d5c;padding:2px 6px;border-radius:4px;\">dashboard-console.ts</code>:</p>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.85rem;margin-top:8px;\">\n<tr style=\"border-bottom:1px solid #444;\">\n<td style=\"padding:8px;color:#9ca3af;\">Line 1895</td>\n<td style=\"padding:8px;font-family:monospace;\"><span style=\"color:#ef4444;\">currentRequestId</span> → <span style=\"color:#22c55e;\">state.currentRequestId</span></td>\n</tr>\n<tr>\n<td style=\"padding:8px;color:#9ca3af;\">Line 1964</td>\n<td style=\"padding:8px;font-family:monospace;\"><span style=\"color:#ef4444;\">currentRequestId</span> → <span style=\"color:#22c55e;\">state.currentRequestId</span></td>\n</tr>\n</table>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h4 style=\"margin:0 0 12px 0;color:#c678dd;\">Why This Slipped Through</h4>\n<p style=\"color:#e0e0e0;margin:0;\">The bug only manifested when:</p>\n<ol style=\"margin:8px 0 0 0;padding-left:20px;color:#e0e0e0;line-height:1.8;\">\n<li>SSE stream ended successfully</li>\n<li>But connection dropped <strong>before</strong> kontask card rendered</li>\n<li>Recovery polling triggered via <code style=\"background:#3d3d5c;padding:2px 6px;border-radius:4px;\">reconnect</code> event</li>\n<li>Polling loop tried to check for kontask</li>\n<li>Exception thrown → poll failed → 30 retries all failed</li>\n</ol>\n<p style=\"color:#9ca3af;margin:12px 0 0 0;\">Normal happy path (no disconnect) never hit this code path.</p>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\">\n<h4 style=\"margin:0 0 12px 0;color:#fff;\">What's Next?</h4>\n<p style=\"color:#9ca3af;margin:0;\">Konui has been restarted with the fix. Try triggering a disconnect scenario again to verify recovery works.</p>\n<p style=\"color:#e0e0e0;margin:12px 0 0 0;\">Should I commit this fix?</p>\n</div>\n</div>",
"requestedAt": "2026-01-02T09:50:00Z",
"requestId": "55234f27-5eba-4047-a61e-b93a63ebbf49",
"choices": [
{
"label": "Yes, commit the fix",
"value": "commit-fix",
"primary": true
},
{
"label": "Test first, then commit",
"value": "test-first"
}
]
},
"createdBy": "claude",
"createdAt": "2026-01-02T07:54:22.942Z",
"updatedAt": "2026-01-02T07:54:23.079Z",
"requestId": "55234f27-5eba-4047-a61e-b93a63ebbf49",
"scope": "vibetools",
"tags": [
"console",
"sse",
"bug",
"fix"
],
"targetUser": "claude"
}