Coding pane: tool rows land above the thought that started them, and follow-the-tail snaps around streaming code blocks #375

Closed
opened 2026-11-04 08:38:57 -05:00 by cmoriarty · 1 comment
Owner

Seen on run 172 (Scratch, vLLM + MTP, 2026-11-04) in the coding pane while openspec.apply[all] streamed.

What happens

  1. Rows land out of order. A command row (cd .../runs/172/work && npx vitest run packages/server ...) sits above the Thought that decides to run it and above the text "Now let's run the server test suite to see where we stand:", which announced it. The reader sees the effect before the cause.
  2. Follow-the-tail misbehaves around code blocks. While a code block is being written the pane grows below the bottom of the view, then the content snaps upward out of view. Hard to describe; it happens repeatedly on apply steps that write files.

Likely causes (from reading the code, not yet confirmed)

  1. Settled rows are ordered by osf_event.seq (step_transcript, routes.py ~L1329). A text or reasoning part is logged twice: empty at its start and whole at its end (store.ts partEnds), and while it streams it is drawn as a live piece placed after the step's last settled line (Transcript.tsx ~L240-270, lastAt). A tool part settles in one event when the call starts. So a command that starts while a thought or sentence is still streaming gets a settled row at once, the still-live text is shown below it, and when that text ends its end event carries a later seq than the command's, so it settles below the command for good. Fix candidates: give a settled text/reasoning row the seq of its start event (or the part's ordinal/message time from v2.py), or hold a tool row behind an unsettled earlier part of the same message.
  2. Following is one scrollTop = scrollHeight a frame after the tail changes (Transcript.tsx ~L300-395, tailSize); virtua measures rows by ResizeObserver after that frame. A fenced code block inside a live text part re-renders as it grows and changes height after the follow has fired (the view is left short, so new lines appear below the fold), and when the live part settles it is replaced by a shorter settled row (a collapsed Thought, or a code block with a capped height), so the bottom moves up and the view snaps. #210 described the same replace-on-settle jump for reasoning; #80 is why scrollToIndex was dropped.

Done when

  • A tool row never appears above a text or thought row of the same message that began before it, during streaming or after settle.
  • With the pin held, a streaming code block stays in view as it grows, and settling a live part moves the view by no more than the difference the operator can see (no snap of more than the settled row's height).
  • ui/e2e/follow-the-tail.spec.ts gets a case with a streaming fenced code block and a tool call that starts mid-sentence.

Related: #210, #80, #94.

Seen on run 172 (Scratch, vLLM + MTP, 2026-11-04) in the coding pane while `openspec.apply[all]` streamed. ## What happens 1. **Rows land out of order.** A command row (`cd .../runs/172/work && npx vitest run packages/server ...`) sits above the Thought that decides to run it and above the text "Now let's run the server test suite to see where we stand:", which announced it. The reader sees the effect before the cause. 2. **Follow-the-tail misbehaves around code blocks.** While a code block is being written the pane grows below the bottom of the view, then the content snaps upward out of view. Hard to describe; it happens repeatedly on apply steps that write files. ## Likely causes (from reading the code, not yet confirmed) 1. Settled rows are ordered by `osf_event.seq` (`step_transcript`, `routes.py` ~L1329). A text or reasoning part is logged twice: empty at its start and whole at its end (`store.ts` `partEnds`), and while it streams it is drawn as a live piece placed *after the step's last settled line* (`Transcript.tsx` ~L240-270, `lastAt`). A tool part settles in one event when the call starts. So a command that starts while a thought or sentence is still streaming gets a settled row at once, the still-live text is shown below it, and when that text ends its end event carries a later seq than the command's, so it settles below the command for good. Fix candidates: give a settled text/reasoning row the seq of its start event (or the part's `ordinal`/message time from `v2.py`), or hold a tool row behind an unsettled earlier part of the same message. 2. Following is one `scrollTop = scrollHeight` a frame after the tail changes (`Transcript.tsx` ~L300-395, `tailSize`); virtua measures rows by ResizeObserver after that frame. A fenced code block inside a live text part re-renders as it grows and changes height after the follow has fired (the view is left short, so new lines appear below the fold), and when the live part settles it is replaced by a shorter settled row (a collapsed Thought, or a code block with a capped height), so the bottom moves up and the view snaps. #210 described the same replace-on-settle jump for reasoning; #80 is why `scrollToIndex` was dropped. ## Done when - A tool row never appears above a text or thought row of the same message that began before it, during streaming or after settle. - With the pin held, a streaming code block stays in view as it grows, and settling a live part moves the view by no more than the difference the operator can see (no snap of more than the settled row's height). - `ui/e2e/follow-the-tail.spec.ts` gets a case with a streaming fenced code block and a tool call that starts mid-sentence. Related: #210, #80, #94.
Author
Owner

Shipped in PR #390, production ddd4b6b.

  • A message's words stay above the tool call they led to.
  • A pinned pane follows any change in height.

The cause differs from this issue: opencode 2 logs a text or reasoning part once, when it ends. That came after the tool's first event on all 484 of apply's messages that had both. The adapter now settles open words when a tool starts.

Evidence: tests/agent/test_opencode2_recordings.py (failed first), and a new journey in ui/e2e/run.spec.ts that fails on the old build. A kept apply-single sim, read in a real browser, shows the rows in order. A finished step has no live stream, so following a growing row rests on that journey.

**Shipped** in PR #390, production ddd4b6b. - A message's words stay above the tool call they led to. - A pinned pane follows any change in height. **The cause differs from this issue:** opencode 2 logs a text or reasoning part once, when it ends. That came after the tool's first event on all 484 of apply's messages that had both. The adapter now settles open words when a tool starts. **Evidence:** `tests/agent/test_opencode2_recordings.py` (failed first), and a new journey in `ui/e2e/run.spec.ts` that fails on the old build. A kept `apply-single` sim, read in a real browser, shows the rows in order. A finished step has no live stream, so following a growing row rests on that journey.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/braid#375
No description provided.