fix(desktop): preserve interim assistant text - #39576
Conversation
|
Added follow-up The previous fix preserved text before the last tool call, but if Fresh validation on this head: The PR is still mergeable on GitHub after the push. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused regression coverage. The reported behavior is still present on current main: apps/desktop/src/app/session/hooks/use-message-stream/index.ts:363-377 removes every streamed text part when a completion lands, while index.ts:294-328 preserves pre-tool text and tool ordering before that completion.
Problems
- The PR edits the pre-refactor path
apps/desktop/src/app/session/hooks/use-message-stream.ts; current main moved the stateful hook touse-message-stream/index.tsin086343854and then extracted event dispatch in51a710e57. - The test harness is also stale: current
MessageStreamOptionsrequiressessionStateByRuntimeIdRefatuse-message-stream/index.ts:43-48.
Suggested changes
- Port the retention/deduplication logic into current
index.ts, operating on its existingvisibleFinalTextvalue at line 360 so generated-image filtering remains intact. - Update the regression test for the folder layout and current hook options; retain both completion shapes covered by the PR.
Automated hermes-sweeper review.
| activeSessionIdRef, | ||
| hydrateFromStoredSession: async () => undefined, | ||
| queryClient: queryClientRef.current, | ||
| refreshHermesConfig: async () => undefined, |
There was a problem hiding this comment.
Current main's MessageStreamOptions requires sessionStateByRuntimeIdRef (apps/desktop/src/app/session/hooks/use-message-stream/index.ts:43-48), so this harness needs that ref when the test is ported to the current hook layout.
|
Closing in favor of merged #65919, which supersedes this earlier attempt and preserves my contribution in the co-author credits. Thanks for consolidating the fix across the agent, gateway, Desktop, and TUI layers. |
Fixes #39558.
Summary
message.completereplaces the final assistant textmessage.delta -> tool.start -> tool.complete -> message.completeRed
npm run test:ui -- src/app/session/hooks/use-message-stream.test.tsx['tool-call', 'text']instead of['text', 'tool-call', 'text']Proof
npm run test:ui -- src/app/session/hooks/use-message-stream.test.tsx src/lib/chat-messages.test.tsnpx eslint src/app/session/hooks/use-message-stream.ts src/app/session/hooks/use-message-stream.test.tsxnpm run type-checkgit diff --check(only Windows CRLF warning forapps/desktop/src/app/session/hooks/use-message-stream.ts)