Skip to content

fix(agent pane): Find opened while a chunk is held searches the newest rows - #34072

Draft
lawrencecchen wants to merge 7 commits into
feat-cmux-nextfrom
cp/hpa-stream-find-held
Draft

lawrencecchen wants to merge 7 commits into
feat-cmux-nextfrom
cp/hpa-stream-find-held

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #34004 (review comment #34004 (comment), hpa-stream-reviewer-3). Find opened in a pause of a streaming reply, while a chunk was held in the streaming row's store, searched the pane's older rows until the next event. Now, when a view that reads the pane's rows (Find, an open artifact) turns the fast path off while a chunk is held, the pane draws the newest snapshot the client sent (onStreamingRowBlocked, with the listener's hand-off merge).

Stacked on #34004: until #34004 merges this diff shows its commits too. The own commits are 8d469f7 (red test) and 9201adb (fix). I merge feat in after #34004 lands, then ask for review.

Testing

  • Red first: test/agent-pane-streaming-row-block.test.ts (bun, deterministic). At 8d469f7 it fails (the API does not exist); at the head 2 pass: a block that turns on while a chunk is held asks the pane to draw once; a block with nothing held draws nothing.
  • Browser, on the cloud VM (Chromium 156): agent-pane-stream-renders, chat-find (3), agent-pane-streaming-no-flicker pass. bun run check passes.

Observed / Not run

  • Not run: WebKit (the GitHub Actions browser lane runs it).

Changelog

none


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes Find and an open artifact reading stale rows when opened while a streamed chunk is held in the streaming row store. Previously the pane kept its drawn snapshot until the next event, so these views searched older text; now the pane draws the newest snapshot the client sent when a blocking view turns the fast path off, preserving a pending hand-off record.

Written for commit 9201adb. Summary will update on new commits.

View guided diff Turn on auto-fix

lawrencecchen and others added 7 commits November 3, 2026 15:34
…ane or the composer (red)

HOT PATH AUDIT area F, row W1 (handoff/hot-path-audit/stream/AUDIT.md). The real
pane on the in-page mock daemon, 700 seeded turns, one text-only turn streamed
at full speed. acpmuxPerf.render counts renders per component (pane, composer,
row:<id>); loadRun reports them. On base: 111 chunks, 112 pane renders and 112
composer renders (cloud VM, Chrome 156).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HOT PATH AUDIT area F, row W2. The wire log and the direct client each parsed
every frame: 100 JSON.parse calls for 50 streamed chunks on base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e is parsed once

HOT PATH AUDIT area F, rows W1 and W2 (handoff/hot-path-audit/stream/AUDIT.md;
lead decision 1 in STATUS). Every streamed chunk re-rendered the whole pane
(AcpmuxPane, about 20 memos over all rows), the Composer and Session Info.

- streamingRow.ts: when a snapshot from the direct client differs from the one
  the pane drew only in the streaming reply's text (textOnlyRow: one pointer
  compare per row; summary, subagentViews and catalog, which the client rebuilds
  each time, compared by value), the pane keeps its snapshot and the row's newer
  text goes to a one-value store. The live VirtualTranscript reads it
  (useSyncExternalStore) and draws that row with its newer text and version.
  Any other change draws through the pane as before and clears the store.
- The fast path runs only while the transcript draws the reply's row as the
  client holds it (drawsAsIs), so rows that turns.ts reshapes take the old path.
- rowsRef and snapshotRef take every snapshot, so copy, menus and other
  imperative readers see the newest text.
- direct.ts parses each frame once and gives the parse to the wire log.

Measured on the cloud VM (Chrome 156, dev React; render counts, times
directional): 202 chunks rendered the pane 5 times and the composer 5 times
(base: 111 chunks, 112 and 112); the reply's row 197 times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aming row

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts and Find stay exact, no per-chunk serialization

hpa-stream-reviewer-3 (FIX at 34d8a58):
1. The live line under a streaming reply came back once the pane stopped
   re-rendering per chunk (its quietKey names the reply's id and version). The
   transcript's substitution moves the THINKING row's quietKey with the reply's
   newer version. The render test now samples every frame: 0 frames with the
   live line shown (164 of 264 with the move turned off).
2, 3. While an artifact is open or Find is open, chunks draw through the pane
   (setStreamingRowBlocked), so the panel follows an open fence and Find finds
   new text.
4. streamedOnly no longer serializes anything: the client keeps the published
   summary (keyed on its summary and usage), the subagent views record and the
   empty catalog as the same objects while they do not change, so every field
   compares by identity.
Smaller: only the live transcript subscribes to the store; the row counter does
nothing when measurement is off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…raws the pane's newest rows (red)

Review of #34004 (hpa-stream-reviewer-3, follow-up): Find opened in a pause of a
reply searched the pane's older rows until the next event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aws the pane's newest rows

Review of #34004 (follow-up): when a view that reads the pane's rows turns the
streaming-row fast path off while a chunk is held, the pane draws the newest
snapshot the client sent (onStreamingRowBlocked), with the hand-off merge the
listener uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lawrencecchen lawrencecchen added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 3, 2026
@blacksmith-sh

blacksmith-sh Bot commented Nov 3, 2026

Copy link
Copy Markdown

Found 6 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp45i11nk6/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmphwnehzgk/summary-fail.json (live):/summary-fail.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on 786f51b to compare; do not merge until green; see lane-rules

@teamleaderleo

Copy link
Copy Markdown
Collaborator

Awareness note from an agent lane that does not own this PR; it is not a review or a request to take the PR over.


For awareness: #36620 (a pure move, no behavior change, part of splitting acpmux/App.tsx) moves VirtualTranscript, RowFrame, TranscriptContext and the code around them into webviews/src/agent-session/acpmux/VirtualTranscript.tsx. #36363 already moved the row renderers into acpmux/rows/. To rebase this PR, re-apply its streamedOnly helper and the VirtualTranscript / RowFrame / TranscriptContext hunks in VirtualTranscript.tsx. The AcpmuxPane hunks stay in App.tsx.

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 9201adb9 Deployed Nov 3, 2026 by lawrencecchen via cmux-tui tree preflight #106946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants