fix(cmux-next): restore #21369 and #21384, undone by the Chief Dock squash

Merged
TE
19d ago
+182-11

The agent pane asks for the same older-history page again on every render near the top of a chat, and Find in Chat repaints its highlights over every mounted row on every commit. Both were fixed on 10-17 (#21369, #21384) and both fixes are gone at the tip. 50a0c607aee (#21194, the Chief Dock squash) was built on a base without them and put the old VirtualTranscript effects back in webviews/src/agent-session/acpmux/App.tsx. This re-applies both commits unchanged, with cherry-pick -x.

What a reader sees: while a reply streams near the top of a long chat, each streamed chunk, resize or follow-scroll no longer starts another onLoadOlder() for a page already requested, and an open Find bar no longer walks every text node on every commit. Paging and Find work the same; this is the cost they had before #21194.

Found by the feat-cmux-next regression sweep (10-04 to 10-18). An audit of the rest of 50a0c607aee for other silent reverts is in progress; anything it finds gets its own PR.

Testing

  • New webviews/test/transcript-older-history-once.test.tsx (jsdom, like transcript-long-chat-updates): a streaming reply near the top asks for the older page once, and once more after the page lands.
  • bun test on the transcript and chat-find suites (transcript-*, chat-find-*): 26 pass, 0 fail.
  • bun run typecheck: no type errors in 1519 files. vp check on the two changed files passes.
  • bun run check stops at check:text-focus, which flags CmuxNextDaemonRecovery/DaemonRecoveryControls.swift:98, a file this PR doesn't touch. It fails the same way at the base.
  • Not tested: the Find repaint fix (#21384) has no test here or in its original PR. Its hunk is identical to afec4de9db7.

Review: SHIP with nits at 489afe76b35 (cmux-review subagent). Its two nits were already in #21369 and #21384, so they're left for a follow-up: one transient failure can stall paging in a short tail, and the Find keep-in-view loop no longer re-runs on a measurement-only commit.
Runtime test: n/a (medium tier)

Changelog

Fixed: Scrolling near the top of a long agent chat and searching with Find no longer redo work on every streamed update

Proof

Not UI: nothing draws differently; the change removes repeated history requests and highlight repaints, which the new test counts.

🤖 Generated with Claude Code