Skip to content

perf(agents): open agent transcripts on recent activity and keep them smooth - #4181

Merged
LordMelkor merged 42 commits into
block:mainfrom
LordMelkor:jello/transcript-merge
Nov 23, 2026
Merged

LordMelkor merged 42 commits into
block:mainfrom
LordMelkor:jello/transcript-merge

Conversation

@LordMelkor

@LordMelkor LordMelkor commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Watching a turn on a 46 MB Claude transcript takes 95.91 s of waiting plus frozen time on main, cut to 0.25 s with #4188 and #4219.

Session main This PR with #4188 and #4219
Claude, 46 MB 95.91 s 0.25 s
Claude, 46 MB, earlier activity loaded 95.91 s (same) 3.30 s
Claude, 1 MB 14.31 s 0.50 s
Claude, 700 MB, open only 6.38 s 0.17 s
Codex, 48 MB 98.89 s (n = 3) 1.48 s
Goose, 8.4 MB 2.31 s 1.31 s
A harness plugin from outside the bundle, 50 turns 43.72 s 1.15 s

Wait for first rows plus >= 100 ms frozen frames until 2 s after turn end (median, n = 3 unless noted; ranges below). Without #4188, Codex 48 MB takes 7.65 s; #4219 fixes the status label.

The Transcript tab opened on recent activity: a row says Earlier activity is not loaded, with a Load earlier activity button

Size: +3,191/−162 in 20 files — core +223/−32, Claude +404/−38, Codex +133/−12, shared notice +66.

Changes and fixes

  1. Closed rows defer details until opened; linked messages expand before focus.
  2. Claude opens recent activity first; Load earlier activity, View activity, Refresh, or non-continuing polls load all history.
  3. Scroll holds when scrolled up as earlier history loads above.
  4. A 14-line layout block keeps the page moving during turns.
  5. Unchanged turns skip redraws for any reader.
  6. On turn end after full load, Claude reads only a continuing tail.
  7. Large Codex transcripts open on the newest turn.
  8. Claude polls appended bytes once a turn passes the 2 MiB tail.
  9. Fix: Showing the latest 50 turns appears when a live read drops a turn.
  10. Fix: Load earlier activity moves focus to Refresh transcript without scrolling.

Removed and costs

  • Removed: Start tail read (975 test lines), two zero-gain memos, 50-turn divider.
  • Turn start after full load: Reads all (0.47–0.48 s send frame; 0.57 s frozen vs 79.22 s on main).
Journey breakdown, ranges, builds, and fine print

Three interleaved journeys per build unless noted (median and range). Builds: main is 4363e10e14; the four Claude rows were measured on 451d26bd37 merged with #4188 (35d0c9ac7e) and #4219 (690aa82877), while Goose and the outside-bundle plugin were measured on the same merge made one commit earlier (914edabe82). Those two merges differ only in four Claude plugin files (src/bundled/claude-code/tabs.tsx, transcript.ts, and their two test files), which Codex, Goose, Pi, and outside plugins never load or run (checked from the import graph, including module load). Head ad0c834114 added the notice fix after those builds (setting a flag in one branch of the panel's live merge when a live read drops a turn at the 50-turn cap); no earlier table journey was measured again except one Codex 48 MB set at ad0c834114 with #4188 and #4219 (3.58 s, 3.48 to 3.60 s, n = 3). The Codex 48 MB row above now adds Change 7 on a build carrying this PR's head, #4188, and #4219 on main 4363e10e14.

  • Claude, 46 MB: main 95.91 s (94.95 to 96.02 s: 13.78 s wait for first rows, 82.13 s frozen) vs 0.25 s (0.15 to 0.36 s: 0.15 s wait, 0.10 s frozen). The turn takes 83.69 s on main vs 51.87 s (49.3 s vs 0.1 s frozen per minute watched).
  • Claude, 46 MB, earlier activity loaded: main 95.91 s (main always loads everything) vs 3.30 s (3.30 to 3.43 s: 0.16 s wait for first rows, 2.46 s for the Load earlier activity click, 0.70 s frozen after load completes, 0.69 to 0.81 s).
  • Claude, 1 MB (one session file of 1.27 MB, 230 records, 187 rows on screen): main 14.31 s (14.02 to 14.57 s: 2.61 s wait, 11.70 s frozen; 30 to 32 frames >= 100 ms, longest 1.0 s) vs 0.50 s (0.29 to 0.71 s: 0.29 s wait, 0.22 s frozen, 0.00 to 0.43 s; 0 to 4 frames >= 100 ms, longest 0.12 s). The turn takes 56.66 s on main vs 50.67 s.
  • Claude, 700 MB, open only (no prompt sent): main 6.38 s wait for first rows (6.37 to 6.46 s; draws 1,206 rows with 6 frames >= 100 ms from click to 5 s after first rows, longest 1.87 to 1.92 s) vs 0.17 s (0.16 to 0.18 s; shows latest activity, 4 rows, 0 frames >= 100 ms, longest 0.04 s).
  • Codex, 48 MB: main 98.89 s (98.34 to 99.25 s; n = 3: 5.85 s wait, 93.04 s frozen) vs 1.48 s (1.38 to 1.49 s; n = 3: 1.38 s wait, 0.10 s frozen; 129 rows on screen at first instead of 3,714, and 140 rows in 2 turns at end instead of 3,539 in 20 turns). Before Change 7, the same three PRs measured 3.54 s (n = 9: 3.35 to 3.87 s; on that earlier build the turn took 75.01 s on main vs 48.98 s, 55.8 s vs 0.8 s frozen per minute watched) and 3.66 s (3.65 to 3.68 s; n = 3: 2.73 s wait, 0.92 s frozen) on the control build without Change 7 — Change 7 cuts 2.18 s. On the combined build with Change 8 (production-equal to adc8a03b2e), Codex 48 MB measures 1.46 s (1.38 to 1.59 s, n = 3; 129 → 140 rows in 2 turns), matching the 1.48 s table row (0.02 s apart; Change 8 does not move Codex).
  • Goose, 8.4 MB (n = 3 per build): main 2.31 s (2.26 to 2.43 s) vs 1.31 s (1.15 to 1.42 s).
  • A harness plugin from outside the bundle, 50 turns (1,100 rows): main 43.72 s (43.48 to 43.77 s: 1.70 s wait, 42.02 s frozen; 166 frames >= 100 ms in each journey) vs 1.15 s (1.12 to 1.15 s: 1.12 s wait, 0.00 s frozen; 1 frame of 124 ms in one of three journeys). Its reader is unchanged by all three PRs (it receives changes 1, 4, and 5 through the shared panel). Stored history is 50 turns (1,000 steps, about 0.8 MB), and the turn uses a scripted model stand-in with 9 tool calls (54.15 s on main vs 53.21 s).
  • Small sessions (already quick, stay quick): Codex, 1 MB takes 0.40 s (0.31 to 0.55 s) on main vs 0.49 s (0.27 to 0.63 s) with the change (no gain). Goose, 1 MB takes 0.76 s on main (0.58 and 0.93 s; n = 2, third run had no valid journey in two tries) vs 0.43 s (0.32 to 0.57 s; n = 3) with the change.
  • Pi, opens only (n = 3 per build; model provider refused turns on both synthetic Pi sessions, so no Pi journey has a turn): 31 MB (1,392 rows) 4.07 s (4.06 to 4.11 s) on main vs 1.03 s (0.99 to 1.03 s); 1 MB (251 rows) 0.70 s (0.66 to 0.72 s) vs 0.23 s (0.23 to 0.23 s). Pi receives changes 1, 4, and 5 through the shared panel; its reader is unchanged.
  • Transcript tab closed during the turn (Claude 46 MB, n = 1 per build; a Codex closed pair agrees, n = 1 per build): 0 frames of 100 ms or more on either build (longest 83 ms on main, 93 ms with the change) and no session read — the change costs nothing when the tab is closed.
  • Which PR gives what: #4188 changes only the Codex reader, so Claude, Goose, Pi, and outside-plugin rows do not involve it. Before Change 7, this PR and #4219 without #4188 took 98.89 → 7.65 s (7.57 to 8.04 s: 3.39 s wait, 4.26 s frozen) — #4188 gave 4.11 s of the way from 7.65 s to 3.54 s, and Change 7 takes the remaining 3.66 s to 1.48 s. #4219 corrects a finished turn's status label and was not measured apart.
  • How Codex journeys are checked & row counts: The driver normally counts the turn's six commands by their text in the page, which reads 0 with Change 1 because closed row bodies are omitted until opened. Each Codex journey is therefore verified by counts instead (7 tool rows in the new turn on screen, 6 command calls in the turn's own session file, one command per call, none failed, turn >= 36 s); all Codex 48 MB journeys in the table pass (and main's three also pass the driver's text count), and opening one row on each new build shows the command in its body. With Change 7, the Codex 48 MB view starts at 129 rows (140 in 2 turns at end), and after Load earlier activity shows 3,714 idle and 3,539 after a turn (equal to Refresh, and matching the counts before Change 7). On main, the full view counts 3,734 rows at first rows and 3,565 at end — the difference from 3,714 / 3,539 is 20 tool items (26 items at end: 25 tool, 1 message) that main builds inside closed bodies and the new builds omit until opened, while every shown row is equal (20 turns, 20 prompts, 21 messages, 3,653 tool rows at first rows; 3,477 tool rows and 1 system item at end, falling as the new turn pushes an older, larger turn out).
