Repository navigation
feat(native-chat): add a message rail for jumping between your prompts - #20719
Conversation
A vertical rail down the right edge of the transcript, one bar per user message, with the bar for the turn you are reading highlighted once scrolling settles. Hovering the rail opens a panel that previews every prompt and jumps to it on click. Bars are capped at 20 and sampled evenly across the thread, always keeping both ends and the active bar, so the rail stays readable at a glance on a long conversation. The active bar is resolved from virtualizer offsets rather than by scanning rendered rows: the transcript is windowed, so an off-window row has no element to measure. The row at the scroll fold resolves to its owning prompt through turnKey, which is what keeps your own message lit while you read a long reply instead of going dark. Jumps reuse the existing reveal/pin path and scrollMessageToTop, which releases the bottom pin. Scrolling through the virtualizer directly would leave a reader snapped back down by the next streamed token. Ticks cover loaded history only; older prompts gain a bar once "Load earlier messages" pages them in.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change adds a native chat message rail with user-message ticks, interactive popover previews, active-tick tracking, and a 20-tick sampling cap. Rail visibility depends on transcript size and container width. Active state updates after scrolling settles. Selecting a message mounts its virtualized row and scrolls it to the top once. Rail jumps replace diff reveal requests. Unit and end-to-end tests cover item building, sampling, active selection, accessibility, rendering, and navigation. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The message rail’s forwarded wheel behavior does not introduce duplicate or unintended scrolling in the rendered layout. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description clearly explains the feature, rationale, scope, limitations, and verification. However, it omits required template content, including the Linked Issue section, the required Visual Proof attachments or exact N/A statement, the Testing checklist and platforms, and the remaining checklist and review sections. Resolution Add a
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2497bafa-14e6-455d-bda0-cfefdd9599d0
📒 Files selected for processing (9)
src/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageRail.tsxsrc/renderer/src/components/native-chat/native-chat-active-rail-item.test.tssrc/renderer/src/components/native-chat/native-chat-active-rail-item.tssrc/renderer/src/components/native-chat/native-chat-message-rail-items.test.tssrc/renderer/src/components/native-chat/native-chat-message-rail-items.tssrc/renderer/src/components/native-chat/use-native-chat-message-rail.tssrc/renderer/src/i18n/locales/en.jsontests/e2e/native-chat-message-rail.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
There was a problem hiding this comment.
Important
A rail jump re-arms its scroll effect on every render, so once you jump, the transcript is repeatedly pulled back to the jumped message and the reader cannot scroll away from it. Two related railJump lifecycle issues and a loose e2e assertion below.
Reviewed changes
- Rail tick build + sampling (
native-chat-message-rail-items.ts) — one entry per user slot, capped at 20 and evenly sampled while always keeping both ends and the active tick. - Active tick resolution (
native-chat-active-rail-item.ts) — computes the row at the scroll fold from virtualizer offsets, resolved throughturnKeywith a bottom bias, so the owning prompt stays lit through a long reply. - Rail hook (
use-native-chat-message-rail.ts) — debounced active-id recompute on scroll settle plus aResizeObserverwidth gate (min 512px). - Rail component (
NativeChatMessageRail.tsx) — hover-card trigger with ticks, a preview panel that lists every prompt, and wheel forwarding to the scroller. - List wiring (
NativeChatMessageList.tsx) —railJumpstate,revealIndexshared withrevealedDiff, and auseLayoutEffectthat scrolls the target row to top viascrollMessageToTop. - Tests — 18 vitest units over the pure logic, plus a headless e2e spec that renders a seeded 30-turn transcript (visual proof, explicitly not a gate).
ℹ️ The jump lifecycle has no automated regression test
Every new test targets the pure helpers (buildNativeChatRailItems, selectNativeChatRailTicks, findActiveNativeChatRailItem); nothing exercises what happens after a jump. The e2e spec only asserts tick and panel counts, so the effect that drives the scroll — which is where the two findings above live — is unpinned by any test. A unit/integration test that selects a rail item and then mutates slots the way a streaming update does, asserting scrollMessageToTop is not re-invoked, would have caught the re-scroll loop.
Technical details
# No coverage for the rail-jump effect
## Affected sites
- `src/renderer/src/components/native-chat/native-chat-active-rail-item.test.ts` — pure helper only
- `src/renderer/src/components/native-chat/native-chat-message-rail-items.test.ts` — pure helpers only
- `src/renderer/src/components/native-chat/NativeChatMessageList.tsx:229-238` — the effect under test does not exist in any test
- `tests/e2e/native-chat-message-rail.spec.ts` — asserts counts, never post-jump scroll behavior
## Required outcome
A regression test that fails if `scrollMessageToTop` is re-issued while `railJump` is unchanged (e.g. after an unrelated `slots` update).ℹ️ Nitpicks
NativeChatRailItem.slotIndexis computed on every item and documented as the reason items are built from slots, but nothing in production reads it — the jump re-derives the index withnativeChatSlotIndexOf. Either consume it or drop it.- The rail trigger is a non-focusable
divwhose ticks arearia-hidden, andaria-labelon a role-lessdivis not exposed to assistive tech, so the panel is unreachable without a pointer. Consider a role +tabIndexor a keyboard affordance. onWheelforwards onlydeltaY, quietly dropping horizontal/shift-wheel deltas.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
The rail borrowed the diff reveal's pin to reach a row the window had left behind, but copied only its state shape, not its consumption. The request was never cleared and the effect depended on `slots`, which is rebuilt on every render, so three things went wrong at once: - every later render re-scrolled to the jumped message, dragging a reader back there for the rest of the pane's life, and forcing the bottom pin off each time; - the standing request outranked `revealedDiff` in the shared pin, so revealing a diff outside the window silently stopped mounting its row; - the pinned row stayed mounted and measured indefinitely. The request now carries a monotonic id, is serviced once, and is released as soon as the scroll is issued, which hands the pin back. The rail's scroll listener had the same churn: it listed `items` in its deps, so a streaming turn tore the listener down and cancelled the pending idle timer on every frame and the highlight never settled. It now subscribes once and re-reads on a key built from the prompt ids. Also: the hover trigger is a real button, because `asChild` discards the primitive's focusable trigger and the panel is the only way to reach these messages; the wheel forwarder honours line and page delta modes rather than treating every delta as pixels; and the e2e panel assertion is exact, since a loose bound passed at 20 rows against 20 ticks.
There was a problem hiding this comment.
Important
A raw NUL byte landed in use-native-chat-message-rail.ts, which makes git and GitHub treat the whole file as binary — it renders as "Binary file not shown" in this PR and every future diff. The jump-lifecycle fixes themselves are correct and the prior findings are resolved.
Reviewed changes
- Serviced the rail jump once per request (
railJumpSeqRef+servicedRailJumpRef) and released the pin withsetRailJump(null), so the layout effect stops re-scrolling on re-render and a later diff reveal is no longer shadowed. - Added the
jumping to a message from the railwindowing tests pinning single-scroll and pin-release behavior. - Made the rail trigger a real
type="button"and scaled wheel deltas bydeltaMode(line / page / pixel). - Added
use-native-chat-message-rail.test.tsasserting the scroll listener subscribes once across slot-identity churn, plus anitemsKeyeffect so a grown transcript still re-reads. - Tightened the e2e panel assertion to an exact
TRANSCRIPT_ROWS / 2.
️ A raw NUL byte makes use-native-chat-message-rail.ts a binary file
The new itemsKey line writes an actual 0x00 character inside the string literal instead of the two-character escape \0. Git classifies any file with a NUL in its first 8000 bytes as binary, so this 4.4KB production file is now invisible in diffs — GitHub reports hasPatch: false for it, and this PR's own rendered diff and range-diff both drop it. The code still compiles and tests pass, so nothing breaks at runtime, but the file (and every future change to it) can no longer be reviewed or found by rg/git grep, which is a durable regression for the repo.
Technical details
# Raw NUL byte in a source file
## Affected sites
- `src/renderer/src/components/native-chat/use-native-chat-message-rail.ts:48` — the `join(...)` separator is a literal NUL byte (0x00), not the escape `'\0'`. The intended code is `items.map((item) => item.id).join('\0')`.
- GitHub `GET /repos/stablyai/orca/pulls/20719/files` returns `"hasPatch": false, "additions": 0, "deletions": 0` for this file, i.e. no reviewable patch.
- Previous commit `67f71c4d5e` has no NUL; the byte was introduced by `4cd814531d`.
## Required outcome
The hook remains valid TypeScript and keeps joining ids with a NUL separator, but the source is text again: use the escape `'\0'` (or `'\u0000'`) so git/GitHub can diff the file.
## Suggested approach
Replace the literal byte at line 48 with the escape sequence. A quick guard is `file src/renderer/src/components/native-chat/use-native-chat-message-rail.ts` — it should report `ASCII text`/`Unicode text`, not `data`.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — incremental delta since the prior pullfrog review (4cd8145).
- Unified navigation state (
NativeChatMessageList.tsx) — diff reveal and rail jump now share onenavigationRequestdriven by a monotonicnavigationSequence, so a rail jump supersedes a pending diff reveal instead of the two ordering each other permanently. - Rail made keyboard-accessible (
NativeChatMessageRail.tsx) — theHoverCardtrigger became a focus-managedPopover: hover opens without stealing focus, activation (click or Enter) moves focus into the prompt picker, and close restores it to the trigger. - Preview/identity caching (
native-chat-message-rail-items.ts,use-native-chat-message-rail.ts) — previews are memoized in aWeakMapkeyed bymessage.blocks, and unchanged item/array identities are reused, cutting per-render derivation during streaming. - Removed the raw NUL byte from
use-native-chat-message-rail.ts, restoring it to a text file that git and GitHub can diff (the prior run's finding). - Tests — added rail interaction tests (keyboard open/jump/focus-return, hover preserves transcript focus, wheel delta modes), hook lifecycle tests, an items invalidation test, a windowing supersede test, and an e2e assertion that a jump does not follow later streamed output.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Native-chat message rail QA (uncropped full-app screenshots from the checked-out branch): Initial rail — seeded 30-prompt transcript with uneven assistant heights. The rail shows sampled ticks (capped at 20), with the latest prompt highlighted while the transcript is pinned near the bottom. Hover picker — pointer hover on the rail opens a readable prompt list of every user message (not just sampled ticks) without taking focus from the composer. Interactive picker — keyboard activation from the rail trigger opens the picker; Tab reaches prompt buttons (Question 2 focused with a visible ring). Post-jump / streaming — selecting off-window Question 5 aligns that prompt to the transcript viewport top via the real scroll owner. The active tick moved off the last bar, and Jump to latest is visible after later assistant output was appended, so the view did not snap back to the bottom. |
Review status: PASS WITH RISKThe native-chat message rail review is clean after three focused review/fix rounds. The pushed commits fix:
Validation completed:
CI status: package, Windows package, typecheck, all test shards, changed e2e specs, and Pullfrog pass. The repository static-analysis job fails on annotations outside this PR’s changed paths (.github workflow exit handling and an existing mobile mutant-test conditional); the required verify job fails only because of that static-analysis result. No rail-specific blocker was found, and fixing those unrelated annotations would expand this PR’s scope. Recommendation: land after the unrelated repository static-analysis failure is resolved or explicitly waived. |
…20773) #20719 grew NativeChatMessageList.windowing.test.tsx to 897 effective lines, past the 800 ceiling for test files, so oxlint fails on main. Moves the shared layout/ResizeObserver stubs into native-chat-windowing-test-harness.tsx. No test was changed, split or dropped: still 5 describes and 23 it() blocks, 29 assertions passing. The stubs' mutable knobs become one exported `layout` object because an imported binding cannot be reassigned across modules. AGENTS.md forbids a max-lines disable, so extraction is the fix.
stablyai#20719) * feat(native-chat): add a message rail for jumping between your prompts A vertical rail down the right edge of the transcript, one bar per user message, with the bar for the turn you are reading highlighted once scrolling settles. Hovering the rail opens a panel that previews every prompt and jumps to it on click. Bars are capped at 20 and sampled evenly across the thread, always keeping both ends and the active bar, so the rail stays readable at a glance on a long conversation. The active bar is resolved from virtualizer offsets rather than by scanning rendered rows: the transcript is windowed, so an off-window row has no element to measure. The row at the scroll fold resolves to its owning prompt through turnKey, which is what keeps your own message lit while you read a long reply instead of going dark. Jumps reuse the existing reveal/pin path and scrollMessageToTop, which releases the bottom pin. Scrolling through the virtualizer directly would leave a reader snapped back down by the next streamed token. Ticks cover loaded history only; older prompts gain a bar once "Load earlier messages" pages them in. * fix(native-chat): service a rail jump once and give its pin back The rail borrowed the diff reveal's pin to reach a row the window had left behind, but copied only its state shape, not its consumption. The request was never cleared and the effect depended on `slots`, which is rebuilt on every render, so three things went wrong at once: - every later render re-scrolled to the jumped message, dragging a reader back there for the rest of the pane's life, and forcing the bottom pin off each time; - the standing request outranked `revealedDiff` in the shared pin, so revealing a diff outside the window silently stopped mounting its row; - the pinned row stayed mounted and measured indefinitely. The request now carries a monotonic id, is serviced once, and is released as soon as the scroll is issued, which hands the pin back. The rail's scroll listener had the same churn: it listed `items` in its deps, so a streaming turn tore the listener down and cancelled the pending idle timer on every frame and the highlight never settled. It now subscribes once and re-reads on a key built from the prompt ids. Also: the hover trigger is a real button, because `asChild` discards the primitive's focusable trigger and the panel is the only way to reach these messages; the wheel forwarder honours line and page delta modes rather than treating every delta as pixels; and the e2e panel assertion is exact, since a loose bound passed at 20 rows against 20 ticks. * fix(native-chat): make prompt rail accessible and reuse previews * fix(native-chat): supersede prior navigation when selecting a prompt
…tablyai#20773) stablyai#20719 grew NativeChatMessageList.windowing.test.tsx to 897 effective lines, past the 800 ceiling for test files, so oxlint fails on main. Moves the shared layout/ResizeObserver stubs into native-chat-windowing-test-harness.tsx. No test was changed, split or dropped: still 5 describes and 23 it() blocks, 29 assertions passing. The stubs' mutable knobs become one exported `layout` object because an imported binding cannot be reassigned across modules. AGENTS.md forbids a max-lines disable, so extraction is the fix.





