Repository navigation
fix(agents): show a finished turn's status while another turn works - #4219
Conversation
Signed-off-by: LordMelkor <kray@squareup.com> Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
Keep Working visible while the stop read is pending. Publish the captured working state on success or failure so a failed stop read releases the label as well. 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
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Verdict: COMMENT — recommend request changes for one author-actionable status regression.
Reviewed: 4363e10e1488e2c75f4ed527f2c80211abfa9c02..690aa828778f14868ec49e0215dfbc484471f78a (exact head). Clean detached checkout on this Mac.
Risk: medium — user-visible agent lifecycle status; no relay wire, signing, persistence, or native IPC contract change.
Blocking finding (P2): bound the stop-read hold. src/features/agents/TranscriptPanel.tsx:210–220,383 only replaces the displayed working flag when the stop-read promise settles. If an external plugin's read(signal) or a backend read never settles after the agent stops, the old snapshot keeps an already-stopped turn labeled Working indefinitely. Refresh cannot recover: same-key requests just queue behind the unresolved read (:183–188). Before this change, a stop changed that label to the truthful neutral “Status unknown”; the new finite-read fix must not turn a stalled read into an unbounded false status. Keep the short hold to avoid a flash, then fall back to a neutral status after a bounded interval; test a deferred read beyond that interval and its late resolution/rejection without regressing the ordinary success/error path. This need not add a general reader retry or timeout policy.
Other behavior: The renderer's endedAt/terminal-outcome precedence and four outcome labels are consistent with the plugin contract (ActivityTranscript.tsx:349–355,384–397; docs/plugin-authoring-guide.md:385–397). Existing deterministic tests cover finite stop-read success/failure and terminal labels (TranscriptPanel.test.tsx:332–380; ActivityTranscript.test.tsx:420–459); they do not cover a read that stays pending. No other blocking finding in the source, test, and static screenshot review. No new keyboard control or icon semantics introduced.
Author action: bound the displayed Working hold and add the deferred-read regression above. Verification owner: author for the fix and regression; reviewer/tooling for independent exact-head app observation after the revision. The PR describes a Linux app comparison across three prompts, but that run was not independently reproduced here; static before/after images do not verify the hung-read case. The repository's separate human-try step is not established by this review and remains a maintainer/readiness gate, not this code finding.
Validation: at matching checkout HEAD 690aa828778f14868ec49e0215dfbc484471f78a, git diff --check 4363e10e1488e2c75f4ed527f2c80211abfa9c02...HEAD passed, and the working tree was clean. Hosted CI run 44996227419 reports completed/success for that exact SHA, including JavaScript/browser/flake jobs; Windows native validation was skipped. No local package suite or independent native/app journey was run on this Mac. Residual risk: the hanging-stop scenario needs regression coverage and a new-head review; green CI at this head does not exercise it.
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
|
🤖 Reply to the review of The finding is right: the hold had no bound, so a read after a stop that never returned left a stopped turn labelled Working. Fixed in
CI on |
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent — APPROVE at 4363e10e1488e2c75f4ed527f2c80211abfa9c02..c86b43291922088256a71cae68aa6e3c13165b39 (exact head c86b43291922088256a71cae68aa6e3c13165b39).
Risk: medium, user-visible transcript status and asynchronous stop-read lifecycle; no relay/client wire, native, persistence, or dependency change in the five-file PR diff.
Integrated findings: The prior unbounded false “Working” finding is fixed. TranscriptPanel.tsx:346–354,393 now holds the snapshot-matched label for at most 10 seconds after stop, then displays “Status unknown” while a read remains pending; a later result replaces it. The mounted TranscriptPanel.test.tsx:332–403 checks 9,999/10,000 ms, success/failure after expiry, and a fresh hold on restart. ActivityTranscript.tsx:349–355,384–425 gives terminal outcomes precedence and keeps status accessible as text. No remaining author-actionable code finding. A hung read can still queue Refresh, but that pre-existing reader lifecycle is not a regression of this display-only fix.
Author action: none for this PR’s changed behavior. Verification owner: repository dependency/CI owner must restore the required dependency-policy gate before merge; reviewer/tooling owns any independent exact-head app/native exercise. The repository’s human-try step needs explicit human confirmation, not an agent attestation.
Validation: At the exact head, hosted run 45020373977 passes JavaScript checks, eight Vitest shards, and browser journeys. CI required is RED: Rust/tool integration fails cargo-deny --locked check on unchanged Cargo.lock’s url 2.5.8, RUSTSEC-2026-0592; this PR changes no Rust or dependency-policy files. An earlier run at 690aa828 passed before the advisory surfaced, but it does not clear the current gate. Clean shallow local checkout at this head: git diff --check <base> HEAD passed; no local suite or native run claimed.
Manual/native evidence & residual risk: PR screenshots and a Linux app journey exercise the earlier 690aa828 head, not this 10-second bound; the bound has mounted-test evidence only. Independent exact-head native observation and human try remain outstanding. Approval is a code-review verdict, not a statement that required CI or release gates are green.
Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
… smooth (#4181) 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). Without #4188, Codex 48 MB takes **7.65 s**; #4219 fixes the status label. **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`). Full measurements, test details, and fine print are in pull request #4181. --------- Signed-off-by: LordMelkor <kray@squareup.com> Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz>
…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>
* 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>
Fixes two status glitches in the agent Transcript tab:
outcome(without anendedAttimestamp) 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 usingctx.agents.ui.Transcript."Status unknown"when the agent stops.mainThe first two turns have an
outcomeand noendedAt; 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
outcomecount as ended (shared renderer): Previously only turns withendedAtcounted as ended, so finished turns without an end time fell back to the panel's singleworkingflag and read"Working"during later turns."Working"label stays tied to the rows on screen (panel): The panel retains theworkingflag 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 onmain, until the read settles).+1/−0): One bullet to setendedAton a finished turn, oroutcomewhen its end time is unknown;at: 0for an unknown item timestamp; omitcompletedAtwhen a tool's start time is unknown.Why core, and how small
outcomeas ended (ActivityTranscript.tsx)endedAt, which renders as a real time and duration.workingflag with displayed rows (TranscriptPanel.tsx)workingflag and held rows while a read runs; plugins see neither.Costs and what stays
"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 onmain.endedAtoroutcomestill show"Working"while active; turns withendedAtkeep their duration and time (outcomealone shows status without time). No bundled reader is changed, and the Mesh and Activity tabs draw as before.endedran 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 at690aa82877, while onc86b432919merged with perf(agents): open agent transcripts on recent activity and keep them smooth #4181 and perf(codex): show scripts for large sessions and read only new activity while the agent works #4188 onmain(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
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). At6f7634f6a2(that head merged withmain; 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).landmineslint 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.
main(4363e10e14) and the earlier head (690aa82877), local relay, throwaway identity, 15 s stand-in model, and an external harness plugin usingctx.agents.ui.Transcript(two replayed turns withoutcomeand noendedAt).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 matchmain.New tests
ended,error,stopped,unknown) and noendedAtshow their status instead of"Working"while active."Working"at9,999 ms,"Status unknown"at10,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 onmain.🤖 Generated with Claude Code