← Back to Kontasks
Code Audit: Fixed Remaining Old Connection Paths
Found and fixed 2 code paths still using old polling instead of EventSource
Output
🔍 Code Audit Complete
Found and fixed 2 code paths still using old polling method.
Issues Found
| Line 1830 | restoreTodoProgress() was calling pollForOutput() directly |
| Line 869 | start_polling effect handler was calling pollForOutput() directly |
Fixes Applied
Both paths now check for requestId and use reconnectWithEventSource() first:
if (state.currentRequestId) { reconnectWithEventSource(requestId, token); } else { pollForOutput(); }
Recovery Paths Now Using EventSource
- ✓
executeStream()- POST stream disconnect - ✓
start_pollingeffect - state machine recovery - ✓
restoreTodoProgress()- localStorage recovery - ✓
initialization- pending request on page load
Remaining pollForOutput() Usage
Only used as fallback when:
- No
requestIdavailable (shouldn't happen) - EventSource permanently closes (request expired)
What's Next?
All recovery paths now use EventSource. Ready for testing!
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
consolessereconnectionbugfix
Created
2 Jan 2026, 7:30 pm
Updated
2 Jan 2026, 7:30 pm
Created By
claude
Raw Data
{
"id": "2382348c-cdbd-4b1e-bdcf-bb1f8aed7e92",
"type": "general",
"status": "completed",
"title": "Code Audit: Fixed Remaining Old Connection Paths",
"description": "Found and fixed 2 code paths still using old polling instead of EventSource",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\"><h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">🔍 Code Audit Complete</h2><p style=\"color:#9ca3af;margin:0 0 16px 0;\">Found and fixed 2 code paths still using old polling method.</p><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#f97316;\">Issues Found</h4><table style=\"width:100%;border-collapse:collapse;\"><tr><td style=\"padding:8px 12px;color:#e5c07b;border-bottom:1px solid #444;width:120px;\">Line 1830</td><td style=\"padding:8px 12px;color:#e0e0e0;border-bottom:1px solid #444;\"><code>restoreTodoProgress()</code> was calling <code>pollForOutput()</code> directly</td></tr><tr><td style=\"padding:8px 12px;color:#e5c07b;\">Line 869</td><td style=\"padding:8px 12px;color:#e0e0e0;\"><code>start_polling</code> effect handler was calling <code>pollForOutput()</code> directly</td></tr></table></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#98c379;\">Fixes Applied</h4><p style=\"color:#e0e0e0;margin:0 0 8px 0;\">Both paths now check for <code>requestId</code> and use <code>reconnectWithEventSource()</code> first:</p><pre style=\"background:#1e1e1e;padding:12px;border-radius:4px;overflow-x:auto;font-size:0.85rem;margin:8px 0 0 0;\"><span style=\"color:#c678dd;\">if</span> (state.currentRequestId) {\n reconnectWithEventSource(requestId, token);\n} <span style=\"color:#c678dd;\">else</span> {\n pollForOutput();\n}</pre></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h4 style=\"margin:0 0 12px 0;color:#61afef;\">Recovery Paths Now Using EventSource</h4><ul style=\"margin:0;padding-left:20px;line-height:1.8;\"><li><span style=\"color:#98c379;\">✓</span> <code>executeStream()</code> - POST stream disconnect</li><li><span style=\"color:#98c379;\">✓</span> <code>start_polling</code> effect - state machine recovery</li><li><span style=\"color:#98c379;\">✓</span> <code>restoreTodoProgress()</code> - localStorage recovery</li><li><span style=\"color:#98c379;\">✓</span> <code>initialization</code> - pending request on page load</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h4 style=\"margin:0 0 8px 0;color:#9ca3af;\">Remaining <code>pollForOutput()</code> Usage</h4><p style=\"color:#e0e0e0;margin:0;\">Only used as fallback when:</p><ul style=\"margin:8px 0 0 0;padding-left:20px;color:#e0e0e0;\"><li>No <code>requestId</code> available (shouldn't happen)</li><li>EventSource permanently closes (request expired)</li></ul></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-top:16px;\"><h4 style=\"margin:0 0 8px 0;color:#fff;\">What's Next?</h4><p style=\"color:#9ca3af;margin:0;\">All recovery paths now use EventSource. Ready for testing!</p></div></div>",
"requestedAt": "2026-01-02T08:50:00Z",
"requestId": "400fd9cd-ada1-43b6-83e6-df12a6b7b32e"
},
"createdBy": "claude",
"createdAt": "2026-01-02T09:30:42.996Z",
"updatedAt": "2026-01-02T09:30:43.121Z",
"requestId": "400fd9cd-ada1-43b6-83e6-df12a6b7b32e",
"scope": "vibetools",
"tags": [
"console",
"sse",
"reconnection",
"bugfix"
],
"targetUser": "claude"
}