Skip to content

Streaming content duplication during LLM streaming in desktop/web UI #14822

@PrakharMNNIT

Description

@PrakharMNNIT

Bug Description

During LLM streaming in the desktop UI (and web app), text content appears duplicated/repeated. After quit+reopen, content displays correctly (loaded from DB).

Steps to Reproduce

  1. Open the opencode desktop app or web UI
  2. Send a message to trigger LLM streaming
  3. Observe the streaming text output — content appears repeated/duplicated
  4. Quit and reopen the app — content now displays correctly

Expected Behavior

Streaming text should appear incrementally without duplication.

Actual Behavior

Text content is duplicated during streaming. For example, instead of showing Hello world, the UI shows Hello worldHello world.

Root Cause

In global-sdk.tsx, SSE events are batched in 16ms windows with coalescing. When message.part.updated events coalesce within a single batch (text-end replaces text-start at the same queue index), stale message.part.delta events remain in the queue and get applied on top of the authoritative full text.

Environment

  • Platform: macOS (desktop app via Tauri), also affects web UI
  • Observed on latest dev branch

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions