Completed
on 8 Jan 2026, 5:36 pm

Output

🔌 WebSocket Reconnection Fix

✓ Problem Fixed

Mobile browser connection pauses (screen off, app switch) would lose active turn state on reconnect, showing a "shadow" console with no live updates.

Key Changes

  • console-websocket.ts - Track active turns by username (not WebSocket clientId)
  • console-websocket.ts - Send activeTurn state in 'connected' message on reconnect
  • console-websocket.ts - Send turn_start with isReconnect: true for active turns
  • console-websocket-client.ts - Handle reconnection state sync in client
  • console-websocket-client.ts - Reset recovery flags to allow re-recovery

How It Works

// Server tracks turns by username, not WebSocket connection
activeTurnsByUser: Map<string, ActiveTurnState>

// On reconnect:
1. Server checks activeTurnsByUser.get(username)
2. If found, sends 'connected' with activeTurn data
3. Follows with 'turn_start' + isReconnect: true
4. Client resets recovery flags, resumes streaming

Verification

Type check✓ Passed
Lint✓ Passed (pre-existing warning)
Tests✓ All 27 passed
Commit✓ fe43584c

⚡ Testing Required

To verify the fix, restart konui and test on mobile:

  1. Start a Claude turn
  2. Switch to another app or turn screen off for 30+ seconds
  3. Return to browser - should reconnect and resume streaming

What's Next?

Choose an action:

Quick Actions

Original Request

No layout configured

Details

Type General
Status Completed
Scope vibetools
Tags consolewebsocketmobilereconnect
Created 8 Jan 2026, 5:36 pm
Updated 8 Jan 2026, 5:36 pm
Created By claude

🔗 Git Commit

fe43584c

Raw Data

{
  "id": "cce68f03-1015-4421-a83e-8751ef5c9e2d",
  "type": "general",
  "status": "completed",
  "title": "Turn: WebSocket Reconnection Fix Implementation",
  "context": {
    "output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\">\n<h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">🔌 WebSocket Reconnection Fix</h2>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h4 style=\"margin:0 0 12px 0;color:#22c55e;\">✓ Problem Fixed</h4>\n<p style=\"margin:0;color:#9ca3af;\">Mobile browser connection pauses (screen off, app switch) would lose active turn state on reconnect, showing a \"shadow\" console with no live updates.</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:#3b82f6;\">Key Changes</h4>\n<ul style=\"margin:0;padding-left:20px;line-height:1.8;color:#e0e0e0;\">\n<li><span style=\"color:#98c379;\">console-websocket.ts</span> - Track active turns by username (not WebSocket clientId)</li>\n<li><span style=\"color:#98c379;\">console-websocket.ts</span> - Send <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:3px;\">activeTurn</code> state in 'connected' message on reconnect</li>\n<li><span style=\"color:#98c379;\">console-websocket.ts</span> - Send <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:3px;\">turn_start</code> with <code style=\"background:#3d3d3d;padding:2px 6px;border-radius:3px;\">isReconnect: true</code> for active turns</li>\n<li><span style=\"color:#e5c07b;\">console-websocket-client.ts</span> - Handle reconnection state sync in client</li>\n<li><span style=\"color:#e5c07b;\">console-websocket-client.ts</span> - Reset recovery flags to allow re-recovery</li>\n</ul>\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:#f59e0b;\">How It Works</h4>\n<pre style=\"background:#3d3d3d;padding:12px;border-radius:4px;overflow-x:auto;font-size:0.9rem;\">\n<span style=\"color:#7f848e;\">// Server tracks turns by username, not WebSocket connection</span>\n<span style=\"color:#c678dd;\">activeTurnsByUser</span>: Map&lt;string, ActiveTurnState&gt;\n\n<span style=\"color:#7f848e;\">// On reconnect:</span>\n1. Server checks <span style=\"color:#c678dd;\">activeTurnsByUser.get(username)</span>\n2. If found, sends <span style=\"color:#98c379;\">'connected'</span> with activeTurn data\n3. Follows with <span style=\"color:#98c379;\">'turn_start'</span> + isReconnect: true\n4. Client resets recovery flags, resumes streaming\n</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:#8b5cf6;\">Verification</h4>\n<table style=\"width:100%;border-collapse:collapse;\">\n<tr><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;\">Type check</td><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;color:#22c55e;\">✓ Passed</td></tr>\n<tr><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;\">Lint</td><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;color:#22c55e;\">✓ Passed (pre-existing warning)</td></tr>\n<tr><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;\">Tests</td><td style=\"padding:8px 12px;border-bottom:1px solid #4b5563;color:#22c55e;\">✓ All 27 passed</td></tr>\n<tr><td style=\"padding:8px 12px;\">Commit</td><td style=\"padding:8px 12px;color:#22c55e;\">✓ fe43584c</td></tr>\n</table>\n</div>\n\n<div style=\"background:#1e3a5f;padding:16px;border-radius:6px;border:1px solid #3b82f6;\">\n<h4 style=\"margin:0 0 8px 0;color:#fff;\">⚡ Testing Required</h4>\n<p style=\"margin:0;color:#9ca3af;\">To verify the fix, restart konui and test on mobile:</p>\n<ol style=\"margin:8px 0 0 0;padding-left:20px;color:#e0e0e0;line-height:1.8;\">\n<li>Start a Claude turn</li>\n<li>Switch to another app or turn screen off for 30+ seconds</li>\n<li>Return to browser - should reconnect and resume streaming</li>\n</ol>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-top:16px;\">\n<h4 style=\"margin:0 0 8px 0;color:#fff;\">What's Next?</h4>\n<p style=\"color:#9ca3af;margin:0;\">Choose an action:</p>\n</div>\n</div>",
    "choices": [
      {
        "label": "Restart konui",
        "value": "Restart konui service to apply the WebSocket reconnection fixes",
        "primary": true
      },
      {
        "label": "Show diff",
        "value": "Show the full git diff of the WebSocket reconnection changes"
      },
      {
        "label": "View modified files",
        "value": "Read the modified console-websocket.ts and console-websocket-client.ts files to review the changes"
      }
    ],
    "commitSha": "fe43584c"
  },
  "createdBy": "claude",
  "createdAt": "2026-01-08T07:36:08.546Z",
  "updatedAt": "2026-01-08T07:36:08.793Z",
  "scope": "vibetools",
  "tags": [
    "console",
    "websocket",
    "mobile",
    "reconnect"
  ],
  "targetUser": "claude"
}
DashboardReportsKontasksFlowsDecisionsSessionsTelemetryLogs + Go