Skip to content

[Bug] Web UI: Duplicate text rendering during streaming due to dual render path race condition in session-turn.tsx #14280

Closed

Description

@844700118

Description:

What's happening

Noticed something weird in the web UI - sometimes when the AI is streaming a response, the text shows up twice. Like, you'll see the full response finish streaming, then bam - duplicate paragraphs appear out of nowhere. Been seeing this more often after tool calls finish.

Setup

  • opencode serve --print-logs --log-level=INFO
  • OpenCode v1.2.6
  • Web interface on Windows 11, Chrome
  • Happens randomly but seems worse with longer responses

How to reproduce

  1. Just use the web UI normally
  2. Ask something that gets a decent-length reply (I usually ask for code examples)
  3. Watch carefully as it streams in
  4. Sometimes right at the end, you'll see text doubled up

What I think is going on

Been digging through session-turn.tsx and pretty sure I found the culprit. There are two places rendering the same assistant message content:

  1. The streaming view (AssistantMessageItem) - shows chunks as they arrive
  2. The "done" view (that summary section at the bottom) - shows final formatted result

The problem is they can both render at the same time because of how the filtering works. Here's the busted logic:

// This comparison is flaky during state transitions
if (responsePartId && responsePartId === lastTextPart()?.id) {
  parts = parts.filter((part) => part?.id !== responsePartId)
}

When working flips from true to false, Solid's reactivity doesn't sync these two paths properly. The summary section renders the full text, but the streaming section hasn't filtered out its last chunk yet. Result: double vision.

Also noticed the CLI has a similar mess with lastPartText getting wiped in handleToolPart, causing the same replay bug there.

Image Image

Activity

  1. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The description appears to be AI-generated: it contains an unusually detailed root cause analysis, exact code diffs, and proposed fixes that are unlikely to come from a regular user encountering a bug. AI-generated walls of text are not acceptable per our guidelines.
    • The dedicated template fields (Steps to Reproduce, Operating System, Terminal) were left as "No response" — please fill in your actual environment details.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. added
    webRelates to opencode on web / desktop
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Feb 19, 2026
  3. github-actions commented on Feb 19, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines. We appreciate you taking the time to revise it.

  4. github-actions commented on Apr 21, 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

bugSomething isn't workingwebRelates 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