Conversation
message.complete only carries the last model reply, but mergeFinalAssistantText replaced every text part in the live bubble. Multi-step turns without a reliable message.interim seal lost earlier narration until restart (still in state.db). Seal text before tool/image boundaries and only supersede the open segment. Falls back to full replace when the final already restates sealed narration. Fixes NousResearch#46606
Related to #53350 and #61447, which address the same Desktop completion-time narration loss. This patch uses segment sealing and a full-transcript dedupe fallback; the existing alternatives preserve earlier segments with different reconciliation semantics, so this needs a maintainer choice rather than a duplicate label. |
|
Follow-up push on the dedupe path. Earlier version used a bare substring check (final contains sealed text). That was too loose - a short sealed opener, or a phrase the final merely quotes, could force a full text replace and drop multi-step narration again. Now full-replace only when:
Added tests for short "OK." openers and mid-string mentions. Vitest: chat-messages.test.ts + interim-sealing.test.tsx - 51 passed. Still sitting on needs-decision next to #53350. This PR patches the current mergeFinalAssistantText choke point on main; #53350 adds a parallel helper. Either is fine - I'd rather one lands cleanly than both sit. |
Drop bare substring matching. Short openers like "OK." were enough to trigger a full text wipe when the final reply happened to contain them. Require an exact match or a real long-enough prefix continuation.
fe46b04 to
91ee934
Compare
|
Thanks for the focused fix. The reported live-path loss is present on current main: The proposed last-boundary segmentation addresses that exact state shape without introducing a new surface, and its unit and stream tests cover both the direct no- This is an automated hermes-sweeper review. |
What does this PR do?
Desktop was dropping the first half of multi-step assistant turns once the turn finished.
You would see the model narrate, call tools, answer - then on message.complete the pre-tool narration vanished. It was still in state.db and came back after restart. Display-only bug.
mergeFinalAssistantText replaced every text part in the live bubble with the complete payload. That payload is usually only the last model reply. When earlier narration shared the bubble with tools and message.interim never sealed it first, the pre-tool half got wiped.
Related issue
Fixes the pre-tool narration wipe path described on #46606 (see mxcrowe's comment).
Does not claim to fix pure long-message head truncation / live render bounds. Separate problem.
Type of change
Changes
Image-echo stripping stays on the caller (use-message-stream), same as main today.
Why this instead of #53350
Same bug class. Different shape:
Happy to close this if you prefer #53350's shape, or pull any of their cases over. Just pick one.
How to test
cd apps/desktop npx vitest run src/lib/chat-messages.test.ts src/app/session/hooks/use-message-stream/interim-sealing.test.tsx51 passed here.
Manual: model that narrates, tools, then answers. Pre-tool text should still be there after the turn settles. Plain text-only turns should still collapse to the final reply.
Checklist