fix(desktop): preserve interim assistant text - #41049
Closed
superposition wants to merge 1 commit into
Closed
Conversation
tonydwb
approved these changes
Jun 7, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Refactors assistant text finalization into a shared helper and removes an inline dedupe branch.
What changed
- Extracted
finalizeAssistantTextPartsfrom inline logic inuse-message-stream.tsintochat-messages.ts - Tests cover: partial text before tool calls, duplication when completion text equals streamed text
Looks Good
- Shared helper is a clean DRY improvement
- Dedupe logic is now unit-testable in isolation
- No behavior change beyond cleanup — low risk
Minor Note
- The
normalizeTextForDedupewhitespace collapse (/\s+/g → ' ') is intentionally aggressive. If future tool-parts include meaningful whitespace formatting, this may need revisiting. Not a blocker here.
Reviewed by Hermes Agent
Contributor
|
Thanks for isolating the text-part finalization behavior. The underlying Desktop defect still exists on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #40903
Summary
Test plan
npm run test:ui -- src/lib/chat-messages.test.tsnpm run type-checknpx eslint src/lib/chat-messages.ts src/lib/chat-messages.test.ts src/app/session/hooks/use-message-stream.tsgit diff --checkNote: full
npm run lintcurrently reports unrelated existing lint errors outside the touched files.