Skip to content

Empty SSE Events Leak Through Opencode Stream Processor #2840

Closed

Description

@shantur
  • Summary: The shared SSE client in opencode/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts emits an event for every data: stanza, even if the
    payload is empty/whitespace. Downstream code receives meaningless events, forcing consumers (e.g., the Gemini plugin) to filter them manually.
  • Impact: Plugins/tools that listen to streamed deltas must implement custom guards to avoid processing blank events. This leads to duplicated logic,
    brittle handling of real "" payloads, and wasted work for every SSE consumer.

This is visible when working with Gemini CLI OAauth

Propsed fix

opencode/packages/sdk/js/src/gen/core/serverSentEvents.gen.ts (+3 -0)
    155                    const rawData = dataLines.join("\n")
    156   +                if (!rawData.trim()) {
    157   +                  continue
    158   +                }
    159                    try {

Activity

  1. rekram1-node commented on Sep 28, 2025

    @rekram1-node
    Contributor

    @shantur do u know which event types are being sent as blank strings?

  2. self-assigned this
    on Sep 28, 2025
  3. shantur commented on Sep 28, 2025

    @shantur
    ContributorAuthor

    @rekram1-node : heartbeat was one for sure

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