What
A message rail down the right edge of the native chat transcript: one bar per user message, with the bar for the turn you're reading highlighted once scrolling settles. Hovering the rail opens a panel that previews every prompt and jumps to it on click.
Bars are capped at 20 and sampled evenly across the thread, always keeping both ends and the active bar, so the rail stays readable at a glance instead of overflowing the viewport or shrinking to sub-pixel on a long conversation. The hover panel still lists every prompt.
Why these mechanisms
Active bar is read from virtualizer offsets, not from rendered rows. The obvious implementation scans the DOM for the visible row. That does not work here: this transcript is windowed, so an off-window row has no element to measure. Virtual item
start/endare already in the scroll container's own pixel space — rows render atitem.start - scrollMargininside a sizer sittingscrollMargindown — which also makes the comparison correct under the transcript'szoom, where a bounding rect would be off by exactly the zoom factor.The fold resolves through
turnKey. Most of a transcript is agent reply, so asking "which user row is on screen" leaves the rail dark for the entire length of a long answer. Every row carriesturnKey, the id of the user message that opened its turn, so the row at the scroll fold resolves to the prompt that owns it and your own message stays lit while you read the reply to it.Jumps reuse the existing reveal/pin path, ending in
scrollMessageToToprather than driving the virtualizer directly. That is what clearsstuckToBottomRef; without it the bottom-pin layout effect re-fires on the nextitemCount/isWorkingchange and snaps the reader straight back down mid-stream. No second scroll mechanism was added, andnative-chat-pinned-rows.tsneeded no change.The rail overlays the transcript without being inside it, so it forwards wheel events to the scroller — otherwise parking the cursor at the right edge would silently stop scrolling.
Known limitations
hasMoreis true, prompts older than the loaded page get no bar; they appear as "Load earlier messages" pages them in. Backing the rail with a server-side conversation outline would fix this and is deliberately not in this PR.Verification
turnKeymapping fails exactly the two tests that depend on it (u1→u2);u9→u7).ticks=20 panelRows=30, confirming the sampling cap and that the panel lists every prompt. Screenshots captured show the bottom bar correctly highlighted while pinned to the latest turn, and the hover panel listing the user messages.Note that the e2e spec is visual/behavioural proof, not a merge gate — the guards for this feature are the vitest units, which run in the required lane.
Scope
New: rail item building + sampling, active-item resolution, the rail hook, the rail component, two unit test files, one e2e spec. Modified:
NativeChatMessageList.tsx(mounting and jump wiring) anden.json(three new keys). Nomax-linessuppressions; every touched file is comfortably within budget.