Repository navigation
fix(native-chat): message rail lights a message sent while the agent was working - #27821
Conversation
…ssage rail A message sent while the agent is working joins the running turn's key, and the rail lit ticks by turn key, so that message's tick never lit: not at the bottom, not after clicking it. Light the newest tick at or above the read row within its turn instead.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The rail can briefly highlight a tick from the previous reply. The issue is localized, but the existing finding remains open and should be addressed or explicitly accepted before merging. Pre-merge checks |
|
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:
81a959cd-0ed4-430d-8f02-1db869075695
📒 Files selected for processing (3)
src/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/use-native-chat-message-rail.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| const slot = slots[index] | ||
| for (let at = index; at >= 0; at -= 1) { | ||
| const candidate = slots[at] | ||
| if (candidate?.message && tickIds.has(candidate.message.id)) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Check the turn boundary before accepting a preceding tick.
If a row in turn u2 has no tick and the preceding row has a tick in turn u1, railTickOf returns the u1 tick before it checks turnKey. The rail then highlights a message from the wrong turn. Check the boundary before testing tickIds for every preceding row. Keep the current row eligible when its turnKey is undefined.
… a clicked tick lit Review round 1. The within-turn walk stopped at a row of no turn landing in the running turn, and could return a tick from the turn above. The lit tick is now the newest loaded rail item at or above the row at the fold, falling back to its turn key above the first loaded one (that prompt is in the outline). A jump that cannot bring its row to the top lands clamped at the bottom, and the settled position report then lit the last tick instead of the clicked one. A clicked tick now stays lit until the reader scrolls or starts another navigation (the existing reader-input path), or the set of prompts changes. Rail picks and the start of every navigation move into their own hook, as the list is at its line limit.
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:
307be29a-56e5-40a3-b049-dee4e5885aa5
📒 Files selected for processing (6)
src/renderer/src/components/native-chat/NativeChatMessageList.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/use-native-chat-message-rail.test.tssrc/renderer/src/components/native-chat/use-native-chat-message-rail.tssrc/renderer/src/components/native-chat/use-native-chat-rail-selection.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
… input Review round 2. Releasing the clicked tick on reader input needed every scroll source to report itself, and several do not (scroll-to-top button, inline diff reveal, prompt refold, selection-drag autoscroll); releasing it whenever the prompts changed dropped it on every head trim of a long live session. The hold now records where the jump settled, at the first idle read after the click, and keeps the clicked tick lit while the view rests there. Any movement, whatever caused it, releases it, as does the clicked message leaving the rail. Drops the navigation wiring and the hook it was moved into.
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:
08bcacc7-c871-4f15-b200-8c9e308d26f4
📒 Files selected for processing (3)
src/renderer/src/components/native-chat/use-native-chat-message-rail.test.tssrc/renderer/src/components/native-chat/use-native-chat-message-rail.tssrc/renderer/src/components/native-chat/use-native-chat-viewport-align.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Review round 3. Holding while scrollTop stayed put recorded the reader's spot when they kept scrolling within the idle period of the jump, kept an off-screen row lit after the viewport shrank, and let go when a row above re-measured late and shifted scrollTop with the content. The hold now records how far below the viewport top the clicked row settled, and keeps the tick lit while the row is still on screen at that offset.
Live check on macOS: before and afterHidden Orca app with a real Claude chat. The "before" build is main at c43ac3f, the commit this PR was last merged with. The "after" build is this PR at da72873. Ticks were read from the DOM ( 1. A message sent while Claude was still working joins that turn. Scrolled to the bottom:
2. A short last turn where a second message was sent mid-turn. Scrolled to the bottom (4 ticks):
3. After this PR, clicking the third tick when its turn is too short to scroll to the top: the view stays at the bottom, and the clicked tick is still lit 1.5 s and 3 s later. It does not snap to the last message. A small wheel scroll afterwards hands the rail back to the scroll position. Also checked on the PR build:
Not covered: SSH, Windows/Linux, and messages that arrive from orchestration mid-turn. Only typed messages were sent. |
Review status: ready for merge reviewThe problem. In native chat, the column of ticks on the right edge (the message rail, one tick per message you sent) lights the message you are reading. A message you send while the agent is still working joins the reply that's already running and shares that reply's id. The rail picked its tick from that id, so it always lit the message that started the reply. Even at the very bottom of the chat it pointed at an older message, and scrolling through the reply never reached the one you sent mid-reply. What changes for you. At the bottom, your latest message is lit. Scrolling through a reply with messages sent into it, the highlight moves onto each one as you pass it. A tick you click stays lit until the view moves, including one that can't scroll all the way to the top because it's near the end of the chat. Fixed during review (3 rounds plus a readiness pass):
Accepted behaviour changes:
Deferred (not caused by this PR; same on main):
Verified:
Not verified:
|





ELI5
Down the right edge of a chat is a column of small ticks, one per message you sent: the message rail. The lit tick tells you which of your messages you are reading. A message you sent while the agent was still working never lit up, so even scrolled all the way to the bottom the rail pointed at an older message.
What Changed
The problem. The transcript groups rows into turns: one of your messages and everything the agent does in answer to it. Each row carries an id for its turn (the "turn key"), which is the id of the message that started it. A message sent while the agent is working (or one that arrives then, such as an orchestration message) does not start a new turn; it joins the running one and takes that turn's key. The rail decided which tick to light from the turn key of the row at the top of the view, so it always named the message that started the turn, never the one sent into it.
Before: send a message while the agent is mid-reply, then scroll to the bottom. The rail lights the message that started the turn, one or more ticks above the last. Scrolling through that turn, the highlight never moves onto the message sent into it.
After: at the bottom, the rail lights your latest message. Scrolling through a turn that had messages sent into it, the highlight moves onto each of them as you pass it. Clicking a tick keeps it lit, including a tick whose message cannot scroll all the way to the top because it is too near the end of the chat.
Mechanism:
Why
Behaviour changes, accepted:
Visual Proof
Live QA on a remote Mac with a real Claude chat, before (main) and after (this PR): #27821 (comment)
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
native-chat-active-rail-item.test.ts: a message sent into a running turn lights at the bottom and from its own row on; it stays lit past a row that belongs to no turn; the first message of the turn is lit above the first loaded tick when it is known only from older history; a turn the agent started lights the message above it.use-native-chat-message-rail.test.ts: a clicked tick at a clamped bottom stays lit across settled reads, across rows above re-measuring (row and scroll move together), and across old rows being trimmed from a long session; it is released when its row moves, when the viewport shrinks it out of view, and when the reader scrolled it off screen before the jump settled. Each guard was checked by breaking it and seeing a test fail.Passing locally after merging main: 11 rail and message-list test files (140 tests),
pnpm tc:web, and the lint, code-quality and localization checks inorca-ci-checks. Its typecheck step fails locally before checking any code (this machine'sbunhas nocheckscript);pnpm tc:webpasses and CI runs the full typecheck.Review
Agent skill upstream boundary
Notes
Renderer-only highlight logic: no change for SSH, remote hosts, folder workspaces, mobile, or anything sent to a remote host. The lookup runs once per settled scroll over the loaded ticks.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)