โœ“ Completed
on 8 Jan 2026, 6:25 pm

Output

โœ“ Fixed: WebSocket Reconnection

๐Ÿ” Root Cause

When your WebSocket reconnected, the server sent turn_start with isReconnect: true, but events that occurred while you were disconnected were lost.

The architecture has two connections:

  • Browser โ†” Konui (WebSocket) - this reconnects
  • Konui โ†” Konsole (SSE) - keeps streaming events

Events from the SSE stream were being sent to the original socket object - which was disconnected!

โœ… The Fix

  1. Event buffering - Events are now stored per-user during active turns (max 500 events)
  2. Username-based routing - sendEvent() now looks up the currently connected client by username, not the original socket
  3. Replay on reconnect - When you reconnect, all buffered events are replayed to catch you up
  4. Robust delivery - sendError() and endTurn() also use username lookup

๐Ÿ“Š Commit

9d1b4232 - Fix WebSocket reconnection to resume streaming

+102/-23 lines in konui/src/console-websocket.ts

๐Ÿงช How to Test

  1. Restart konui to apply the fix
  2. Start a turn that runs for a while (e.g., "explore the codebase")
  3. Switch apps or lock your phone briefly
  4. Come back - you should see all events that occurred while away

What's Next?

Restart konui to apply this fix, then test the reconnection behavior.

Quick Actions

Original Request

No layout configured

Details

Type General
Status Completed
Scope vibetools
Tags consolewebsocketreconnectionbugfix
Created 8 Jan 2026, 6:25 pm
Updated 8 Jan 2026, 6:25 pm
Timing
โฑ๏ธ 245.4s
0 tools
โ— TTFE 0% โ— Thinking 100% โ— Tools 0%
Created By claude

๐Ÿ”— Git Commit

9d1b4232

Raw Data

{
  "id": "2b568245-cb11-4e1e-9087-4b8db2fa9c50",
  "type": "general",
  "status": "completed",
  "title": "Fixed: WebSocket Reconnection Now Resumes Streaming",
  "description": "Events are now buffered and replayed on reconnect",
  "context": {
    "output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:sans-serif;\"><h2 style=\"color:#22c55e;margin:0 0 16px 0;\">โœ“ Fixed: WebSocket Reconnection</h2><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#f59e0b;margin:0 0 12px 0;\">๐Ÿ” Root Cause</h3><p style=\"margin:0;line-height:1.6;\">When your WebSocket reconnected, the server sent <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">turn_start</code> with <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">isReconnect: true</code>, but <strong>events that occurred while you were disconnected were lost</strong>.</p><p style=\"margin:12px 0 0 0;line-height:1.6;\">The architecture has two connections:</p><ul style=\"margin:8px 0 0 0;padding-left:24px;\"><li><strong>Browser โ†” Konui</strong> (WebSocket) - this reconnects</li><li><strong>Konui โ†” Konsole</strong> (SSE) - keeps streaming events</li></ul><p style=\"margin:12px 0 0 0;\">Events from the SSE stream were being sent to the original socket object - which was disconnected!</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#22c55e;margin:0 0 12px 0;\">โœ… The Fix</h3><ol style=\"margin:0;padding-left:24px;line-height:1.8;\"><li><strong>Event buffering</strong> - Events are now stored per-user during active turns (max 500 events)</li><li><strong>Username-based routing</strong> - <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">sendEvent()</code> now looks up the currently connected client by username, not the original socket</li><li><strong>Replay on reconnect</strong> - When you reconnect, all buffered events are replayed to catch you up</li><li><strong>Robust delivery</strong> - <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">sendError()</code> and <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:4px;\">endTurn()</code> also use username lookup</li></ol></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#61afef;margin:0 0 12px 0;\">๐Ÿ“Š Commit</h3><p style=\"margin:0;\"><code style=\"background:#3d3d3d;padding:4px 8px;border-radius:4px;font-family:monospace;\">9d1b4232</code> - Fix WebSocket reconnection to resume streaming</p><p style=\"margin:8px 0 0 0;color:#7f848e;\">+102/-23 lines in konui/src/console-websocket.ts</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h3 style=\"color:#c678dd;margin:0 0 12px 0;\">๐Ÿงช How to Test</h3><ol style=\"margin:0;padding-left:24px;line-height:1.8;\"><li>Restart konui to apply the fix</li><li>Start a turn that runs for a while (e.g., \"explore the codebase\")</li><li>Switch apps or lock your phone briefly</li><li>Come back - you should see all events that occurred while away</li></ol></div><div style=\"background:#2d2d2d;padding:12px;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;\">Restart konui to apply this fix, then test the reconnection behavior.</p></div></div>",
    "requestedAt": "2026-01-08T08:25:00.000Z",
    "requestId": "40adce69-4db9-4fd4-979e-6a584b197655",
    "commitSha": "9d1b4232",
    "choices": [
      {
        "label": "Restart konui",
        "value": "Restart konui to apply the WebSocket reconnection fix",
        "primary": true
      },
      {
        "label": "Show diff",
        "value": "Show the full diff for commit 9d1b4232"
      },
      {
        "label": "Test it",
        "value": "I'll test the reconnection manually - watch for my feedback"
      }
    ],
    "turnTiming": {
      "totalMs": 245410,
      "ttfeMs": 54,
      "thinkingMs": 245356,
      "toolExecutionMs": 0,
      "toolCallCount": 0,
      "thinkingPct": 100,
      "toolsPct": 0,
      "ttfePct": 0
    }
  },
  "createdBy": "claude",
  "createdAt": "2026-01-08T08:25:51.139Z",
  "updatedAt": "2026-01-08T08:25:56.813Z",
  "requestId": "40adce69-4db9-4fd4-979e-6a584b197655",
  "scope": "vibetools",
  "tags": [
    "console",
    "websocket",
    "reconnection",
    "bugfix"
  ],
  "targetUser": "claude"
}
Loading timeline...
DashboardReportsKontasksOrphansFlowsDecisionsSessionsTelemetryLogs + Go