Completed
on 2 Jan 2026, 7:09 pm

Output

🔍 Why Reconnect Fails on Konui Restart

The Problem

When konui restarts mid-request, the browser does try to reconnect - but it fails silently and gives up. Here's why:

What Happens

  1. Request in-flight, streaming from /api/konsole/dashboard/stream
  2. You run kon-restart-konui → server dies
  3. reader.read() throws error → catch block fires
  4. Dispatches reconnect → starts pollForOutput()
  5. Poll calls fetch('/api/dashboard/kontasks')
  6. Server is still restarting → fetch fails
  7. Error caught, logged, continues to next poll iteration
  8. After 30 failed polls (90 seconds) → times out silently

The Root Causes

1.No retry backoff - Polls every 3s even if server is down
2.Silent failures - Errors just get logged, user sees nothing
3.No "server down" detection - Doesn't distinguish network error from 404
4.No page refresh trigger - After timeout, just shows message

Proposed Fix

  1. Detect server restart - If poll fails with network error, show "Server restarting..."
  2. Add retry with backoff - Wait longer between retries when server is down
  3. Auto-refresh on recovery - When server comes back, refresh the page automatically
  4. Visual feedback - Show "Reconnecting..." status with attempt count

Quick Fix vs Proper Fix

Quick: On network error during poll, show a "Server unavailable - click to reload" message.
Proper: Implement exponential backoff + auto-refresh when server returns.

Quick Actions

Original Request

No layout configured

Details

Type General
Status Completed
Scope vibetools
Tags consolerecoveryarchitecture
Created 2 Jan 2026, 7:09 pm
Updated 2 Jan 2026, 7:09 pm
Created By claude

Raw Data

{
  "id": "152cb01a-5cac-4256-82ac-11297d6f01bc",
  "type": "general",
  "status": "completed",
  "title": "Why Reconnect Fails on Konui Restart",
  "description": "Analysis of why browser hangs when konui restarts mid-request",
  "context": {
    "output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:sans-serif;\"><h2 style=\"color:#fff;margin:0 0 16px 0;\">🔍 Why Reconnect Fails on Konui Restart</h2><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#f44336;margin:0 0 12px 0;\">The Problem</h3><p style=\"color:#e0e0e0;margin:0;\">When konui restarts mid-request, the browser <strong>does try to reconnect</strong> - but it fails silently and gives up. Here's why:</p></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#61afef;margin:0 0 12px 0;\">What Happens</h3><ol style=\"color:#e0e0e0;margin:0;padding-left:20px;line-height:2;\"><li>Request in-flight, streaming from <code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">/api/konsole/dashboard/stream</code></li><li>You run <code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">kon-restart-konui</code> → server dies</li><li><code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">reader.read()</code> throws error → catch block fires</li><li>Dispatches <code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">reconnect</code> → starts <code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">pollForOutput()</code></li><li>Poll calls <code style=\"background:#1e1e1e;padding:2px 6px;border-radius:3px;\">fetch('/api/dashboard/kontasks')</code></li><li><span style=\"color:#f44336;\"><strong>Server is still restarting</strong></span> → fetch fails</li><li>Error caught, logged, continues to next poll iteration</li><li>After 30 failed polls (90 seconds) → <strong>times out silently</strong></li></ol></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#e5c07b;margin:0 0 12px 0;\">The Root Causes</h3><table style=\"width:100%;border-collapse:collapse;\"><tr><td style=\"padding:10px;color:#f44336;font-size:1.2rem;\">1.</td><td style=\"padding:10px;color:#e0e0e0;\"><strong>No retry backoff</strong> - Polls every 3s even if server is down</td></tr><tr><td style=\"padding:10px;color:#f44336;font-size:1.2rem;\">2.</td><td style=\"padding:10px;color:#e0e0e0;\"><strong>Silent failures</strong> - Errors just get logged, user sees nothing</td></tr><tr><td style=\"padding:10px;color:#f44336;font-size:1.2rem;\">3.</td><td style=\"padding:10px;color:#e0e0e0;\"><strong>No \"server down\" detection</strong> - Doesn't distinguish network error from 404</td></tr><tr><td style=\"padding:10px;color:#f44336;font-size:1.2rem;\">4.</td><td style=\"padding:10px;color:#e0e0e0;\"><strong>No page refresh trigger</strong> - After timeout, just shows message</td></tr></table></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#98c379;margin:0 0 12px 0;\">Proposed Fix</h3><ol style=\"color:#e0e0e0;margin:0;padding-left:20px;line-height:1.8;\"><li><strong>Detect server restart</strong> - If poll fails with network error, show \"Server restarting...\"</li><li><strong>Add retry with backoff</strong> - Wait longer between retries when server is down</li><li><strong>Auto-refresh on recovery</strong> - When server comes back, refresh the page automatically</li><li><strong>Visual feedback</strong> - Show \"Reconnecting...\" status with attempt count</li></ol></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;\"><h4 style=\"margin:0 0 8px 0;color:#fff;\">Quick Fix vs Proper Fix</h4><p style=\"color:#9ca3af;margin:0;\"><strong>Quick:</strong> On network error during poll, show a \"Server unavailable - click to reload\" message.<br/><strong>Proper:</strong> Implement exponential backoff + auto-refresh when server returns.</p></div></div>",
    "requestedAt": "2026-01-02T09:30:00Z",
    "requestId": "75cfd8f6-7b33-42de-b1a9-37a61d7a1ad0",
    "choices": [
      {
        "label": "Quick fix (reload prompt)",
        "value": "quick-fix",
        "primary": true
      },
      {
        "label": "Proper fix (auto-refresh)",
        "value": "proper-fix"
      },
      {
        "label": "Add to backlog",
        "value": "backlog"
      }
    ]
  },
  "createdBy": "claude",
  "createdAt": "2026-01-02T09:09:17.161Z",
  "updatedAt": "2026-01-02T09:09:17.299Z",
  "requestId": "75cfd8f6-7b33-42de-b1a9-37a61d7a1ad0",
  "scope": "vibetools",
  "tags": [
    "console",
    "recovery",
    "architecture"
  ],
  "targetUser": "claude"
}
DashboardReportsKontasksSessionsTelemetryLogs + Go