Problem
After a laptop sleeps and wakes, the SSE connection between the OpenCode plugin and the OpenCode server becomes stale. The connection appears open but no longer receives events. The UI may show a loading state indefinitely or fail silently.
Steps to Reproduce
- Start an OpenCode session with the plugin active
- Put laptop to sleep (close lid or system sleep)
- Wake laptop after 30+ seconds
- Attempt to continue the session
- Observe: SSE connection is stale, no events received, UI may be stuck
Expected Behavior
The plugin should detect stale SSE connections and either:
- Automatically reconnect
- Surface an error to the user
- Provide a manual reconnect action
Actual Behavior
Connection remains "open" but unresponsive. No detection, no recovery, no user-facing signal.
Environment
- OpenCode version: [to be filled]
- Plugin version: [to be filled]
- OS: macOS (likely affects all platforms)
- Sleep duration: 30+ seconds
Additional Context
Related to idle session handling (#21524) and session recovery (#21525), but this is a distinct failure mode specific to SSE connection health after system sleep/wake.
Proposed Solution
Implement SSE connection health checking:
- Heartbeat mechanism with timeout
- Exponential backoff reconnection
- User-facing connection status indicator
Problem
After a laptop sleeps and wakes, the SSE connection between the OpenCode plugin and the OpenCode server becomes stale. The connection appears open but no longer receives events. The UI may show a loading state indefinitely or fail silently.
Steps to Reproduce
Expected Behavior
The plugin should detect stale SSE connections and either:
Actual Behavior
Connection remains "open" but unresponsive. No detection, no recovery, no user-facing signal.
Environment
Additional Context
Related to idle session handling (#21524) and session recovery (#21525), but this is a distinct failure mode specific to SSE connection health after system sleep/wake.
Proposed Solution
Implement SSE connection health checking: