Skip to content

TUI: reuse streaming transcript height measurements - #14750

Merged
kevinyang372 merged 1 commit into
masterfrom
kevin/tui-streaming-jitter-minimal
Aug 6, 2026
Merged

kevinyang372 merged 1 commit into
masterfrom
kevin/tui-streaming-jitter-minimal

Conversation

@kevinyang372

Copy link
Copy Markdown
Member

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

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • ./script/format

  • cargo nextest run -p warp_tui — 954 passed

  • cargo clippy -p warp_tui --all-targets --all-features --tests -- -D warnings

  • Added 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/run

Agent Mode

CHANGELOG-BUG-FIX: Fixed occasional transcript jitter while Agent Mode responses stream in Warp Agent CLI.

Co-Authored-By: Warp agent@warp.dev

Co-Authored-By: Warp <agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Aug 5, 2026
@warp-for-oss

warp-for-oss Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

@kevinyang372

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@kevinyang372
kevinyang372 requested a review from moirahuang August 5, 2026 23:01

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@kevinyang372
kevinyang372 merged commit 7c80cd5 into master Aug 6, 2026
33 checks passed
@kevinyang372
kevinyang372 deleted the kevin/tui-streaming-jitter-minimal branch August 6, 2026 14:22
jwp2987 pushed a commit to jwp2987/phosphor that referenced this pull request Aug 16, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants