Repository navigation
feat(native-chat): make native chat replies flow in and the transcript glide when following - #26238
Conversation
Snapshots land a clause at a time, 50-700 ms apart. Drawing behind them at an eased speed is what makes a reply read as flowing.
… latest The offset is still pinned at once; only what the pin moved is eased, so nothing races the virtualizer or a reply that keeps growing.
dependencies is for packages the main process loads at runtime.
|
Caution CodeRabbit couldn't post its review summary. Error details |
|
Update (reopened): I closed this earlier because I was worried about the pacing: holding text back and releasing it word by word could let output queue up behind what has already arrived. After trying it live, I actually really like how it looks, so I've reopened it and we'll work on getting it in. That one's my bad, sorry @AmoabaKelvin. We'll push a few changes on top of your commits: merging main, fixing the React Doctor error, and switching the pacing to a fixed delay, so every bit of text shows a set amount of time after it arrives and nothing can pile up. Original commentSuperseded by #26380. Thanks @AmoabaKelvin, this got the problem right, and #26380 reuses your top-level block splitter, its tests, and the incremental markdown rendering approach. #26380 is narrower on purpose: it shows the reply text the moment it arrives instead of holding it back and releasing it word by word. Each new paragraph or block fades in once while the reply streams (skipped when the OS "reduce motion" setting is on), and an unfinished |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe changes add incremental Markdown block rendering, word-fade rendering, and Mermaid source retention while diagrams render. Native-chat replies gain paced text reveal and dedicated user and assistant row components. Transcript rows now use normal flow with measured wrappers and spacers, and hidden panes use cached measurements. New tests cover rendering, reveal timing, row behavior, and transcript layout. Priority: ➖ Normal Merge Risk: 🔵 Low · up to A changed diagram can briefly show its old rendering until the new one finishes. This is minor and corrects itself, so it is mergeable with a small follow-up fix. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
18dca1ac-8016-4446-891c-5c4fffd00970
📒 Files selected for processing (20)
src/renderer/src/components/editor/MermaidBlock.test.tsxsrc/renderer/src/components/editor/MermaidBlock.tsxsrc/renderer/src/components/native-chat/NativeChatMarkdown.mermaid.test.tsxsrc/renderer/src/components/native-chat/NativeChatMarkdown.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.growth-windowing.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.message-rail-windowing.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.older-history.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.rail-history-jump.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.windowing-test-support.tsxsrc/renderer/src/components/native-chat/NativeChatPacedMarkdown.tsxsrc/renderer/src/components/native-chat/NativeChatTranscriptItems.tsxsrc/renderer/src/components/native-chat/native-chat-window-test-layout.tssrc/renderer/src/components/native-chat/native-chat-windowing-test-harness.tsxsrc/renderer/src/components/native-chat/use-native-chat-transcript-window.tssrc/renderer/src/components/sidebar/CommentMarkdown.tsxsrc/renderer/src/components/sidebar/CommentMermaidBlock.tsxsrc/renderer/src/components/sidebar/comment-markdown-code-renderers.tsxsrc/renderer/src/components/sidebar/comment-markdown-mermaid-policy.tssrc/renderer/src/components/sidebar/comment-mermaid-fence.tsx
💤 Files with no reviewable changes (1)
- src/renderer/src/components/native-chat/NativeChatPacedMarkdown.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
| if (result === null && pendingContent !== undefined) { | ||
| return <>{pendingContent}</> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Show pending source when the diagram content changes.
If content changes after a diagram renders, result still contains the previous SVG. The new render runs, but this branch skips pendingContent and displays the old diagram until that render finishes. Associate each result with the content that produced it. Show pendingContent whenever the result belongs to different content.
|
The end-of-reply jump was still present when a reply finished with a Mermaid diagram: the displayed source disappeared before SVG was ready, temporarily shrinking the transcript below the viewport, and mounted rows could change height before their reserved space caught up. A real native-chat reproduction captured the completed closing line moving 147 image pixels. At head 4b3e706, mounted messages own their real height, the existing scroll owner follows actual layout, and native chat retains the existing diagram source until SVG is ready; the transcript transform and its compensation machinery are removed. The user-facing result is that the trailing paragraph stays in place through diagram replacement and completion, while the 350 ms text deadline remains. The final hidden macOS captures use fresh isolated folder workspaces and synthetic Claude-shaped and Codex-shaped processes through the real native-chat composer. Two replies per provider complete with real SVG output and zero painted closing-line displacement across 122/164 and 149/78 tracked frames, including a second send after scrolling away from the end. The before/after full-app strips are embedded in the PR body. Intermediate DOM reads are distinguished from painted frames; this is not a claim that every intermediate layout read is unchanged. The delayed-measurement regression fails with the actual original layout, and navigation tests now deliver delayed browser scroll events for commit-time writes without weakening their assertions. 189 focused tests pass across 22 explicit files, and renderer plus full queued typechecks pass. All 22 static pre-push checks ran; the sole local lint failure is the unchanged main IPC file at 301 lines, byte-identical to merged main 22974c5. Final-head GitHub CI completed successfully: all five unit shards, all five Linux compatibility jobs, packaging, desktop persistence and all other completed checks pass, with no new failures versus main (PR workflow, persistence and Linux compatibility). The five skipped checks are end-to-end, real input-method, real WSL, mobile-on-main and desktop-template; they are not counted as passes. Self-reviewed scrolling, window gaps, hidden restoration, markdown defaults, pending-diagram lifecycle, selection, and sanitization. The intended differences from the common pattern are labelled in the body. Real provider binaries, Windows/Linux/SSH rendering, late-loading media and all selection/context-menu interaction flows were not rendered in this round; navigation and selection have automated coverage. Larger parsing work inside huge paragraphs, lists and tables and production frame-time measurement remain separate. Brennan’s live retry checklist is in the body. No new notice, saved-data field, wire format, or documentation file was added; contributor commits and original recordings are preserved, and the PR is not merged. |
…6238-r3 # Conflicts: # src/renderer/src/components/native-chat/NativeChatMessageList.tsx # src/renderer/src/components/native-chat/NativeChatMessageRow.tsx
|
Thanks again for this one, Kelvin. The look is great. Here's what we added on top while getting it ready to merge:
Two small follow-ups will go in a separate PR: keeping a wide diagram's horizontal scroll position when the reply finishes, and pruning the list of already-revealed rows in very long chats. |
Resolves conflicts with #26238 (paced, block-by-block reply rendering) in NativeChatMarkdown.tsx and CommentMarkdown.tsx: keep fadeWords/growing and the fileLinkExists plumbing together. Adds tests that a paced reply asks the host only once fully revealed, and that block-split rendering re-renders when existence answers change.
ELI5
A reply could still jump when it finished with a Mermaid diagram. The source disappeared before the diagram was ready, and the visible message changed height before its reserved blank space caught up. A hidden native-chat reproduction captured the same closing line moving down 147 image pixels between consecutive frames. The last paragraph now stays in place as the diagram finishes, while text continues to flow within its 350 ms reveal deadline.
What Changed
Preserves Kelvin’s commits and the existing fixed-latency text reveal, selected-word preservation, settled-span cleanup, stable markdown renderers, and main’s diagram error recovery. Current main was merged once as authorized; no further main sync or PR merge was performed.
Mounted messages now contribute their real height to the document immediately. Estimated blank space remains only for messages outside the rendered window. The existing scroll owner handles bottom following, history prepends, rail jumps, and reader input; hidden panes retain their last measured row sizes until they have visible boxes again.
Removed the transcript transform and its compensation and interaction-cancellation machinery. The bottom is updated from actual layout before paint when a diagram, code block, media item, or folded run changes height. Scrolling up still leaves the reader in control, and clicking ordinary transcript space cannot detach a short first reply.
Native chat keeps the existing source code block visible until the completed diagram is ready, then replaces it in one layout change. Streaming or partially revealed source never reaches Mermaid. Surrounding paragraphs, links, and other code remain mounted, and the finished diagram does not replay the streaming fade. Sidebar comments retain main’s default behavior.
Why
The previous layout tests flushed row measurements and scroll corrections together, so they missed the interval when the message had changed but its reserved height had not. Normal document flow removes that mismatch. Retaining the already displayed source avoids a temporary collapse below the viewport, where no scroll offset could preserve the last paragraph. More transform guards or delayed painting would leave those causes in place.
Intended difference: text has independent 350 ms arrival deadlines and a 300 ms word fade. The common pattern displays received text immediately; the fixed bound prevents a large burst from waiting behind a reading-speed queue. Reduced motion displays text immediately without fading.
Intended difference: native chat retains existing diagram source during rendering. The common pattern uses a loading placeholder; keeping the existing block preserves its height without adding a new notice. This is opt-in and does not change sidebar comments.
Intended difference: top-level markdown pieces and remend’s text-only unfinished-link repair remain to reduce repeated parsing. Sanitization stays in place, and these choices do not add a second scroll owner.
Linked Issue
Follow-up to Brennan’s October 8 live testing of this PR, including the remaining Claude Haiku and Codex completion jump; no separate issue was created.
Visual Proof
The before capture uses the merged pre-fix head and streams a heading, prose, a 12-node flowchart, TypeScript code, and four trailing paragraphs through the real native-chat composer and provider path. The after captures use committed head 4b3e706 and the same scenario with synthetic Claude-shaped and Codex-shaped agent processes in fresh isolated hidden macOS apps. Full app windows are shown.
Before: the closing line moves from image y = 580 to y = 727 as the empty diagram slot becomes SVG.
After, Claude-shaped completion: the source remains visible until SVG is ready and the closing line stays at y = 730.
After, Codex-shaped completion: the exact user-message echo settles delivery, the working line disappears, and the diagram replaces source without moving the closing line.
Kelvin’s original recordings: before and after.
Testing
Final CI: PR workflow and desktop persistence/Linux compatibility both completed successfully. End-to-end, real input-method, real WSL, mobile-on-main and desktop-template checks were explicitly skipped and are not claimed as passes. Main’s recent completed persistence run 37839088336 was also successful; the five Linux checks are green here.
The navigation test now delivers delayed browser scroll events for writes made during a commit, as well as writes made while resize callbacks settle. The new regression changes a mounted row’s actual height before delivering its virtualizer resize callback, pins from the content resize alone, and asserts that the later cache update causes no second movement. Substituting the original absolute-positioned layout fails this test: the document reports zero growth instead of 1,056 pixels. Deferred-diagram tests keep the exact code-block markup until SVG is ready; error recovery and sanitization still pass.
The after captures track the completed closing line through both turns, alongside animation-frame scroll geometry. Claude’s two completed replies have 122 and 164 tracked painted frames; Codex’s have 149 and 78. All have zero closing-line displacement, including source-to-SVG replacement; intermediate layout reads can precede the browser’s resize callback and are not treated as painted evidence. No transcript transform remains. Each second prompt was sent after scrolling away from the end and seeing Jump to latest; the sent question became visible and the reply followed. Native folder workspaces were exercised; Windows, Linux, SSH, real provider binaries, late-loading media, and interaction flows were not rendered in this round. Navigation and selection have focused unit coverage, and layout reflow is exercised through row-size changes. No wire format, execution ownership, or saved-data model changed.
Text deadline tests cover overlapping bursts, a 100,000-character burst, completion, remount/reconnect, hidden catch-up, and reduced motion. Earlier synthetic 5,000-word diagnostics remain limited to development React/happy-dom: 150 peak word spans and zero settled spans, versus 5,000 retained spans on the original PR. Those are not production frame-time measurements.
Review
Self-reviewed visible-row and unloaded-gap arithmetic, scroll ownership, hidden measurements, selection stability, opt-in defaults, diagram lifecycle, and renderer compatibility. Independent review is requested. Larger follow-ups remain separate: parsing within a single huge paragraph/list/table and production frame-time measurement. No new notice, banner, control, or documentation file was added.
Agent skill upstream boundary
Checklist