Skip to content
Source
Sign inSign up
pingdotgg/t3code

Fix duplicate assistant messages when streaming is enabled #381

Closedishaanrajiv(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/381/headopened View on GitHub

Disclaimer: Generated via T3Code

Fixes #349.

Summary

When Stream assistant messages is enabled, assistant responses can appear twice in the desktop app.

This happens when:

  • assistant text is emitted incrementally from streaming deltas
  • item.completed later arrives with payload.detail containing the full response
  • the completion path treats that detail as fallback text even though content was already streamed

Fix

  • track whether assistant text has already been emitted for a given message
  • only use item.completed.detail as fallback when no assistant text was previously emitted
  • keep normal completion behavior unchanged for non-streamed or fallback-only cases

Validation

  • added a regression test covering streamed deltas followed by item.completed.detail
  • build and tested locally

Before: Screenshot 2026-03-07 at 7 36 25 PM

After: Screenshot 2026-03-07 at 7 36 32 PM

    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: aea3a42c-e37f-4677-8d67-6bb70200facc

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Post copyable unit tests in a comment

      Tip

      Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Share your feedback on Discord.


      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. maria-rcks closed this

Sign in to join this conversation.