Per-change numbers, layout details, and fallback rules
  1. Deferred row body (core): Carried single-change measurement (6 opens per build): open wait (click to first rows) dropped from 13.21 → 2.30 s (46 MB) and 8.68 → 4.17 s (120 MB). When a link targets a message inside a closed row, that row's body mounts before focus and scroll move so the highlight lands (+14/−4).
  2. Tail-first Claude preview (plugin, plus partial +4/−1 and onRefreshRequested +10/−1 in core): Carried measurement on top of Change 1 (6 opens per build): first rows dropped from 2.30 → 0.12 s (46 MB) and 4.66 → 0.13 s (700 MB). The reader checks that the preview matches the conversation, drops a partial leading turn cut by the 2 MiB tail, and falls back to reading full history when it cannot place a whole-turn boundary (the cut turn holds a steer, a timestamp is missing, a tool result has no call, or no whole turn fits). It shows "Earlier activity is not loaded" with Load earlier activity; View activity, a Refresh during preview, or a poll that does not continue the rows on screen loads full history.
  3. Anchored reading position (ActivityTranscript.tsx, +96/−5): Holds your reading position when you have scrolled up (away from the end); at the end (within 32 px), the pane keeps following the end as on main, so full history loads above and the preview's rows stay on screen at the bottom edge — and a preview shorter than the pane is always at the end, moving down to the bottom edge (measured on 700 MB in the desktop test below).
  4. 14-line layout block (ActivityTranscript.module.css, +14):
    • Without the 14-line block on Claude 46 MB with all history loaded (1,100 rows), the page runs at about 5 frames a second for the whole turn: from send to Completed, a person loses 54.4 s and 56.0 s (2 journeys) to frozen frames and waiting, vs a 2.58 s median (n = 9) on the same build with the block. In one more journey per build that also recorded layout: 269 frames of 100 ms or more (55.2 s) from send to end without the block vs 4 frames (1.15 s) with it; each animation tick of the live status row cost a render step of about 190 ms, and with animations paused the freeze stopped.
    • Layout measured in that journey: The block keeps the live status row 4 px inside its turn on each side; without it, that row passes its turn by 8 px on each side and the timeline is 8 px wider than its box (0 of 1,039 to 1,057 item rows pass their turn on either build).
    • contain: paint alone (same build, that one declaration removed): On Codex 48 MB (3,714 rows), frozen time from send to end is 1.02 s without it (0.65, 1.08, 1.02 s; n = 3) vs 0.50 s with it (0.38 to 0.60 s; n = 5), and frames of 50 to 99 ms double (2.64 s in 44 frames vs 1.32 s in 20 frames). At 1,100 rows (both Claude journeys) it measures nothing — so it saves half a second per watched turn on a large session at the cost of one line.
  5. Skip unchanged turns (TranscriptPanel.tsx +38, ActivityTranscript.tsx +4/−1, plugin-authoring-guide.md +2): The panel reuses equal turn objects and the renderer memoizes each turn. Works for every reader, including external plugins that rebuild all turns on each read; the plugin guide adds 2 lines on unique, stable turnIds across reads and leaving previously returned turns and items unchanged. Carried single-pair Codex 48 MB measurement (3 turns per build): frozen time in one working turn fell from 3.59–3.79 s → 0.81–0.87 s (new session file) and 3.56–3.58 s → 0.82–0.86 s (appending to the 48 MB file; that build pair also carried the removed 2-line people-context memo, 0.02 s alone).
  6. Tail-only stop read after full load (Claude plugin, +73 net production lines and +215 net test lines added to this PR — Claude plugin +238/−33 before vs +311/−34 with it, tests +1,549/−47 before vs +1,764/−67 with it, 0 core lines): When the tab already holds full history from the working turn and the session tail continues it, the reader keeps held turns and reads only the turn's last records from the tail; in every other case (tail mismatch, a poll that does not continue the rows, Refresh) it reads everything as before.
    • What a person gets (Claude 46 MB, all history loaded): After the agent's last record, Completed arrives in 0.17 s (0.16 to 0.18 s; n = 3) instead of 1.94 s (1.91 to 2.05 s; n = 9). From send to the label, frozen frames plus that wait fall from 2.58 s (2.53 to 2.75 s; n = 9) to 0.73 s (0.73, 0.73, 0.87 s; n = 3), and the same journey measured 3.85 s before this change (3.72 to 3.95 s; n = 5) against 3.30 s (3.30 to 3.43 s; n = 3) with it. After each of the three journeys, a Refresh (which reads everything) showed equal row counts, row kinds, and duration badge.
    • Why it came back: An earlier form of tail reads was taken out when its first measure counted frozen frames only (0.42 s and 0.80 s, under 1 s). Measuring what a person waits for — the Completed label — showed 1.9 s per turn, so the stop half returned in a smaller form while the start half (which measured no gain) and the earlier state bookkeeping stay out.
  7. Codex preview of the newest turn (src/bundled/codex/tabs.tsx, +132/−9, no core line, Codex reader unchanged): When a Codex transcript holds more than 128 entries (a constant in the tab; 2 shared help lines cover Claude and Codex), the tab opens on the newest turn and shows up to 128 entries when complete (a working turn is shown in full), with "Earlier activity is not loaded." and Load earlier activity; clicking Load earlier activity or Refresh transcript shows the full view (up to 20 turns, as before).
    • Journey & checks (Codex 48 MB, n = 3 interleaved per build on main 4363e10e14 with #4188 and #4219): Waiting plus frozen time drops from 3.66 s (3.65, 3.66, 3.68 s; 2.73 s wait, 0.92 s frozen) to 1.48 s (1.38, 1.48, 1.49 s; 1.38 s wait, 0.10 s frozen), cutting 2.18 s (129 rows instead of 3,714 at first; 140 rows in 2 turns instead of 3,539 in 20 at end).
    • App checks: Two sends in one app session (3 journeys per build) kept every row of a kept turn with no blank sample, kept the previously newest turn on screen, and continued send 1's thread on send 2 (one mounted test fails before the fix where starting a new thread remounted the view). After Load earlier activity, row counts equal the full view (3,714 idle with equal kinds and ID hash vs without Change 7 across 3 + 3 opens; 3,539 after a turn, equal to Refresh). Clicking Load earlier activity during an in-flight background read (28 to 34 ms after read start, 3 of 3) brings rows in after 1,405 / 1,430 / 1,432 ms; row count only rises afterwards and the button does not return, including when that read finishes (also covered by a mounted test).
  8. Claude incremental poll on turns larger than 2 MiB (Claude plugin only, +111/−13 production in three files, +337/−14 tests in two files, 0 core lines; combined plugin delta with Change 7 against ad0c834114: +243/−22 production in four files, +604/−16 tests in three files): Previously, once a working turn outgrew the 2 MiB tail, the Claude reader fell back to reading the whole file at most once every 30 s (about 47 MB and ~0.75 s frozen per read on a 46 MB session), leaving the live view 15 to 32 s behind. With this change, the reader resumes from the byte where its last read ended and parses only appended records while the turn stays working.
    • Measured (app journeys on adc8a03b2e, n = 3 + pilot per shape, all valid on first try; control = build without Change 8, n = 3 per shape):
      • 46 MB long turn: A late tool result shows in its own row while Working 0.98 s (0.07, 0.98, 1.02 s) after being written with no whole-file read in between, vs 6.94 s (5.13 to 7.61 s) via a whole-file read without Change 8. Turn markers within 10 s: 9 of 9 (slowest 2.24 s) vs 7 of 9 over 10 s late (slowest 32.5 s). Frozen time: 1.42 s/min (1.34, 1.42, 1.67 s) vs 1.86 s/min (1.85, 1.86, 2.50 s). Working label after the last record: 2.26 s (2.16, 2.26, 2.72 s) vs 2.14 s (2.13, 2.14, 2.25 s — holds the pre-run <= 0.5 s line above control median, with one of three runs above every control run). Closing and reopening the tab mid-turn (click to first rows): 2.61 s (2.59, 2.61, 2.61 s) vs 2.63 s (2.59, 2.63, 2.69 s). Rows at end equal rows after Refresh in 3 of 3 (81 / 82 / 83 rows, same count per kind; the three watched rows equal in status, element count, and text length). Cost per journey: 47 to 52 polls (16 to 22 empty), 5.5 to 6.4 MB returned by polls in total, 4 whole-file reads (196 MB) vs 6 without Change 8 (two of the 4 are fallbacks: the failed send's result, and one at turn end).
      • 700 MB long turn: Turn markers within 10 s: 9 of 9, 0.09 to 1.97 s after being written, vs slowest 26.9 to 32.1 s per journey without Change 8. Frozen time: 0.81 s/min (0.79, 0.81, 0.84 s) vs 1.21 s/min (1.21, 1.21, 1.27 s; every run below every control run). Working label after the last record: 3.19 s (3.17, 3.19, 3.20 s) vs 3.15 s (3.14, 3.15, 3.30 s). Closing and reopening the tab mid-turn (click to first rows): 3.47 s (3.41, 3.47, 3.51 s) vs 3.48 s (3.40, 3.48, 3.51 s). Rows at end equal rows after Refresh in 3 of 3 (79 / 79 / 81 rows, same count per kind). Cost per journey: 46 to 53 polls (18 to 23 empty), 3 whole-file reads (104 MB) vs 6 (210 MB), each 2.6 s (one of the 3 is a fallback at turn end).
      • 46 MB session with a 12 MB turn (tab closed and reopened 70 s into the turn): Turn markers within 10 s: 30 of 30 — 27 show 0.13 to 2.54 s after being written, while the one written while the tab is closed and reopened shows after 8.18, 8.68, and 8.96 s (close to the 10 s line because it waits for the reopen's read), vs slowest 26.8 to 28.2 s per journey without Change 8. Frozen time: 1.42 s/min (1.32, 1.42, 1.44 s) vs 2.18 s/min (2.14, 2.18, 2.18 s; every run below every control run). Working label after the last record: 4.13 s (4.08, 4.13, 4.19 s) vs 4.11 s (4.08, 4.11, 4.12 s). Closing and reopening the tab mid-turn (click to first rows): 4.54 s (4.51, 4.54, 4.58 s) vs 4.61 s (4.54, 4.61, 4.67 s). Rows at end equal rows after Refresh in 3 of 3 (240 / 247 / 248 rows, same count per kind). Cost per journey: 46 polls (7 or 8 empty), 3 whole-file reads (163 MB) vs 6 (one of the 3 is a fallback at turn end).
      • (Control comparison scope: the control build sits on a main 16 commits newer than this PR's head, so frozen-time, label, and reopen comparisons cross that difference; the late row, markers, and rows-equal checks are measured inside one build. End-row comparison runs after the stop's whole-file read; mid-turn poll correctness is verified directly by the 19 accepted polls parity test and code review under Checks below.)
    • Reach (local Buzz-agent Claude sessions, Nov 3 to Nov 22, sizes and timestamps only): 777 of 9,219 turns (8.4%) outgrow the 2 MiB tail in 25 of 146 sessions; 18.2% of agent working time lies past that point (4.3% when counting idle wait for the next prompt); three in four of those turns start in a session already larger than 50 MB.
    • Reader fallback rules & limits: The reader falls back to a whole-file read on any of: a send result whose call was in an earlier poll (the only fallback triggered across the 777 real long turns, 970 times across 193,312 replayed records vs 13,687 whole-file reads on the 30 s clock — no more reads than today in 772 of 777 turns, while 5 turns send faster than once per 30 s and read more often for that stretch); a tool result matching no open row; a user prompt without a timestamp; a new turn; a different session path or a file that shrank; more than 32 MiB appended since the last poll; or a short read before the cursor. Mid-turn sends are covered by two mounted tests (failed and successful sends; a split send triggers a whole-file read and the next poll matches after reseeding), and the failed send's fallback ran in 3 of 3 46 MB journeys on adc8a03b2e. A file rewritten in place at the same size is unseen until the next whole-file read; a single turn over 64 MiB drops its early working-only rows at stop; a steering message whose author name resolves late omits the name until the next whole-file read; and a second long turn right after the first (the 30 s clock must not hold back its first read) is covered by a reader test and a Linux run, not an app journey.
  9. Fix: "Showing the latest 50 turns" notice shows when a live read drops a turn (TranscriptPanel.tsx, +10/−6):
    • What was wrong: While an agent works, the panel merges each live read into held turns and trims the result to 50 turns while leaving the "more turns exist" flag untouched. A 50-turn transcript growing to 51 during a turn lost its first turn while hiding the notice until the next successful full read, normally at turn end (main has the same fault).
    • What it does: When the merge drops turns at the cap and the transcript carries more: false, the result carries more: true (transcripts without more stay unchanged).
    • Reach: Among bundled tabs only Goose passes a latest-turns reader reaching this path (Codex and Pi read in full every time; Claude requests a full read when the window would pass 50 turns); external harness plugins using a latest-turns reader get the fix too.
    • Tests & history: The panel's live-window test asserts the flag at 50 → 51 turns, and a mounted Goose test verifies the notice is absent at 50 turns and visible when the 51st arrives (both fail on 9e24fb6b6f). The first reviewed head had this fix; the cut removed it when restoring main's window code, review of 9e24fb6b6f caught the hidden notice, and it is back as it was.
  10. Fix: Load earlier activity keeps focus in the transcript (src/bundled/TranscriptPreviewNotice.tsx +66, claude-code/tabs.tsx +6/−15, codex/tabs.tsx +11/−13, tests +41/−8; 0 core lines):
  • What was wrong: Pressing Load earlier activity removed the focused button without moving focus, dropping keyboard focus to body in both the Claude and Codex previews (confirmed in code and on the Linux desktop app: 3 of 3 keyboard and 1 of 1 mouse on Claude 46 MB; 6 of 6 keyboard — 3 at rest and 3 with Enter during a running read — and 1 of 1 mouse on Codex 48 MB).
  • What it does: One shared plugin notice component checks before removal that Load earlier activity holds focus in that panel and, after render, focuses Refresh transcript in the same panel's header with preventScroll only if focus fell to body (carrying no flag across reads). Refresh transcript stays mounted in the header, reading position stays unchanged, mouse clicks leave no focus ring (only Firefox honours focusVisible; WebKit and Chromium ignore it and follow native :focus-visible plus the app's keyboard-navigation gate), and focus stays put if the reader moved it during the load or if the load fails.
  • Tests & app check: Four mounted keyboard cases (rows arriving immediately and after a delay, in each reader) drop to body on bd43030737 and move to Refresh transcript with the fix; Claude also retains focus on the button after a failed load and on a row tabbed to during the load; Chromium and WebKit component fixtures pass 12 of 12 (Enter moves focus to Refresh with a visible ring, mouse clicks move without a ring, and unfocused clicks leave body untouched). On the Linux desktop app (WebKitGTK, real key and mouse events), 15 of 15 focus journeys pass every focus line (plus 3 Claude loaded-row journeys, 18 in all; without the fix, 9 of 9 keyboard and 2 of 2 mouse end on body): Claude 46 MB (#4181 alone at 44795829d2) moves focus to Refresh transcript with :focus-visible in 3 of 3 keyboard journeys (2.50 to 2.57 s press to rows) and without a ring in 3 of 3 mouse journeys (2.46 s), adds 0 px scroll movement (6 of 6: scrollTop 43,081, gap to end 168 px, top turn 214 px, equal to control), and keeps "earlier activity loaded" at 3.37 s (3.28 to 3.69 s: 0.16 s open wait, 2.43 s click wait, 0.78 s frozen; first rows 0.15 to 0.17 s; 3.36 s before the fix — meets the <= 3.51 s median line, with one back-to-back run at 3.69 s having 7 frames >= 100 ms vs 3 to 5 at equal frozen work — time over 50 ms 1.23–1.27 s vs 1.17–1.36 s); Codex 48 MB (44795829d2 merged with #4188 and #4219) passes 3 of 3 keyboard at rest, 3 of 3 keyboard during a running read (Enter 10 to 13 ms into the read), and 3 of 3 mouse without :focus-visible (1.41 to 1.56 s click to rows, 0 px row movement, identical scrollTop vs control; the in-flight check ran on Codex only, and the loaded-row check ran on Claude only).
Why core, and how small (+223/−32 in three core files)

Why core, and how small

Per-file split (at c760f6e751): Core +223/−32 (ActivityTranscript.module.css +14, ActivityTranscript.tsx +151/−25, TranscriptPanel.tsx +58/−7); shared notice +66 (src/bundled/TranscriptPreviewNotice.tsx); Claude plugin +404/−38 (runtime.ts +64/−8, tabs.tsx +162/−10, transcript.ts +178/−20); Codex plugin +133/−12 (src/bundled/codex/tabs.tsx); docs +4 (buzz-help.md +2, plugin-authoring-guide.md +2); tests +2,361/−80 in ten files (+802/−22 in claude-code/tabs.test.tsx, +572/−24 in claude-code/transcript.test.ts, +279/−2 in src/bundled/codex/tabs.test.tsx, +259/−13 in ActivityTranscript.test.tsx, +212/−7 in TranscriptPanel.test.tsx, +135 in tabs-overlap.test.tsx, +45/−1 in goose/tabs.test.tsx, +43/−7 in two files under tests/browser/, and +14/−4 in trust.test.tsx); whole PR 20 files, +3,191/−162 (earlier cut before the test trim: 16 files, +3,178/−126).

Core change Why a plugin cannot do it How small
Row bodies wait until opened, and linked closed rows mount before focus (ActivityTranscript.tsx, Disclosure) The shared renderer draws every agent type's rows; plugins pass data only and cannot control what a closed row mounts or pre-mount a target row before scroll. +26/−12 for lazy bodies (visited / onToggle, including 9 re-indented lines in Sections) + +14/−4 for linked-row mount (+40/−16 combined).
Reading position holds when scrolled up, plus preview flag (ActivityTranscript.tsx, TranscriptTimeline) The scroll container and DOM commit that prepends earlier rows belong to the renderer, and scroll position must be read in that commit (when at the end within 32 px, it follows the end as on main). +96/−5 for scroll hold (class component using getSnapshotBeforeUpdate, no scroll listener) + +4/−1 for partial prop.
Turn memo (ActivityTranscript.tsx) The shared renderer owns the turn component for every agent type. +4/−1.
Reuse equal turn snapshots (TranscriptPanel.tsx, reuseTurns and sameFields) Keeping unchanged turn objects in the panel works for every reader, including external plugins outside the bundle that rebuild all turns on each read and have access only to the panel. +38.
14-line layout block (ActivityTranscript.module.css) The layout block applies to .turn rows and the live status row inside the panel; plugin CSS is scoped to plugin elements only. 14 CSS lines, transcript panel only.
Queued Refresh notice (TranscriptPanel.tsx, onRefreshRequested) A Refresh clicked during a read stays queued inside the panel with no call to the reader; external plugins get only the panel. +10/−1, optional.
Show "more turns exist" notice at the 50-turn cap (TranscriptPanel.tsx) The shared panel merges polled live reads and trims to 50 turns, so only it sees when turns are dropped and updates more; applies to Goose and any external latest-turns reader. +10/−6.
Costs, scope, and what stayed out
  • Removed start-time tail read: Measured no gain on the journey, so turn start after Load earlier activity or View activity reads full history as on main. At 46 MB (3 journeys): one 0.47 to 0.48 s frame in the first second after send, and 0.57 s frozen from send to 2 s after end (0.48 to 0.58 s; 1–2 frames) vs 79.22 s on main (78.45 to 79.31 s). Took out the state bookkeeping and 975 test lines (542 lines deleted in transcript-reader.test.ts; 433 removed from tabs.test.tsx); Change 6 brought back 215 net test lines for the stop half.
  • Removed zero-gain memos & non-speed fixes: People-context memo (0.75 s frozen with vs 0.77 s without across three 48 MB Codex working turns per build) and expanded-reply memo (never mounted while a row is closed); one fault on main met only when a live session crosses 50 turns (a session divider) is not speed work and stays out (the "more turns exist" notice fix is back as Fix above).
  • Load earlier activity: On Claude, draws all rows in one block — clicking waits 2.46 s (2.43 to 2.47 s) at 46 MB, with 1.01 s of that frozen (1.00 to 1.02 s; 2 frames, longest 0.53 to 0.55 s). On Codex, reaching older activity takes one click waiting 1.3 s (1,276 / 1,297 / 1,311 ms after a turn; 1,374 / 1,380 / 1,429 ms on an idle transcript) in one long frame, with 0 host reads (the full history stays in memory while the short view is shown) and 0 px movement of the viewed row (measured at the second frame and after 1 s).
  • Short preview on Load earlier activity (from code; measured on 700 MB in the desktop test below): When a latest-activity preview is shorter than the pane, it is already at the end (within 32 px), so completing Load earlier activity follows the end as on main and moves the preview's rows from the top to the bottom edge with the earlier rows above them (they stay on screen; same follow-the-end rule for every reader, with no code added for or against it).
  • Latest-view Refresh at 700 MB: One frame of about 0.6 s (carried measurement; the code path is unchanged).
  • First rows at bd43030737's production code (adc8a03b2e): 0.15 to 0.16 s (6 opens, 46 MB) and 0.14 to 0.16 s (3 opens: 139, 155, 156 ms click to first rows, 700 MB); 1 MB measured 0.28 to 0.29 s (3 opens) on the earlier build, and 44795829d2 measured 0.15 to 0.17 s (3 opens, 46 MB).
  • Other session files & post-Load reads: The latest-activity view does not inspect the conversation's other session files until Load earlier activity or Refresh; after Load earlier activity, turn start reads everything while turn end reads the tail (Change 6).
  • Tail-check window at stop (Change 6): Matches the tail against the held turns by turn ID, start time, and session (requiring a completed final turn and unambiguous tail boundaries) rather than re-reading earlier records or tracking a file offset, and reads when the agent reports the stop; a record written after that appears on the next read or a Refresh (main's full read at stop has the same window).
  • Long views, big rows, Search, and > 2 MiB turns: A latest-activity view over about 400 rows draws in one block; expanding a ~100 kB row body pays its build cost on open; Find on screen searches only loaded rows while in the latest-activity view; conversations whose last turn exceeds the 2 MiB tail fall back to main's full open read. For Codex, Buzz links cannot target a transcript row; the code opens the full view when the tab opens with a focus target, though that path was not run in the app.
  • Other agent types & Pi: Codex, Goose, Pi, and external harness plugins receive changes 1, 4, and 5 through the shared panel (Change 3 acts when a preview becomes full history — for both Claude and, with Change 7, Codex). Goose and Pi readers and tabs are unchanged, and the Codex reader is unchanged (Change 7 changes only the Codex tab). Synthetic Pi turns were refused by the model provider on both sessions, leaving open timings only.
  • Snapshot fallback and duplicate IDs: If the whole read is equal, reuseTurns keeps the prior snapshot; on any comparison error, it takes the new read as-is; a duplicate turnId in one read never reuses a wrong turn and renders what main draws.
  • Screen readers and Codex retry: For screen readers, no focus is lost: Load earlier activity moves focus to Refresh transcript (announced as that button), and a failed load announces an error alert. However, completion gives no spoken notice when earlier activity has loaded, a Codex load in flight shows no busy state, and no real screen reader ran. At rest Codex loads earlier turns from memory with no host read, while the failure-and-retry recovery path without a held snapshot is verified by reading the code and has no test of its own.
Checks (at c760f6e) and browser guard
  • At c760f6e751: Combines 44795829d2 (approved in review 6013410077) with three merges of main, the test trim under the repository's Tests rule, and one commit restoring two regression checks at the reviewer's request (review 6015247320): the same-object check on an equal Refresh, and the check that the arrival surface is marked when scrolling starts. Docs keep main's shorter guides (+2 help, +2 authoring); the net trim is now 5 test cases (115 net test lines) with 0 production changes (was 6 cases, 136 lines). Six suites pass (4,847 passed, 34 skipped: bundled agents 408 passed; Claude plugin 683 passed, 11 skipped; Codex 772 passed, 4 skipped; Goose 551 passed, 14 skipped; Pi 252 passed, 4 skipped; agent features 2,181 passed, 1 skipped; Markdown adds 8 passed for 4,855 passed, 34 skipped overall), browser checks run 5 passed, 1 skipped, both type checks pass, and the checks on the PR show CI status.
  • landmines on added lines at c760f6e751 (17 files checked against main): Still 19 findings in the same 4 files (1 re-indented biome-ignore in ActivityTranscript.tsx, 1 @vitest-environment jsdom in tabs-overlap.test.tsx, 12 no-test-doubles in claude-code/tabs.test.tsx and tabs-overlap.test.tsx, 5 no-test-doubles on the session-status spy in codex/tabs.test.tsx), zero timing findings, and 0 on 44795829d2's, 8d1289d98b's, or the restoring commit's added lines, on Change 6's, Change 7's, Change 8's, or the 50-turn notice fix's production lines, and on the 19 accepted polls parity test or browser test lines.
  • Change 6 state machine & tests: Stop reuses a complete working snapshot only when the tail matches its final turns; Refresh invalidates it; a poll that does not continue the rows records the need for full history before a stop can interrupt it. Tests cover a two-turn tail at the 50-turn cap, an unseen 51st turn, oversized and partial turns, a Refresh queued during a poll, and overlap/error race recovery paths.
  • Change 8 mid-turn poll parity (src/bundled/claude-code/transcript.test.ts & code inspection): On a synthetic append-only session file past 2 MiB, 19 accepted polls in a row are each compared in full against a fresh whole-file parse of the same bytes while the turn is working — covering assistant text, thinking, an open tool call, a tool result, a second open tool, a failed tool, a same-batch send success and error, a timestamped steering message, an untimed queued steering message, meta/sidechain/no-ID/attachment/progress/system records, a multi-page append, a pending send, and one more append after a whole-file read. All 19 are equal (0 whole-file reads); splitting a send across two polls makes its receipt request a whole-file read, and the next poll after reseeding matches again. By code inspection of the parser, its dispatch is closed: any other top-level record type is skipped identically by both paths (missing ID or non-user/assistant), other content block types are ignored identically, and a mid-turn compaction (system boundary followed by a user summary) is skipped and then read as a new turn, prompting a whole-file read just as the whole-file parser splits.
  • Reviews & Change 4 browser guard: Each of the three kept cut behaviours (Refresh loads full history; working polls advance the 50-turn window; a poll that does not continue the rows loads full history) fails a mounted test when removed (8 untested lines removed); Change 6, Change 7, Change 8 (including the 19 accepted polls parity test), the 50-turn notice fix, and the Load earlier activity focus fix (44795829d2) each passed a separate agent review. A browser test under tests/browser/ (added at 9e24fb6b6f; +43/−7, 0 app lines; CI runs WebKit and Chromium) mounts the real panel with a working turn at 419 px and asserts the live status row lies inside its turn on both sides — passes in WebKit with the 14-line block and fails when removed (8 px past left edge; guards the 14-line block, not contain: paint alone).
  • Same rows as a full read: On a build of this PR's production files at 451d26bd37 merged with #4188 and #4219's earlier head on main 4363e10e14 (matching the Claude plugin files at 9e24fb6b6f and ad0c834114), page rows after a watched turn equal the rows that one Refresh gives: Claude 46 MB 1,092 rows (1,042 item rows, 50 turns) equal in 3 of 3 runs; Claude 700 MB 1,187 rows (1,137 item rows, 50 turns) equal in 3 of 3 runs. Each run opens the session, clicks Load earlier activity, watches one short working turn with every row loaded, lists rows, clicks Refresh (full read), and lists again, comparing row count, row ID list, and for each item/turn row a hash of text and element count (0 rows only before, 0 rows only after, 0 differing rows; covers rows, not notes above them, and does not compare against a main build).

End-to-end desktop test

An end-to-end test by the maintainer's agent on a separate Linux machine, made with human guidance from the maintainer driving this work.

Desktop test setup, clip, and results
  • Setup (at adc8a03b2e alone — same production code as bd43030737, nothing merged in): pnpm tauri build --debug --no-bundle against a local relay on that machine, throwaway owner and Claude agent on that relay, synthetic 46 MB and 700 MB sessions, fresh app per journey (9 journeys, all valid on first try).
  • Step 1 — Claude 46 MB open + prompt (n = 3): First rows 0.15 to 0.16 s after the click; 0.16 s waiting plus frozen time (0.16, 0.15, 0.25 s — median within the pre-run line of <= 0.56 s).
  • Step 2 — Claude 46 MB with Load earlier activity + Refresh (n = 3): Open, scroll up, click Load earlier activity, send a prompt: 3.36 s waiting plus frozen time (3.51, 3.32, 3.36 s — median within <= 3.63 s). After each turn, rows before and after Refresh transcript matched in 3 of 3: 1,099 / 1,098 / 1,098 rows (50 turns), same ID order, kind, text hash, and element count.
  • Step 3 — Claude 700 MB short view → Load earlier activity (n = 3): 3 of 3 the same as on 332986dd9e — opens on 4 rows in 1 turn at the top of the pane; after Load earlier activity, 1,206 rows in 50 turns with the pane at the end (0 px), keeping the latest turn and its 2 rows on screen 363 px lower (turn top 402 px lower, ending 28 px above bottom) and keeping the fourth short-view row on the first of the 50 turns.
  • Clip: Side-by-side comparison of main and this change aligned on click (Claude 46 MB): at 1 s, this change shows the latest rows while main shows an empty panel; main shows its first rows 13.8 s after the click.

Opening a 46 MB Claude transcript side by side on main and with the preview

🤖 Generated with Claude Code

LordMelkor and others added 10 commits November 20, 2026 22:29
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor
LordMelkor marked this pull request as ready for review November 21, 2026 13:19
@LordMelkor
LordMelkor requested a review from a team as a code owner November 21, 2026 13:19
LordMelkor and others added 2 commits November 21, 2026 12:03
Retry a failed history read once for each new focused opening. Use the last settled transcript for a working-state change, and fall back to a full read when the tail cannot continue that history.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
A read that finishes while the window is hidden may have a full Refresh queued behind it. Drop its tail-merge base so returning to the transcript rereads earlier rows. Preserve the visible row when history expands after a viewport resize.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@morgmart

Copy link
Copy Markdown
Contributor

🤖 Thanks for this! Design gets more PRs than we can review one by one, so each day we pick a few to look at, starting with what people are running into most. It may take us a while to get to this one, and we appreciate your patience. If it's urgent, mention it in #buzz-feedback. And if this could work as an external plugin, please build it that way. Plugins are quicker to iterate on, and we save core for changes meant to shape how Buzz works for everyone.

LordMelkor and others added 2 commits November 21, 2026 13:36
Notify readers when a refresh is requested, including during a live poll. Keep the last accepted rows through cancellation so a turn ending in the background can resume with a tail read. A pending manual refresh still reloads earlier activity.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Finishing the latest turn used to render earlier turns again. Skip that work when the turn and its display props are unchanged, and reuse rendered Markdown when an open reply keeps the same text.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: COMMENT — recommend request changes for a reproducible author-actionable regression. Reviewed 9657bb35451c99d3cf1687f1af9ca76fa7f001f0...737542aff44235d9e0c349cf95e743a91d23ab8f (merge-base 270577677cdb1df143e471c891b559e4ce330efc; exact head 737542aff44235d9e0c349cf95e743a91d23ab8f). Risk: high — the changed transcript-loading and refresh contract can hide earlier activity.

Blocking finding — Refresh does not load earlier activity from a partial preview. On a Claude session over 2 MiB, the initial view correctly shows recent turns and the “Earlier activity is not loaded” notice. Clicking Refresh transcript triggers the panel’s full request (src/features/agents/TranscriptPanel.tsx:293-299), but the Claude reader re-enters transcriptPreview while history.attempt === 0 and full history is unset (src/bundled/claude-code/tabs.tsx:1098-1113). The notice and missing older rows remain; the PR explicitly says Refresh and Load earlier activity both perform the full read. An isolated test-only probe of this exact head opened a >2 MiB session, verified the recent-only preview, clicked Refresh, then failed because the earlier row was absent (scoped Vitest: 1 failed, 113 skipped). The separate Load earlier activity path has passing coverage but does not exercise this action.

Author action: preserve manual Refresh’s full-read intent through queued and interrupted reads, bypass the preview for that request, and add a regression test opening a long session and clicking Refresh directly from its partial view. The fix should retain the existing Load earlier, automatic latest-turn, hidden-window, and stale-response behavior. Verification owner: author for the fix and regression test; reviewer for the changed-head recheck.

Other contracts traced: preview/full/latest-turn routing, panel read cancellation/queueing, recent-first disclosure, scroll/focus retention, empty/error messaging, and bounded turn display. Source and existing tests showed no additional established defect in those paths; this is not a claim of native UI validation. The change is client-local transcript reading/rendering and does not alter a relay wire contract.

Validation: exact-head checkout clean; git diff --check 9657bb35451c99d3cf1687f1af9ca76fa7f001f0...HEAD passed. Required GitHub CI checks are passing at this head (Windows native validation skipped). Independent full Vitest/typecheck on isolated Blox is in progress; no terminal result is claimed here. Manual/native evidence: no independent native app run or rendered theme/zoom/narrow-layout/OS-scroll proof. Residual risk / verification owner: reviewer/tooling should exercise those visible states at the changed head; the pending full package gate belongs to reviewer/tooling, not author rework for this finding.

Recommendation: request changes.

LordMelkor and others added 2 commits November 21, 2026 23:17
Record the full-history request when Refresh is clicked so a queued or interrupted read can finish it.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Keep entry stamps, overlap observation and publication tied to the active read. Preserve manual Refresh across cancellation and retry, and retain the observed overlap decision across a stop.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 Reply to the review above by Jude's code review agent.

The finding is right. In the latest-activity view, Refresh read the last 2 MiB again and left the "Earlier activity is not loaded" row in place.

Fixed in de3bf6dfc0:

  • Refresh in that view now runs the full read and leaves the tab as Load earlier activity does: the notice is gone, the earlier rows are there, the reading position holds, and later starts and stops of work read only the latest turns.
  • The request is kept through interruptions: when the click lands during a read, and when the turn ends before the read runs, with the window shown or hidden.
  • Size: two lines in src/bundled/claude-code/tabs.tsx, no core line. Four new cases fail on the previous head and pass here.
  • Unchanged: Load earlier activity, the automatic latest-turn read, the hidden-window deferral and the handling of stale responses. Their tests pass without edits.

The description is updated (change 2, Costs, Checks, the test counts).

Two more pieces may still land on this branch, each only if its measurements hold, and I will note each here when it does: reuse of unchanged turns between reads (shared renderer and panel), and the Claude reader's read decisions moved into plain functions with no change in behaviour.

LordMelkor and others added 7 commits November 21, 2026 23:40
Keep one mounted test for runtime observation ordering. Check the before and after cancellation decisions at the reader transition boundary.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Wait for the real page process to exit before querying the shifted turn. The DOM query deadline previously included file I/O on a loaded worker.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Release each held read in cleanup before querying the rendered rows. Cover expansion, work start, work end and manual refresh with the same fixture helper.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
LordMelkor and others added 3 commits November 22, 2026 03:51
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Keep the complete view while Claude works. At stop, update its final turns from the session tail when their identities and start times match. Read full history after a refresh, a change in the turn window, or an ambiguous boundary.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: COMMENT — recommend request changes. Reviewed 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..9e24fb6b6f8f5f2be8cd0b3db24e0f81b64e43c6 (clean worktree). Risk: high — shared transcript windowing and live-read lifecycle affect multiple agent types.

Blocking finding (P2): src/features/agents/TranscriptPanel.tsx:76–80 trims merged live turns to TURN_LIMIT but no longer promotes more when an initially complete 50-turn transcript grows to 51. Goose's live reader supplies only turns (src/bundled/goose/tabs.tsx:905–925), so the first turn silently disappears while its “Showing the latest 50 turns” notice remains hidden. Other consumers of the shared panel can likewise retain a false more. The previous implementation promoted this flag. The committed live-window test at src/features/agents/TranscriptPanel.test.tsx:447–475,700–706 checks the slice/identity but not more; an added temporary more === true assertion failed at this head (received false). Author action: restore more: true when a transcript exposing that field loses turns at the 50-turn cap; assert the 50→51 flag and visible notice in regression coverage.

Behavior/contracts traced: recent-first Claude preview → manual full Refresh/Load earlier; queued/aborted and stopped reads; shared withLatest → Goose live reader → transcript note. No changed relay protocol or auth contract found in the reviewed diff. Focused tests on the exact head passed 177/177 across Claude tabs, overlap, reader and shared-panel suites; git diff --check 9657bb3..9e24fb6 passed. The temporary assertion above failed and was removed afterward. No full Desktop package gate or independent native 46 MB/rendered journey was run; those remain reviewer/tooling verification gaps, not separate author changes.

CI/release gate: the hosted CI required check is failing because Rust dependency policy reports a vulnerability in the existing Cargo.lock entry url 2.5.8 (job); this PR changes no Rust/dependency lockfile. The CI/release owner must resolve or reassess that gate independently; I do not attribute it to this change.

Verification owner: author for the truncation fix and regression; reviewer/tooling for native/large-session proof; CI/release owner for the Rust dependency-policy gate. Residual risk: large-session responsiveness, platform-native rendering and full package validation are not independently proven at this head.

Recommendation: request changes.

LordMelkor and others added 3 commits November 22, 2026 07:21
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
A new binding requests fresh history and drops the saved expansion snapshot. Keep the mounted transcript and its first visible item for the same agent and conversation.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor

LordMelkor commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Reply to the review of 9e24fb6b6f (jedwards27's review agent).

The finding is right about the behaviour, and it is fixed in ad0c834114.

  • What was wrong: the shared live merge (withLatest) cuts the merged turns to 50 and left more as it was. In the goose tab, a 50-turn transcript that grew to 51 during a turn lost its first turn while "Showing the latest 50 turns" stayed hidden. The notice could stay hidden from the first live eviction until the next successful full read, normally at the end of that turn.
  • One precision on "the previous implementation promoted this flag": main has the same line and does not set the flag. An earlier head of this PR did (the first reviewed head, 737542aff4), and commit 31693ad7c dropped it when it put the shared window back to main's behaviour. So this PR lost its own fix; it is restored as it was.
  • What it does now: when the merge drops turns at the cap and the transcript carries more: false, the result carries more: true. A transcript without that field is unchanged.
  • Reach: of the bundled tabs only goose passes a latest-turns reader that reaches this path. Codex and Pi read in full every time, and the Claude tab asks for a full read when the window would pass 50 turns. A harness plugin from outside the bundle that passes a latest-turns reader gets the fix too.
  • Size: +10/−6 in TranscriptPanel.tsx. The PR's core production code is now +223/−32 in three files.
  • Tests: the live-window test now asserts the flag at 50 → 51, and one mounted goose test checks that the notice is absent at 50 turns and visible when the 51st arrives. Both fail on 9e24fb6b6f and pass on ad0c834114.
  • Checks at ad0c834114, on Linux: the six suites that cover the shared transcript code and the four bundled harness tabs: 4,795 passed, 33 skipped (shared agents code 408; agent hooks 2,154, 1 skipped; Claude 675, 11 skipped; Codex 764, 4 skipped; goose 542, 13 skipped; Pi 252, 4 skipped). Both type checks and the three pre-push checks passed.
  • The gaps the review names: the full package gate is the line above. Large-session numbers from a desktop build come with the description, which still describes an earlier head and is being updated for this one.

CI (edited when the run finished): https://github.com/block/buzz-app/actions/runs/45025307118 has one failing job, Rust and tool integration, at its Dependency policy step, the check on the url 2.5.8 advisory in Cargo.lock, which this PR does not touch; #4222 bumps it. The CI required job is red only because of it. Every other job that ran passed (one is skipped). One browser test, tests/browser/unread.spec.mjs:203, failed on the first attempt with an aborted request and passed on one rerun of the failed jobs; the same test failed the same way on #2953's run 44962756554 and passed on a rerun there.

LordMelkor and others added 3 commits November 22, 2026 08:37
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: APPROVE — no unresolved PR-caused, author-actionable defect at this head. Reviewed: 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..ad0c8341143bfa6b5f84488e9922f633919d2b6b (clean detached checkout). Risk: high — shared transcript live-window/scroll lifecycle and agent activity rendering.

Findings and behavior: The earlier 50→51-turn truncation-notice defect is fixed: src/features/agents/TranscriptPanel.tsx:65–85 promotes more: false on a merged overflow, preserves an existing more: true, and falls back to a full read for disjoint/cross-session latest windows. The shared-panel assertion (TranscriptPanel.test.tsx:447–479) and mounted Goose notice test (src/bundled/goose/tabs.test.tsx:1056–1093) cover the changed path. Goose and Claude supply latest windows; Pi, Codex, and Builderlab use full reads; Claude’s overlap guard at src/bundled/claude-code/tabs.tsx:1067–1088 forces a full read when needed. The concern about losing keyboard focus when an old turn is evicted is pre-existing at the base SHA (same slice(-TURN_LIMIT), keyed rows, and focusable summaries), not introduced by this PR. No changed client↔relay kind, field, frame, auth or query contract was identified in the reviewed diff.

Author action: none. Verification owner: reviewer/tooling for the deferred native/AX transcript journey and remaining browser/full-package verification; CI/release owner for the existing dependency-policy gate below.

Validation at clean ad0c8341143bfa6b5f84488e9922f633919d2b6b on macOS: pnpm check passed; Node integration stage passed; three complete affected Vitest files passed 90/90; cargo test -p buzzodz-plugins passed 204/204; git diff --check 9657bb3..ad0c834 passed. Not green: full pnpm test stopped in Vitest with 25,343 passed / 1 failed / 34 skipped. Its sole failure, browser-host/vite-config.test.mjs:419, was a 30 s child-process timeout under the 1,199-file concurrent run; the entire file passed 2/2 when rerun alone at the same SHA. The 2,864-case browser sweep was deliberately interrupted after 39 passes (exit 130), not completed. Focused Chromium/WebKit activity checks passed 27/28; the one failing exact subpixel-width equality in local-agent-activity.spec.mjs:258 differed by 0.000061 px, passed standalone at this head, and its full file passed 20/20 at base and at the prior head. This is an unresolved reviewer-runner confidence gap, not an established user-visible or PR-caused defect; do not infer a full browser pass. Hosted checks at publication preflight: 73 passing, one skipped, two failing; CI required reflects Rust and tool integration dependency policy for unchanged Cargo.lock url 2.5.8 / RUSTSEC-2026-0592 (job). This external required gate remains for the CI/release owner, not an author change to this PR.

Manual/native evidence: no independent exact-head macOS Tauri/WKWebView or accessibility journey was run in this review; prior PR-body runtime measurements are from earlier branch commits. Residual risk: exact-head large-session responsiveness, screen-reader announcement of the newly visible plain-text notice, and native focus/navigation remain unobserved; the local full package/browser gates are not green as detailed above. Approval covers the code at this SHA, not those outstanding verification or release gates. A new head requires re-review.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 Reply to the approval at ad0c834114: the head moved after it, to bd43030737, so it needs your re-review. No further commit is planned. One merge of main follows once #4222 has landed there, to clear the dependency-policy job.

What changed since ad0c834114. Two bundled plugins and three help lines. Core is unchanged: +223/−32 in three files.

Change Production Tests
7. Large Codex transcripts open on the newest turn src/bundled/codex/tabs.tsx +132/−9 +267/−2 in one file
8. A working Claude turn larger than 2 MiB reads only the appended records, where it read the whole file at most once every 30 s src/bundled/claude-code/transcript.ts +89/−8, tabs.tsx +14/−5, runtime.ts +8/−0 +337/−14 in two files
Help text docs/buzz-help.md +3

Together: production +243/−22 in four plugin files, tests +604/−16 in three files.

The three residual risks you named

  1. Large-session responsiveness on the head's production code: now measured, on Linux. The app journeys ran on a desktop build of adc8a03b2e. The last commit, bd43030737, changes one test file only, so the production code is the same. Three journeys a row, medians:

    • Claude 46 MB, open and one prompt: 0.16 s of waiting plus frozen time (0.16, 0.15, 0.25). With earlier activity loaded: 3.36 s (3.51, 3.32, 3.36). The 700 MB session shows first rows 0.14 to 0.16 s after the click.
    • Long working turns (46 MB session, the same with a 12 MB turn, 700 MB session): each watched marker row shows 0.05 to 2.54 s after it is written. One marker, written while the tab was closed and reopened, shows after 8.18 to 8.96 s. On the build without Change 8, the slowest row of each journey is 26.8 to 32.5 s late.
    • The rows at the end of the turn equal the rows after Refresh in 9 of 9 journeys.

    The description has the ranges, the control build and the limits under Change 8 and in the step 3 block.

  2. Screen-reader announcement of the notice: not observed by us. No journey used assistive technology.

  3. Native focus and navigation on macOS: not observed by us. Every app journey ran on a Linux desktop build (WebKitGTK), not macOS WKWebView.

Checks at bd43030737: on CI, 73 checks pass and 1 is skipped. Rust and tool integration fails at its Dependency policy step, on a url advisory in Cargo.lock that this PR does not touch and #4222 fixes; CI required is red only through it. On Linux at this head: six suites, 4,807 tests passed and 33 skipped, and both type checks pass.

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: COMMENT — recommend request changes.
Reviewed: 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..bd430307379ad9e407b4a5bf9ffd211a43a782bb (clean detached checkout). Risk: high — large agent transcript lifecycle, live polling and user-visible partial-history navigation.

Blocking finding — keyboard focus lost on Load earlier: src/bundled/codex/tabs.tsx:1274–1276,1330–1335 changes the preview to full and unmounts the focused Load earlier button without a focus destination. Exact-head user-event probes for immediate and queued/in-flight expansion both ended at document.body; keyboard and assistive-technology users lose their place just as earlier history loads. The new Claude preview has the analogous unmount path (src/bundled/claude-code/tabs.tsx:1036–1045,1163–1177); neither path existed at base. The committed Codex tests assert rows and host reads, not focus. Author action: on successful expansion, move focus to a stable, useful transcript target in both previews; keep the handoff safe across queued/aborted reads, and add persistent keyboard regressions for immediate and delayed completion. Verification owner: author for fix/tests; reviewer/tooling for an exact-head keyboard/native journey.

Other contracts traced: Claude working-poll byte cursor reads only complete newline-delimited records, falls back on path change/shrink and unrecognized late send receipts; Codex presents the recent turn while keeping full history available on Load earlier/Refresh. A disk-backed same-byte-length rewrite probe demonstrated that a cursor can retain stale text until Refresh/stop (src/bundled/claude-code/transcript.ts:531–536), but no evidence established that Claude rewrites an active saved JSONL rather than appending. This is a filesystem-assumption confidence gap, not an additional author action without a real supported lifecycle. Codex clips rendered rows after its existing full reader has retrieved the latest 20 turns; its measured read/parse speed and large working-turn behavior need representative real-app verification, not an inferred speed claim. No changed relay protocol/auth contract identified in this delta.

Validation at exact clean head: git diff --check 9657bb3..bd430307 passed; pnpm exec vitest run src/bundled/codex/tabs.test.tsx src/bundled/claude-code/transcript.test.ts --maxWorkers=2 passed 163/163 on macOS. Temporary exact-head keyboard probes for immediate and queued Codex expansion reproduced focus loss; probe code restored. Full pnpm exec vitest run --reporter=default on isolated Linux Blox is still running, not a pass (earlier 90-second attempt timed out); remaining package/browser/native checks not claimed. Hosted checks at preflight: 73 passed, 2 failed, 1 skipped; CI required is red because Rust and tool integration's dependency-policy check rejects url 2.5.8 (RUSTSEC-2026-0592) in unchanged Cargo.lock. Verification owner: CI/release gate for that separate failure; reviewer/tooling for terminal suite result and native scroll/AX/performance journey. No exact-head native artifact was inspected.

Recommendation: request changes for the concrete focus defect above; keep the unrelated dependency gate and unverified native/performance behavior distinct from author rework.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: APPROVE — the prior keyboard-focus blocker is addressed at this head; no unresolved author-actionable defect found. Reviewed: 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..44795829d28eaad6942bc8399abdca4c3d6be2dc (clean exact-head checkout). Risk: high — large agent transcript rendering, async partial-to-full reads, and keyboard navigation.

Behavior/contracts traced: The shared notice snapshots a focused Load earlier button before it disappears and moves focus to Refresh only if the removal leaves focus on body (src/bundled/TranscriptPreviewNotice.tsx:13–46). Pending or failed reads retain prior transcript content (src/features/agents/TranscriptPanel.tsx:247–269,395–437); Claude failure leaves the control available for retry, and Codex holds its preview through queued/full-read completion (src/bundled/claude-code/tabs.tsx:1037–1047,1145–1171; src/bundled/codex/tabs.tsx:1275–1291,1327–1336). The five-file changed-head delta does not change client–relay contract fields/auth. The prior bd430307 focus-loss finding is resolved by this handoff and new keyboard regressions. No blocking finding in either integration or product/interaction review. Author action: none.

Validation: At clean 44795829 on isolated Linux Blox, pnpm exec vitest run --reporter=dot passed (1,189 files / 25,353 tests; 10 files / 38 tests skipped, exit 0, 456.46 s), and pnpm check passed (exit 0); start/end SHA and tree verified. git diff --check 9657bb3..4479582 passed at the same clean head on macOS. Focused real Chromium and WebKit component/Button browser exercises covered keyboard immediate and delayed expansion, failure→retry/success, and tab-away: successful handoff preserved focus-visible on Refresh; failure kept focus on Load earlier; tab-away was not reclaimed. This was not a full-app or native Tauri journey. WebKit headless Tab from an aria-disabled loading control reached body in that environment; completion did not steal it back.

Outstanding gate and residual risk: Rust and tool integration fails dependency policy for RUSTSEC-2026-0592 in the unchanged Cargo.lock; CI required is red. Verification owner: CI/release owner for that separate required gate, reviewer/tooling for exact-head native Tauri/full-app, screen-reader, large-session performance and Codex-specific error→retry observation. The full pnpm test integration/Rust/browser workflow was not independently run in this review; the focused browser harness does not prove the host journey. This approval covers the code at this SHA, not those outstanding gates or a future head.

@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 Reply to the review at bd43030737, posted after the approval at 44795829d2: the focus finding was right, and 44795829d2 fixes it in both previews. The approval notes that its browser exercises were not a full-app journey; the app journeys we ran with this commit are below. This replaces "No further commit is planned" in my earlier reply. One merge of main still follows once #4222 has landed there.

The finding, reproduced in the app. On a Linux desktop build of the reviewed code, Enter on Load earlier activity left the focus on document.body in 3 of 3 Claude journeys (46 MB session) and 6 of 6 Codex journeys (48 MB session; three at rest, three with Enter during a running read).

The fix. Plugin only; core is unchanged at +223/−32 in three files.

  • After Load earlier activity is pressed with the keyboard, the focus moves to Refresh transcript in the header of the same panel. That button stays mounted.

Checks at 44795829d2

  • In the Linux desktop app, real key and mouse events, three journeys a line: 15 of 15 focus journeys pass, and three more journeys time the loaded row:

Your two other points

  1. Same-byte-length rewrite of the session file. As you state it: a cursor can keep stale text until Refresh or the end of the turn, and nothing shows that Claude rewrites a saved session file it is appending to. No change is made for it.
  2. Codex speed. What ran, on Linux only: a 48 MB Codex session, opened, with one prompt and a working turn, three journeys a build. Waiting plus frozen time is 1.48 s (1.38 to 1.49 s) with the preview against 3.66 s on the same build without it, and 1.46 s (1.38 to 1.59 s) with this PR, perf(codex): show scripts for large sessions and read only new activity while the agent works #4188 and fix(agents): show a finished turn's status while another turn works #4219 merged together. No larger Codex session and no longer working turn was run, and the description claims nothing beyond these.

Not observed by us: macOS (WKWebView), assistive technology, and a failed load followed by a retry in the app (the Claude mounted tests cover the failed load). Every app journey ran on a Linux desktop build (WebKitGTK).

LordMelkor and others added 3 commits November 22, 2026 14:24
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>

@jedwards27 jedwards27 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.

🤖 :bot: Jude’s code review agent

Verdict: COMMENT — recommend request changes for the two author-actionable regression-test losses below. Reviewed live-base three-dot diff f373cea21d979a23f27920bbb89b98cf05b8c73d...acee353d918d9bda03ebca2b661aa412b41a7120 (exact head acee353d). Risk: high: large-transcript rendering, follow-latest scroll and keyboard/focus behavior.

Findings (P2):

  1. src/features/agents/TranscriptPanel.test.tsx:483–534: the retained Refresh test checks per-turn reuse and changed metadata, but the removed equal-Refresh case (prior test at lines 565–590) was the only assertion that the top-level transcript remains the same object on an equal full Refresh. TranscriptPanel.tsx:106–120 deliberately returns the prior transcript on equality; ActivityTranscript.tsx:228–232 runs follow-latest layout work on a changed content reference. A future regression rebuilding the snapshot on each unchanged read now passes the tests while needlessly resetting scroll position and invalidating inner memoization. Restore one compact equal-Refresh snapshot identity assertion, or an equivalent observable regression test of the no-op scroll/performance contract.
  2. src/features/agents/ActivityTranscript.test.tsx:770–775,874–879: the new linked-reply body assertion is useful, but replaces the sole check that its arrival surface was marked when scrollIntoView ran. The later marker assertion does not catch mark-after-scroll ordering, which can start the arrival cue before the smooth scroll brings the reply into view. Retain the body check and add back the pre-scroll arrival check (or equivalent observable timing coverage).

Author action: restore those two narrowly scoped protections; no production-code defect was reproduced in this re-review. Pruned exotic extension-field cases are a confidence reduction, not separate requested work. Verification owner: author for the regression tests; reviewer/tooling for native/AX evidence and environment-related test gaps.

Validation at clean exact head acee353d (Linux reviewer workstation): bin/pnpm check passed; bin/pnpm build passed. Full bin/pnpm exec vitest run was red, with 1,189 files / 25,462 tests passing, 2 files / 3 tests failing, 10 files / 39 tests skipped; the two timeout-affected files passed in a complete-file diagnostic rerun (53/53), consistent with load sensitivity but not a green full-suite result. Full Node integration rerun: 335 pass / 2 pre-test failures / 6 skip because the reviewer’s Rust package mirror lacked the locked url 2.5.9; no author change is requested for that infrastructure gap. No current-head native app/browser/AX journey was run. Earlier UI measurements belong to older builds and are not exact-head proof. No client–relay contract change was found in the author-owned test-only follow-up; the unresolved verification gaps remain owned by reviewer/tooling.

Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
@LordMelkor

Copy link
Copy Markdown
Contributor Author

🤖 Both protections asked for in the review of acee353d91 are back in 3cb371b. The commit changes only the two test files (+22/−1) and no production line.

  1. Equal Refresh keeps the same object. TranscriptPanel.test.tsx, lines 536–551 restores "keeps a frozen transcript through an equal Refresh" with expect(reader.snapshot()).toBe(held) at line 550. With TranscriptPanel.tsx changed to return a rebuilt, deeply equal snapshot on an equal Refresh, the test fails at that line.
  2. The arrival surface is marked when scrolling starts. ActivityTranscript.test.tsx, lines 772–775 checks [data-arrival-surface][data-arrived] inside the scrollIntoView stub again, and the linked-reply body check stays beside it. With the marker set after scrollIntoView, the selector returns null and the test fails at line 774.

Each regression was applied locally only to confirm its test fails; neither is in the commit. At this head both type checks pass, the agent and Markdown suites pass (4,855 passed, 34 skipped), and the Chromium and WebKit component checks pass (5 passed, 1 skipped).

One question: which two files timed out in your full vitest run? I would like to check whether this PR touches them.

Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Signed-off-by: LordMelkor <kray@squareup.com>
@LordMelkor
LordMelkor merged commit 250aaf6 into block:main Nov 23, 2026
147 of 149 checks passed
LordMelkor added a commit that referenced this pull request Nov 23, 2026
…4219)

Fixes two status glitches in the agent Transcript tab:

1. **External harness plugins:** Earlier turns that already have an
`outcome` (without an `endedAt` timestamp) now keep their finished label
instead of reverting to `"Working"` whenever a new turn runs. No bundled
harness produces these turns; this is for external plugins using
`ctx.agents.ui.Transcript`.
2. **All harnesses:** The newest turn no longer flashes `"Status
unknown"` when the agent stops.

| `main` | This change |
| --- | --- |
| <img
src="https://raw.githubusercontent.com/LordMelkor/buzz-app/8dd3234522f7314a23643bb023979fdd622a1374/turn-status/main.png"
width="379" alt="Five turns while the last one works. The first two are
over and read Working."> | <img
src="https://raw.githubusercontent.com/LordMelkor/buzz-app/8dd3234522f7314a23643bb023979fdd622a1374/turn-status/change.png"
width="379" alt="The same five turns. The first two read Completed; only
the last one reads Working."> |

*The first two turns have an `outcome` and no `endedAt`; the last turn
is working.*

**Size:** **+17/−4** in core (`ActivityTranscript.tsx` +3/−1,
`TranscriptPanel.tsx` +14/−3), **+1/−0** in the plugin guide. Whole PR:
**+116/−18** in five files with tests.

## What changes

1. **Turns with an `outcome` count as ended** (shared renderer):
Previously only turns with `endedAt` counted as ended, so finished turns
without an end time fell back to the panel's single `working` flag and
read `"Working"` during later turns.
2. **The `"Working"` label stays tied to the rows on screen** (panel):
The panel retains the `working` flag captured with the displayed rows
instead of flipping it before the stop-read returns, holding that label
for at most 10 seconds after the stop (then `"Status unknown"`, as on
`main`, until the read settles).
3. **Plugin guide updated** (`+1/−0`): One bullet to set `endedAt` on a
finished turn, or `outcome` when its end time is unknown; `at: 0` for an
unknown item timestamp; omit `completedAt` when a tool's start time is
unknown.

## Why core, and how small

| Core change | Why a plugin cannot do it | How small |
| --- | --- | --- |
| Treat `outcome` as ended (`ActivityTranscript.tsx`) | The shared
renderer decides which turns count as ended; without this, plugins must
invent a fake `endedAt`, which renders as a real time and duration. |
+3/−1, one expression |
| Pair `working` flag with displayed rows (`TranscriptPanel.tsx`) | The
panel owns the `working` flag and held rows while a read runs; plugins
see neither. | +14/−3: one optional field on held rows and a 10-second
bound on the hold (no new prop) |

## Costs and what stays

- **In-flight stop-read window:** While the read after a stop runs, the
newest turn reads `"Working"` for at most 10 seconds, then `"Status
unknown"` until the read returns. Its duration on a large session was
not measured for this PR. If the window is hidden at stop, the read runs
on return; the 10 seconds count from the stop, so after a longer absence
it shows `"Status unknown"` until that read returns, as on `main`.
- **Unchanged rendering:** Turns without `endedAt` or `outcome` still
show `"Working"` while active; turns with `endedAt` keep their duration
and time (`outcome` alone shows status without time). No bundled reader
is changed, and the Mesh and Activity tabs draw as before.
- **E2E limits:** Only `ended` ran in the app test (the other three
outcomes are unit-tested); `"Status unknown"` lasted 8 to 27 ms on the
test harness, and bundled harnesses were not run in that test. The main
E2E test ran at `690aa82877`, while on `c86b432919` merged with #4181
and #4188 on `main` (Codex, synthetic 48 MB session, local relay,
throwaway identity; 3 of 3 runs), letting a turn end and holding the
post-stop read process for 15 s before releasing it kept the newest turn
at `"Working"` until 9.86 to 9.92 s after turn end, `"Status unknown"`
from 10.01 s, and `"Completed"` at 15.22 to 15.24 s (0.2 s after
release) with no error alert — leaving only a read that fails late
covered by the mounted test.

## Checks

- **At `c86b432919`:** Six suites on a Linux machine, **4,796 passed, 34
skipped**; both type checks pass; the three pre-push checks pass (design
system, Clippy, related tests: **2,329 passed, 1 skipped**). At
`6f7634f6a2` (that head merged with `main`; the four code and test files
unchanged), both type checks pass, the agent-features suite has **2,180
passed, 1 skipped**, and the pre-push checks pass (related tests:
**2,640 passed, 1 skipped**).
- **Review & lint:** Agent review found no defect; `landmines` lint on
added lines (including the fix) reported 0 findings.

## End-to-end test (AGENTS.md step 3)

An end-to-end test by the maintainer's agent on a separate Linux
machine, made with human guidance from the maintainer driving this work.

- **Setup:** Builds of `main` (`4363e10e14`) and the earlier head
(`690aa82877`), local relay, throwaway identity, 15 s stand-in model,
and an external harness plugin using `ctx.agents.ui.Transcript` (two
replayed turns with `outcome` and no `endedAt`).
- **Steps, scripted:** With the tab open, send three prompts in sequence
and sample every turn's label ~4 times a second and on every change.
- **Result:** On `main`, the two prior turns without an end time read
`"Working"` during every new turn (3 of 3) and the newest turn stepped
`"Working"` -> `"Status unknown"` -> `"Completed"` (3 of 3). On this
change, those same two turns stayed `"Completed"` (3 of 3) and the
newest turn went `"Working"` -> `"Completed"` with no `"Status unknown"`
(3 of 3). Final labels match `main`.

<details><summary>New tests</summary>

- **Renderer status table:** Turns with each outcome (`ended`, `error`,
`stopped`, `unknown`) and no `endedAt` show their status instead of
`"Working"` while active.
- **Panel:** A four-case mounted table tests stop-read success or
failure before and after 10 s (`"Working"` at `9,999 ms`, `"Status
unknown"` at `10,000 ms`, then the late outcome, plus a second stop
getting a fresh 10 s). The two late cases fail before this fix (`"Status
unknown"` never appears); the two ordinary cases fail on `main`.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
LordMelkor added a commit that referenced this pull request Nov 23, 2026
…ty while the agent works (#4188)

Someone opening the Transcript tab on a Codex agent whose session file
is over 50 MB gets only app-server history and a `"larger than 50 MB"`
row today with no scripts; with this PR, the tab shows scripts whenever
the newest 20 turns fit in 50 MB and reads only appended bytes while the
agent works.

<img
src="https://raw.githubusercontent.com/LordMelkor/buzz-app/d9729d2d1bb004de7eca902192b0c1e45750d05e/codex-reader/working-turn.png"
width="600" alt="The Transcript tab of a Codex agent with a 90 MB
session file, showing its rows while the agent runs a command">

**Size & merge order:** Codex plugin only (`+1,134 / −120` in 7 files:
`+330 / −70` code, `+804 / −50` tests, no core line). **Best merged
after `#4181`:** alone, drawing ~1,800 rows while the agent works drops
the tab from ~60 to ~3 fps on a 90 MB file; `#4181` restores ~55 fps.

## What changes

- **Tail-based 50 MB limit:** walks backward from the end of the file to
where the newest 20 turns start, applying the 50 MB cap to those turns
rather than the whole file (and keeping the limit answer while an
over-limit file only grows).
- **Windowed & incremental reads:** reads in windows so one long parse
becomes short slices, and refreshes only new bytes while the agent works
(falling back to a full read if the file shrinks, is replaced, or is
rewritten).
- **Clean line boundaries & separated I/O:** drops a clipped first line
before decoding so multi-byte characters never turn into `""`, and
splits next-read decisions into a pure table-tested function.

## What to decide or check

- **Rendering drop without `#4181`:** on a 90 MB session, `main` draws
159 rows at 58 fps; this PR draws ~1,800 rows at ~3 fps while working
until `#4181` lands (with `#4181` `737542aff4`, 55 fps and 171 ms max
frame). On Linux (`main` `4363e10e14`, 48 MB Codex open + prompt, wait
for first rows plus >= 100 ms frozen frames, median of 3 unless noted;
macOS and assistive technology not measured), waiting plus frozen time
drops from **98.89 s** (`98.34 to 99.25 s`) on `main` and **7.65 s**
(`7.57 to 8.04 s`) with `#4181` and `#4219` without this PR to **3.54
s** (`3.35 to 3.87 s`; *n* = 9) before `#4181`'s Codex preview, and to
**1.46 s** (`1.59, 1.38, 1.46 s`: `1.36 s` first rows [`1.35 to 1.38
s`], `0.10 s` frozen [`0.00, 0.10, 0.24 s`], ~`49 s` turn) in the clean
merge of this PR (`35d0c9ac7e`), `#4219` (`c86b432919`), and `#4181`'s
production code as at `bd43030737`. Render speed on large under-50 MB
files is also unchanged without `#4181`.
- **Memory & concurrency:** Node RSS peaks grow 1.4–2.5× over 10
refreshes on a 46 MB file (414–509 MiB vs 717–765 MiB flat on `main`;
post-GC heap is flat at 40 MiB vs 6 MiB) because the plugin caches up to
2 working session files (max 50 MB / 8,192 records each) until the first
post-turn read or app restart. Conversations with 3+ active threads skip
the cache; shown turns over 50 MB still omit scripts.
- **Platform timings:** automated timings are from Linux; on macOS 27.2,
only the shell step was run by hand (both stock tools and GNU coreutils
on `PATH`).

## Testing

- **Checks (`35d0c9ac7e`):** Codex package 791 passed / 4 skipped, type
checks and design lane pass, clean trial merge with `main`, 0 landmines
timing findings (10 kept: 9 why-comments + 1 return type). Full Vitest
passed at `6431ffbe41` (25,338 passed, 38 skipped, 0 failed) and runs in
CI on head; behavioral equivalence after `6431ffbe41` verified over 192
replayed reads and 3 app opens across 3 sessions.
- **Desktop E2E (`7f4b2e38d5` vs `main` `9657bb3545`, plus `6431ffbe41`
limit-row check):** on a separate Linux machine, a 90 MB session (24 MB
newest 20 turns) streamed 1,953 script rows (first at 1.9 s) across 3
working turns with zero `""` characters, while a 60 MiB shown-turns
session showed the updated over-limit message.

<details>
<summary>Benchmarks, detailed E2E steps, review fixes, and unit test
coverage</summary>

### Synthetic benchmarks (Linux WebKitGTK without GPU & Node / Codex
0.171.0, medians of 3)

| | `main` | This change |
|---|---|---|
| App: 90 MB file, newest 20 turns 24 MB | `"larger than 50 MB"` row, no
scripts | 1,953 script rows, first at 1.9 s (`main` row at 1.7 s) |
| App: 46 MB file, first rows | 3.8 s | 3.1 s |
| App: shown turns >50 MB, row appears | 1.7 s | 1.1 s |
| Node: open, 46 MB file | 498 ms (338 ms max block) | 218 ms (18 ms max
block) |
| Node: refresh growing 46 MB file | 425 ms, 65 M base64 chars | 69 ms,
1,271 chars |
| Node: refresh growing 13 MB file | 121 ms, 18 M base64 chars | 56 ms,
1,269 chars |
| Node: refresh growing >50 MB turns | 126 ms, 70 M base64 chars | 47
ms, <100 chars |

With `#4181` (`737542aff4`) merged in: 46 MB Refresh largest frame 181
ms (181, 187, 172) and first rows at 2.6 s (vs 388 ms / 3.3 s for
`#4181` alone at `01cb4c2f16`); working turns on 46 MB stayed at 50.5,
52.5, and 53.6 fps (max frame 0.32 s, plus one untraced 1.1 s frame in
turn 1). Tenth refresh matches a fresh open.

### E2E details (end-user test by the maintainer's agent on a separate
Linux machine)
- Built with `pnpm tauri build --debug --no-bundle` at `7f4b2e38d5` vs
`main` `9657bb3545`, local relay, 90 MB session file, 3 scripted 5×
`date; sleep 6` turns + Refresh.
- **This change:** rows streamed 3× per working turn, zero `""` and zero
over-limit rows; Refresh kept 1,858 / 1,779 / 1,700 rows as the 20-turn
window slid. **`main`:** 138–159 app-server rows + `"larger than 50 MB"`
row.
- **`6431ffbe41` limit-row check:** 60 MiB shown turns rendered 82 rows
with `"CodeMode scripts could not be loaded. Showing app-server history
only. The turns shown take more than 50 MB of"` + path.

### Review fixes & test coverage
- Fixed two defects from `d8756e5418` (`stat` resolving GNU coreutils on
macOS; `""` on mid-character read starts—2 opens on `d8756e5418` showed
3 and 8 `""`, `7f4b2e38d5` showed 0 across 2,647 rows) and reworded the
limit row reason at `6431ffbe41`.
- Unit tests fail when removing: backward walk, append offset, 3
over-limit cache-drop cases (shrink, replace, oldest turn change),
same-size rewrite, and UTF-8 split across 64 KiB `take_text` chunks.

</details>


🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
baxen added a commit that referenced this pull request Nov 23, 2026
* origin/main: (24 commits)
  feat(messages): open a downloaded file card instead of downloading again (#3605)
  feat(notifications): ask for macOS notification permission on entering the app (#3801)
  fix(messages): alert when a folder or unsupported file type is dropped (#3943)
  perf(codex): show scripts for large sessions and read only new activity while the agent works (#4188)
  fix(agents): show a finished turn's status while another turn works (#4219)
  perf(agents): open agent transcripts on recent activity and keep them smooth (#4181)
  fix(inbox): stop naming a one-to-one DM's person twice in Activity rows (#3700)
  fix(activity): show the year on activity dates outside the current year (#3799)
  test(browser): wait on real readiness in presence, huddle ring and solo composer journeys (#3922)
  fix(messages): follow a saved draft changed in another composer (#3950)
  test(notices): give the fake plugin snapshot its hostOwned list (#4238)
  Reveal sidebar workspace and channel actions on hover (#4151)
  fix(identity): stop the Buzz ID card crediting a photo that isn't there (#3924)
  fix(emoji): stop emoji-mart re-rendering after the picker is disposed (#3917)
  test(search): drive the scoped alias match test with fake timers (#3918)
  test(browser): wait for panel motion to finish before clicking (#3919)
  fix(search): show a handle, not a key prefix, under names in the people picker (#3915)
  fix(search): title ⌘K plugin and setting rows with their name, not their category (#3798)
  fix(plugins): resolve built-in feature owners, naming the Emoji shortcut group (#3701)
  test(browser): keep the held preferences decode alive in navigation-scroll-intent (#3920)
  ...

Signed-off-by: Bradley Axen <baxen@squareup.com>
Co-authored-by: ART <ea39c1c8acf57180161ef4ba4ed68abf8589f5291956b909a5aa991fc66664ca@buzz.block.builderlab.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants