Problem
When the TCP connection between CopilotClient and the copilot CLI server drops, the SDK provides no notification. PolyPilot only discovers the dead connection when SendAsync throws a connection error — at which point the user has already typed a message and hit send.
Impact on PolyPilot
- All in-flight sessions lose their event streams when the client is recreated
- Sessions that were mid-turn must be force-completed with partial/empty responses
- The user sees a brief Blazor surface reset as all sessions re-resume
- Observed today (2026-04-07): reconnect at 16:50 UTC caused 2 bystander sessions (Mobile-Fixes, maui-CIQuestions) to lose their in-flight responses
Desired SDK Behavior
CopilotClient should expose an OnDisconnected or OnConnectionLost event/callback. This would allow PolyPilot to:
- Detect dead connections proactively (before the user tries to send)
- Show a connection status indicator in the UI
- Auto-reconnect in the background without disrupting the user
Current Workaround
PolyPilot catches connection errors in SendAsync, recreates the CopilotClient, re-resumes all sibling sessions, and force-completes any sessions that were mid-turn with dead event streams. This works but causes response loss for bystander sessions.
SDK Reference
GitHub.Copilot.SDK v0.2.1 — CopilotClient has no disconnect/connection-health API surface.
Problem
When the TCP connection between
CopilotClientand the copilot CLI server drops, the SDK provides no notification. PolyPilot only discovers the dead connection whenSendAsyncthrows a connection error — at which point the user has already typed a message and hit send.Impact on PolyPilot
Desired SDK Behavior
CopilotClientshould expose anOnDisconnectedorOnConnectionLostevent/callback. This would allow PolyPilot to:Current Workaround
PolyPilot catches connection errors in
SendAsync, recreates theCopilotClient, re-resumes all sibling sessions, and force-completes any sessions that were mid-turn with dead event streams. This works but causes response loss for bystander sessions.SDK Reference
GitHub.Copilot.SDKv0.2.1 —CopilotClienthas no disconnect/connection-health API surface.