TUI: reuse streaming transcript height measurements - #14750
Conversation
Co-Authored-By: Warp <agent@warp.dev>
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR changes TUI transcript height measurement so clean animation-only frames can reuse cached streaming Agent Mode heights, while dirty output frames and retained presenter elements still refresh the canonical height. It also adds viewport regressions around retained-element measurement, streaming output reconciliation, and expanded-thinking stabilization.
Concerns
- This is a user-facing TUI behavior change, but the PR description does not include accepted TUI visual evidence. Please attach a terminal transcript, a render_to_lines/TuiBuffer::to_lines snapshot diff, or a ./script/run-tui capture demonstrating the jitter stabilization end to end.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Ports upstream `7c80cd5a3` ("TUI: reuse streaming transcript height
measurements", warpdotdev#14750) from the new pin `42effe840`. This is 4/4 of the
transcript-performance stack whose 2/4 already landed here as `19dd50df0`.
Two changes, both against the fork's real equivalents rather than the
names:
- `TuiAIBlock::needs_height_measurement` no longer forces a re-measure
merely because the block is streaming. Streaming output updates and
collapsible-section toggles already dirty the canonical height, so the
`is_streaming()` term only made animation-only repaints re-measure an
unchanged response every frame — the jitter this fixes.
- `TuiBlockListViewportSource::measured_agent_heights` prefers the
presenter-retained element (new `retained_view_height`, laying out a
`TuiChildView` when `ctx.rendered_views` already holds the view) over
rebuilding a parallel tree via `desired_height`, so the measured height
comes from the tree that will actually be painted.
Adaptation: upstream has three registries here (agent, CLI-subagent,
handoff); this fork has no handoff blocks, so the third arm is absent and
the CLI-subagent arm keeps its `?` early-return shape.
The test file needed no adaptation beyond the fork's existing
`TuiAIBlock::new` signature — upstream's diff applied as-is, including the
renames (`tui_agent_streaming_block_remeasured_at_stable_width` ->
`..._reuses_height_until_output_changes`, `reasoning_agent_block_source`
-> `streaming_reasoning_agent_block_source`) and the new
`viewport_layout_measures_retained_agent_element` regression. The renamed
streaming test asserts the opposite of what it did before because the
behaviour it covers is what this commit deliberately changes; it is not a
loosened assertion — it gained an output-update leg that proves the height
still refreshes when it must.
Nothing here was compile-verified; the round's build is batched.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VNUMjBVuwvEnRSgaawUCR3
Description
Prevents animation-only TUI repaints from repeatedly measuring an unchanged streaming Agent Mode response. Streaming output updates and collapsible-section interactions already dirty the canonical height, so clean frames now reuse it; when measurement is required, the viewport measures the presenter-retained element instead of rebuilding a parallel tree.
This is the jitter-specific subset of #14586. It intentionally excludes deferred measurement for streaming content below a fixed viewport.
Linked Issue
ready-to-specorready-to-implement.Testing
./script/formatcargo nextest run -p warp_tui— 954 passedcargo clippy -p warp_tui --all-targets --all-features --tests -- -D warningsAdded regressions for clean streaming-frame height reuse, dirty streaming-output reconciliation, retained-element measurement, and expanded-thinking stabilization.
I have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-BUG-FIX: Fixed occasional transcript jitter while Agent Mode responses stream in Warp Agent CLI.
Co-Authored-By: Warp agent@warp.dev