Skip to content

[BUG] SSE connection becomes stale after laptop sleep/wake — no detection or recovery #21716

Closed as not planned

Description

@aokuwa-lila

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

  1. Start an OpenCode session with the plugin active
  2. Put laptop to sleep (close lid or system sleep)
  3. Wake laptop after 30+ seconds
  4. Attempt to continue the session
  5. 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

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 9, 2026
  2. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions