Skip to content

fix: avoid duplicate assistant bubbles for previewed completions - #153

Merged
rusty4444 merged 7 commits into
rusty4444:mainfrom
krotname:main
Oct 19, 2026
Merged

rusty4444 merged 7 commits into
rusty4444:mainfrom
krotname:main

Conversation

@krotname

Copy link
Copy Markdown
Contributor

Problem

When the gateway emits the final answer as message.interim and then sends message.complete with response_previewed: true, the chat displays the same answer twice. For example, a 3+4 request ends with two identical 7 bubbles.

Changes

  • Settle previewed/transformed completions onto the sealed interim message from the current user turn. Reused completions require an exact text match.
  • Respect explicit message.start boundaries, keeping separate messages and repeated user turns distinct.
  • Preserve late reasoning updates, including append/replace semantics and the latest verbose/collapsed state.
  • Add widget regressions covering these event sequences.

Validation

@rusty4444 rusty4444 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes review: two blocking reconciliation bugs. At lib/core/screens/chat_screen.dart:3299-3332, a previewed completion is reconciled with the newest interim without checking its text. With interims A then B and completion A, B is overwritten and A appears twice. Also, response_transformed means an output hook changed the final answer; a distinct transformed final can replace and lose interim commentary. The added tests use message.start between replies, but the gateway emits that at turn start, so they miss the no-intervening-delta case. Please match the actual previewed interim and preserve distinct commentary; add regressions for both. CI passed for this head, but do not merge until fixed.

@rusty4444 rusty4444 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krotname for the contribution. I added a maintainer follow-up commit on your PR head (968d1cd) to settle only exact raw-text preview matches, preserve distinct transformed commentary, and cover the no-intervening-start and rendered-text cases. This keeps your original commits and authorship intact. Local full analysis and all 1,337 tests passed; current-head PR CI also passed.

@rusty4444
rusty4444 merged commit 36a4ab0 into rusty4444:main Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants