Problem
When pycodeloop serve exits unexpectedly (crash, OOM, network error), the extension posts a processExit note and sets this.client = undefined, but takes no further action. The user must manually click "Reload Connection" from the settings menu (⚙ → Reload Connection) or run CodeLoop: Open Chat. This is disruptive during long agent runs where the CLI may restart cleanly on its own.
Steps to reproduce / context
- Start a long agent turn.
- Kill
pycodeloop serve from outside (or let it crash on a bad provider response).
- The UI shows "Disconnected" and a system note. No automatic recovery occurs.
- User must manually reload to continue.
Expected behavior
After an unexpected exit (non-zero code, or signal), the extension should attempt to reconnect automatically using exponential backoff (e.g. 2s, 4s, 8s, max 30s), up to a configurable number of attempts. If reconnection succeeds, it should restore the current session by calling loadHistory(). If all attempts fail, it should surface the error clearly and stop retrying.
Deliberate reloads triggered by the user (provider switch, settings toggle) should bypass the reconnect logic.
Suggested fix
Add a reconnect(attempt: number) method to ChatController that is called from the exit handler only when code !== 0 and !this.disposing. Back off with setTimeout(2000 * 2 ** attempt) up to a maximum retry count (e.g. 5).
Problem
When
pycodeloop serveexits unexpectedly (crash, OOM, network error), the extension posts aprocessExitnote and setsthis.client = undefined, but takes no further action. The user must manually click "Reload Connection" from the settings menu (⚙ → Reload Connection) or runCodeLoop: Open Chat. This is disruptive during long agent runs where the CLI may restart cleanly on its own.Steps to reproduce / context
pycodeloop servefrom outside (or let it crash on a bad provider response).Expected behavior
After an unexpected exit (non-zero code, or signal), the extension should attempt to reconnect automatically using exponential backoff (e.g. 2s, 4s, 8s, max 30s), up to a configurable number of attempts. If reconnection succeeds, it should restore the current session by calling
loadHistory(). If all attempts fail, it should surface the error clearly and stop retrying.Deliberate reloads triggered by the user (provider switch, settings toggle) should bypass the reconnect logic.
Suggested fix
Add a
reconnect(attempt: number)method toChatControllerthat is called from theexithandler only whencode !== 0and!this.disposing. Back off withsetTimeout(2000 * 2 ** attempt)up to a maximum retry count (e.g. 5).