Repository navigation
Conversation
… order Terminal transcript rows are sorted by time, and a row that ties the newest time above it fell back to id order, so random row ids could put a response's answer above its own thinking. inTranscriptFileOrder already moved an older row one past the newest time above it; it now does the same for a tie. User rows keep a tied time: Claude writes a pasted-image prompt and its image companion row at one time, and the chat pairs them by that shared time. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
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:
3cf5487c-f23a-4445-a384-c104b579cb41
📒 Files selected for processing: 2
src/main/native-chat/transcript-file-order.test.tssrc/main/native-chat/transcript-file-order.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…ve move A tie now moves a row one past the newest time above it. When a pasted-image prompt and its image row tie rows that already moved, both moved, but to consecutive times, and the chat, which pairs them by their shared time, split the image from its prompt. File order now remembers the user row right above it. A user row with the same file time takes that row's ordered time, so the pair moves together. This replaces the rule that kept a user row's tied time. Full, tail and appended reads carry the same state, so an image row appended after the first snapshot still pairs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Restrict timestamp reuse to recognized image pairs. · transcript-file-order.ts:37-48
src/main/native-chat/transcript-file-order.ts:37-48
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winRestrict timestamp reuse to recognized image pairs.
The full, tail, and incremental readers call
inTranscriptFileOrder, but they do not assigntranscriptOrder. The Chat UI therefore compares ordinary tied user rows by timestamp and then semantic row ID. This can place the rows in ID order instead of transcript file order.Reuse the preceding ordered timestamp only for adjacent, recognized image-pair rows.
Suggested fix
import type { NativeChatMessage } from '../../shared/native-chat-types' +import { + hasImagePromptMarker, + isImageSourceUserTurn +} from '../../shared/native-chat-image-transcript-markers' export type TranscriptFileOrder = { latest: number - userAbove?: { timestamp: number; ordered: number } + userAbove?: { timestamp: number; ordered: number; message: NativeChatMessage } } - const ordered = orderedTimestamp(timestamp, order.latest, isUser ? order.userAbove : undefined) + const ordered = orderedTimestamp( + timestamp, + order.latest, + isUser ? order.userAbove : undefined, + message + ) return { message: ordered === timestamp ? message : { ...message, timestamp: ordered }, order: { latest: Math.max(order.latest, ordered), - ...(isUser ? { userAbove: { timestamp, ordered } } : {}) + ...(isUser ? { userAbove: { timestamp, ordered, message } } : {}) } } } function orderedTimestamp( timestamp: number, latest: number, - userAbove: TranscriptFileOrder['userAbove'] + userAbove: TranscriptFileOrder['userAbove'], + message: NativeChatMessage ): number { + const aboveIsImageSource = userAbove ? isImageSourceUserTurn(userAbove.message) : false + const messageIsImageSource = isImageSourceUserTurn(message) + const isImagePairRow = + (aboveIsImageSource && (messageIsImageSource || hasImagePromptMarker(message))) || + (userAbove ? hasImagePromptMarker(userAbove.message) && messageIsImageSource : false) // Why: Claude stamps a pasted-image prompt and its image rows alike, and the chat pairs them by // that time, so a pair moved below earlier rows moves together. - if (userAbove?.timestamp === timestamp) { + if ( + userAbove?.timestamp === timestamp && + userAbove.message.source === message.source && + isImagePairRow + ) { return userAbove.ordered }
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
ee3bb287-0110-4c1b-9b8a-1652d7fbd0a6
📒 Files selected for processing: 6
src/main/native-chat/transcript-file-order.test.tssrc/main/native-chat/transcript-file-order.tssrc/main/native-chat/transcript-incremental-reader.tssrc/main/native-chat/transcript-stream-lines.tssrc/main/native-chat/transcript-tail-reader.tssrc/main/native-chat/transcript-watch-engine.ts
🚧 Files skipped from review as they are similar to previous changes: 2
- src/main/native-chat/transcript-file-order.test.ts
- src/main/native-chat/transcript-file-order.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The previous commit let any user row take the ordered time of a tied user row right above it. Other tied user rows then shared one time again, and the chat ordered them by id instead of by the file. Only a pasted-image prompt and its image rows, recognized by the same markers the chat folds them by, now share the time. Every other tied row moves one past the newest time above it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for tracking this down! This was fixed on main by #33628 (028f609): transcript readers now order rows by their position in the file (transcriptOrder from the source offset) rather than by timestamp/id, so rows sharing a timestamp keep file order. Closing as superseded. Feel free to reopen if you still see an answer above its thinking. |
ELI5
When two lines of a chat transcript carry the exact same time, Orca had no reliable way to tell which came first, and sometimes showed an answer before the thinking that produced it. Now, whenever times tie, the order the lines were written in wins.
What Changed
Before: tied rows fell back to random id order. For a CLI that writes a whole response with one timestamp, the answer could render above its own thinking, and get folded into the "Worked for Xs" group while the thinking showed as the reply.
After: tied rows keep the order they have in the transcript file.
Mechanism:
inTranscriptFileOrderalready moved a row whose time is earlier than the newest row above it to one millisecond past that time. It now does the same when the time is equal. This covers full reads, tail reads and live appends, which all use the same helper.The one exception is a pasted-image pair. Claude writes a pasted-image prompt and its image companion row at one time, and
sortForImageNormalizationpairs them by that shared time. So the ordering state also remembers an image row right above, recognized by the same prompt and image-source markers the chat folds by. A pasted-image prompt or image row with the same file time takes that row's ordered time, so the pair moves together, even below rows that already moved. Any other tied row, user rows included, moves one past the newest time above it. Full, tail and append reads carry this state, including from the first snapshot into later appends.Why
transcriptOrderwould change how those rows sort against rows that have none, such as optimistic sends.Linked Issue
Fixes #31785
Visual Proof
Seen with Qoder CLI in Chat UI, which writes every row of a response with one timestamp (see #31796). These shots use Orca's Chinese UI: 工作了 9s is "Worked for 9s", and the prompt asks for a one-sentence Chinese summary of README.md followed by
DONE-1on its own line.Before: the answer is hidden inside "Worked for 9s" and the thinking shows as the reply.
After: the thinking is folded and the answer shows below it.
Testing
Manual: macOS dev build, Qoder CLI 1.1.75 chat: the same turn before and after the change.
Automated (
transcript-file-order.test.ts):Local runs:
pnpm tc:node,oxlint,oxfmt --check,pnpm run check:code-quality:changed,pnpm run check:max-lines-ratchet.Vitest over
src/main/native-chat: 366 files passed.With fix(native-chat): give a chat Stop the interrupt inference a typed Escape gets #31795 and feat(native-chat): open Qoder CLI sessions in the chat view #31796 merged on top:
pnpm tc:node,pnpm tc:web, and Vitest oversrc/main/native-chat,src/main/ai-vault,src/sharedand the renderer native-chat and terminal-pane suites (2693 files passed).I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implemented with Claude Code (Claude Opus 5.5) under my direction. I reviewed the diff and the test runs.
Review
AI agent review of this change:
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code