Problem
When the TCP connection to the persistent copilot CLI server drops, CopilotClient does not attempt to reconnect. The entire client must be disposed and recreated, which orphans all active session event handlers and requires re-resuming every session.
Impact on PolyPilot
- Client recreation is expensive: 68 sessions must be re-resumed (~3 seconds)
- Sessions that were mid-turn lose their event streams (bystander damage)
- The user sees a Blazor surface reset as the entire session list re-renders
- Force-complete logic is needed for bystander sessions — complex workaround code
Desired SDK Behavior
Since CopilotClient connects to a persistent server (not an embedded process), it should transparently reconnect when the TCP connection drops:
- Detect connection loss internally
- Re-establish the TCP connection to the same
CliUrl / port
- Re-attach session event handlers without requiring
session.resume from the app
- Emit an informational event (e.g.,
ConnectionRestoredEvent) so the app can update UI
Current Workaround
PolyPilot disposes the old CopilotClient, creates a new one, and calls session.resume for all ~68 sessions. Sessions that were processing are force-completed with whatever response was flushed so far. The triggering session's prompt is retried on the new client.
SDK Reference
GitHub.Copilot.SDK v0.2.1 — CopilotClient persistent mode (CliUrl + AutoStart=false)
Problem
When the TCP connection to the persistent copilot CLI server drops,
CopilotClientdoes not attempt to reconnect. The entire client must be disposed and recreated, which orphans all active session event handlers and requires re-resuming every session.Impact on PolyPilot
Desired SDK Behavior
Since
CopilotClientconnects to a persistent server (not an embedded process), it should transparently reconnect when the TCP connection drops:CliUrl/ portsession.resumefrom the appConnectionRestoredEvent) so the app can update UICurrent Workaround
PolyPilot disposes the old
CopilotClient, creates a new one, and callssession.resumefor all ~68 sessions. Sessions that were processing are force-completed with whatever response was flushed so far. The triggering session's prompt is retried on the new client.SDK Reference
GitHub.Copilot.SDKv0.2.1 —CopilotClientpersistent mode (CliUrl+AutoStart=false)