Skip to content

Bug: SSE /event stream closes immediately after server.connected event #26697

Closed

Description

@lokikl

Description

Description:

The opencode server's event stream (GET /event) terminates the connection immediately after sending the initial server.connected event. No subsequent bus events (e.g., message.part.delta, message.part.updated) are received by the client, despite the server logs showing that these events are being published internally.

Environment:

Steps to reproduce:

  1. Run opencode serve.
  2. Connect to the event stream using curl -sN http://localhost:4096/event.
  3. In another terminal, send a prompt to a session via the HTTP API (e.g., using POST /session/:id/message). (or simply opencode attach http://localhost:4096 and send something)
  4. Observe that the curl connection closes immediately after the server.connected event, and no message events are streamed.

Verification:

Likely cause:

The regression appears to have been introduced between v1.14.41 and v1.14.46. A strong suspect is the introduction of HTTP API response compression in v1.14.42, which may be incorrectly buffering or terminating the long-lived SSE stream.

OpenCode version

1.14.46

Operating System

Ubuntu 24.04

Terminal

WezTerm

Activity

  1. github-actions commented on May 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. lokikl commented on May 10, 2026

    @lokikl
    Author

    I found that v1.14.41 works, but v1.14.42 is already broken. This narrows the regression window down to the changes introduced in v1.14.42.

  3. sudo-tee commented on May 11, 2026

    @sudo-tee

    This affect my opencode plugin, It does not work anymore when streaming new messages.

    sudo-tee/opencode.nvim#374

  4. KryptXBSA commented on May 11, 2026

    @KryptXBSA

    I’m experiencing the same issue. v1.14.41 works, but newer versions up to 1.14.48 are broken.

  5. dtinth commented on May 12, 2026

    @dtinth

    I am experiencing this issue too while testing Kimaki and making my own lightweight Discord bridge. It seems the /event endpoint is no longer used by first-party user interface.

    Instead, both the TUI and the Web app now uses the /global/event endpoint. Migrating the app to the new SDK method sdk.global.event worked around this issue.

  6. sudo-tee commented on May 12, 2026

    @sudo-tee

    I am experiencing this issue too while testing Kimaki and making my own lightweight Discord bridge. It seems the /event endpoint is no longer used by first-party user interface.

    Instead, both the TUI and the Web app now uses the /global/event endpoint. Migrating the app to the new SDK method sdk.global.event worked around this issue.

    Thanks for the info. Unfortunately the /global/event does not fix our issue, as the messages do not contain the text property, so we still cannot stream the events to the buffer with it.

  7. angelolloqui commented on May 12, 2026

    @angelolloqui

    Adding another data point: this regression also affects in-process plugin event delivery (via bus.subscribeAll()), not just the external SSE /event stream.

    I have a server-side plugin that subscribes to bus events to drive a status reporter. Bisecting between v1.14.41 (works) and v1.14.42 (broken) — identical to @lokikl's bisect — I captured exactly which events the plugin's event handler receives:

    v1.14.41 — outer event types seen by bus.subscribeAll():

    message.part.delta
    message.part.updated
    message.updated
    session.created
    session.diff, session.idle, session.status, session.updated, tui.toast.show
    

    v1.14.42 — outer event types seen by bus.subscribeAll():

    message.part.delta
    session.diff, session.idle, session.status, session.updated, tui.toast.show
    

    Missing in v1.14.42: message.part.updated, message.updated, session.created.

    The session data is still correctly persisted — GET /session/{id}/message returns the full assistant message with step-start, text, step-finish parts — but the bus never announces those parts to plugin subscribers. Net effect: any plugin that drives state machines off message.part.updated (step-start / text / reasoning / tool / step-finish) stops working silently.

    #26936 ("fix(tui): scope events by project", merged into dev today) appears to address the TUI side via a new event-subscription API with metadata, but it doesn't change bus.subscribeAll(), which is what plugins (and any non-TUI subscriber) use. Just flagging so the in-process plugin case isn't missed when the fix lands.

  8. sczi commented on May 13, 2026

    @sczi

    I ran into this issue with my emacs opencode integration: https://codeberg.org/sczi/opencode.el
    I switched to subscribing to the /global/event endpoint and everything is working again. @angelolloqui in 1.14.48 with the /global/event endpoint I do receive session.created, message.updated, etc events.

  9. Canahmetozguven commented on May 13, 2026

    @Canahmetozguven

    Confirming this matches our openchamber/openchamber#1258 and #27319.

    On Arch Linux with bun 1.3.13, the 1.14.41 binary unfortunately crashes on startup (segfault in bun executable — different issue from the SSE bug). This makes the clean rollback inaccessible for us.

    The HTTP API compression theory (introduced v1.14.42) is compelling — would be great if that could be verified/toggled independently of a full version change.

  10. sudo-tee commented on May 13, 2026

    @sudo-tee

    I also switched to the global/event endpoint and normalized the events so they match and it resolved the issue in the meantime

  11. angelolloqui commented on May 13, 2026

    @angelolloqui

    Thanks for the suggestion! I will try that out. Is this change documented somewhere? Such a breaking change should probably be well explained if it was intended

  12. thdxr commented on May 14, 2026

    @thdxr
    Member

    this wasn't intended we're looking into it now

  13. rekram1-node commented on May 14, 2026

    @rekram1-node
    Collaborator

    fixed: b928a1f

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