fix(web): coalesce streamed text chunks in history reloads - #2509
fix(web): coalesce streamed text chunks in history reloads#2509mangeshraut712 wants to merge 1 commit into
Conversation
History mapped each stream delta to its own content part and joined them with newlines under pre-wrap, so reloads showed one line per chunk. Coalesce consecutive same-kind parts within a message like the live path (fixes MoonshotAI#2505).
🦋 Changeset detectedLatest commit: 09e6a33 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09e6a339ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| coalesceText = true; | ||
| coalesceThinking = false; |
There was a problem hiding this comment.
Reset coalescing at empty content-part boundaries
When a message contains text('before'), an empty thinking part, then text('after'), coalesceText remains true because the flags change only inside the non-empty branch, so the result becomes beforeafter instead of preserving the content-block boundary. Empty boundary parts are valid—for example, the OpenAI Responses adapter emits an empty thinking part when a reasoning-summary part starts—so reset both flags whenever the part type changes, before checking whether its payload is empty.
Useful? React with 👍 / 👎.
Summary
text += deltapath (fixes [kimi-web] Reloaded transcript renders each streamed text chunk on its own line (newline-join + pre-wrap) #2505).Test plan
pnpm exec vitest run test/turn-logic.test.tsinapps/kimi-web(37 passed)Fixes #2505