Repository navigation
perf(codex): show scripts for large sessions and read only new activity while the agent works - #4188
Conversation
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>
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Verdict: COMMENT — recommend request changes. Reviewed 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..7f4b2e38d5ec8707d85e6541a311a67e4161eb09 (exact head). Risk: high — local Codex session-file reads and live transcript performance.
Author-actionable finding (P2): misleading fallback explanation. src/bundled/codex/transcript.ts:645–650 suppresses scripts when the displayed turn span exceeds the 50 MiB read budget. But :607 reports that the rollout file “is larger than 50 MB,” and :724 surfaces that text in the transcript. The file-size claim is true but no longer explains why scripts are absent: a much larger file can display scripts when its newest turns fit. A user cannot distinguish the two cases from the status row. Author action: describe the displayed/recent turns exceeding the script-read limit, preserve the app-server-history fallback, and update the exact boundary assertion in transcript.test.ts:936–959 to protect that explanation. Verification owner: author for wording/assertion; reviewer for the rendered fallback after the fix.
Contracts traced: codex.sh:271–309 aligns bounded tail reads before UTF-8 decoding and checks snapshot length; transcript.ts:501–664 handles partial lines, walks preceding turn starts, applies the shown-span budget, and invalidates cached reads on shrink, replacement, or same-size rewrite. No additional established correctness defect in these paths. The documented >8,192-record full-reread fallback and append-plus-prefix-rewrite limitation are bounded tradeoffs, not additional author actions under this PR’s stated contract.
Validation: clean exact-head source review; on an isolated Linux workstation at this head, pnpm install --frozen-lockfile, pnpm check, and full pnpm exec vitest run --maxWorkers=6 passed (1,188 files passed / 10 skipped; 25,338 tests passed / 38 skipped; 521.44 s). Hosted required CI is now green after the Chromium 8/11 shard’s rerun; the initial solo-rename.spec.mjs:848 failure was outside the changed Codex files, and its cause was not established. These checks do not prove native rendering or screen-reader behavior.
Merge sequencing / residual risk: The PR documents ~2 fps while a large transcript is open and the agent works without #4181, versus ~57 fps with #4181. #4181 remains open at review time. Verification owner: CI/release gate for merge order and the combined candidate; reviewer/tooling for independent native macOS large-session and keyboard/assistive-status evidence. No relay contract change in the six changed Codex files.
Recommendation: request changes for the inaccurate user-facing status and its test. Keep the #4181 sequencing and native proof as separately owned gates, not extra author code requirements.
Name the range that exceeds the read budget in the transcript warning. Larger session files can still show scripts when their displayed turns fit. Co-authored-by: Jello <c9085e5557728e0eb4eba927ae283fb1f27e65319dfa77e2ee2125e2cba7042d@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
|
🤖 Thanks, the finding is right: the limit is on the turns shown, and the row named the file. Fixed in Rendered in the Linux desktop app at that commit: a session whose shown turns span 60 MiB shows 82 rows of app-server history and that row (three opens); a 90 MB session whose shown turns span 24 MiB shows its 1,953 scripts and no row. The description has the details under the end-to-end test. The order after #4181 and the macOS check stand as you wrote them. |
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Verdict: APPROVE — code review only; #4181 sequencing remains a merge gate. Reviewed 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..6431ffbe41bde28469560961b748e641aa7e0e2c (exact head). Risk: high — bounded local Codex session-file reads, live transcript behavior, and large-session responsiveness.
Finding / author action: none. The prior P2 at 7f4b2e38 is resolved: src/bundled/codex/transcript.ts:607–608 now says the turns shown exceed the 50 MB budget, consistent with the shown-turn boundary at :643–651; src/bundled/codex/transcript.test.ts:936–959 asserts scripts at the boundary and the corrected fallback one byte beyond. Cached-warning invalidation is covered at :962–1005. The message enters the existing transcript status item (transcript.ts:721–725); src/features/agents/ActivityTranscript.tsx:711–719 presents its full text in a native disclosure, with collapsed truncation, expanded wrapping and keyboard focus treatment in ActivityTranscript.module.css:146–180. No relay wire contract changed in this six-file Codex PR. Previous source review traced tail/UTF-8 alignment and snapshot checks (codex.sh:271–309), incremental parsing, shown-span probing, and shrink/replacement/rewrite invalidation (transcript.ts:501–664); the new commit changes only status text and tests, not that reader. The documented >8,192-record reread fallback and append-plus-prefix-rewrite limit remain bounded limitations, not newly established defects.
Validation at this head: clean exact-head worktree/diff checks; bin/pnpm exec vitest run src/bundled/codex/transcript.test.ts --maxWorkers=2 passed 32/32; pnpm exec vitest run src/bundled/codex/transcript.test.ts src/features/agents/ActivityTranscript.test.tsx passed 55/55. Hosted CI run 44938811576 has head_sha=6431ffbe…, completed successfully; CI required passed, with Windows native validation skipped. The previously independent full-package pnpm check and pnpm exec vitest run --maxWorkers=6 (25,338 passed) ran at old head 7f4b2e38, not this head. The PR reports an author-run full suite at 6431ffbe41; I did not independently rerun it.
Manual/native evidence and residual risk: the PR describes a real-Codex Linux desktop exercise and three opens of the corrected over-budget row at this head; we did not independently reproduce the new wording in a native macOS session or with a screen reader. Source/DOM coverage does not establish those journeys. The PR also reports ~3 fps during live updates on a large session without #4181 versus ~56 fps with it. #4181 is still OPEN: do not merge this before its rendering fix; verify combined candidate performance after it lands.
Verification owner: CI/release/integration for #4181 merge order and combined performance; reviewer/tooling for independent macOS large-session fallback, keyboard/assistive presentation, and native behavior. These outstanding checks are not author-code defects and this approval does not waive the merge gate. Author action: none.
Plan the read range from the observed file and complete-record cursor. Resolve prefix probes, widening, and cache effects before the driver performs each operation. 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 — APPROVE
Reviewed: 9657bb35451c99d3cf1687f1af9ca76fa7f001f0..35d0c9ac7ee4c84aeff001f9184942170599a47d (clean exact-head checkout). Risk: high: local Codex rollout reading, cache/append lifecycle and large-transcript rendering. No new relay wire contract.
Behavior/contracts traced: The two commits since the prior approval extract the read planner into src/bundled/codex/transcript.ts:596–718 and add rollout-plan.test.ts. The bound rollout() path retains same-file append cursors, resets on shrink/replacement/same-size rewrite, prefers the first complete turn record before a trailing fragment, probes the displayed-turn prefix before accepting a cut, and enforces the 50-MiB shown-span limit and 8,192-record cache cap. The fallback remains accurately worded and accessible via the transcript’s native disclosure. No unresolved author-actionable defect found in the systems or product/UI passes.
Author action: none for this reviewed head. Verification owner: integration/release must hold merge until #4181 lands, then remeasure the combined candidate’s large-session rendering; #4181 is still open at ad0c8341143bfa6b5f84488e9922f633919d2b6b, whereas the reported combined ~55-fps evidence used its earlier head 737542aff4. Reviewer/tooling owns an independent macOS Tauri/WKWebView large-session pass (scripts when shown turns fit, fallback above 50 MiB, keyboard/assistive disclosure and frame latency). Those are verification/merge-order gaps, not author-code defects in this PR.
Validation at this head: clean-worktree git diff --check passed; on macOS the three focused reader/renderer test files passed 72 tests; on isolated Linux pnpm install --frozen-lockfile and pnpm check passed, and the Codex suite passed 21 files / 791 tests (one file / four tests skipped), HEAD rechecked unchanged. Hosted workflow 44989481749 completed successfully with head_sha=35d0c9ac…; 75 current checks succeeded and Windows native validation was skipped. An additional independent root-wide Vitest run is still in progress and is not claimed as a pass. The PR’s native Linux large-file run and performance numbers were produced at earlier snapshots, not independently reproduced for this exact head.
Residual risk: No exact-head macOS native/assistive or combined-#4181 performance artifact yet. Approval is a code-review verdict, not clearance for the separate sequencing and verification gates.
|
🤖 Follow-up to the exact-head approval: the independent root-wide Vitest run that was in progress has now passed at clean |
… 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>
…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>
* 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>
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.Size & merge order: Codex plugin only (
+1,134 / −120in 7 files:+330 / −70code,+804 / −50tests, 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;#4181restores ~55 fps.What changes
"", and splits next-read decisions into a pure table-tested function.What to decide or check
#4181: on a 90 MB session,maindraws 159 rows at 58 fps; this PR draws ~1,800 rows at ~3 fps while working until#4181lands (with#4181737542aff4, 55 fps and 171 ms max frame). On Linux (main4363e10e14, 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) onmainand 7.65 s (7.57 to 8.04 s) with#4181and#4219without 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 sfirst rows [1.35 to 1.38 s],0.10 sfrozen [0.00, 0.10, 0.24 s], ~49 sturn) in the clean merge of this PR (35d0c9ac7e),#4219(c86b432919), and#4181's production code as atbd43030737. Render speed on large under-50 MB files is also unchanged without#4181.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.PATH).Testing
35d0c9ac7e): Codex package 791 passed / 4 skipped, type checks and design lane pass, clean trial merge withmain, 0 landmines timing findings (10 kept: 9 why-comments + 1 return type). Full Vitest passed at6431ffbe41(25,338 passed, 38 skipped, 0 failed) and runs in CI on head; behavioral equivalence after6431ffbe41verified over 192 replayed reads and 3 app opens across 3 sessions.7f4b2e38d5vsmain9657bb3545, plus6431ffbe41limit-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.Benchmarks, detailed E2E steps, review fixes, and unit test coverage
Synthetic benchmarks (Linux WebKitGTK without GPU & Node / Codex 0.171.0, medians of 3)
main"larger than 50 MB"row, no scriptsmainrow at 1.7 s)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#4181alone at01cb4c2f16); 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)
pnpm tauri build --debug --no-bundleat7f4b2e38d5vsmain9657bb3545, local relay, 90 MB session file, 3 scripted 5×date; sleep 6turns + Refresh.""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.6431ffbe41limit-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
d8756e5418(statresolving GNU coreutils on macOS;""on mid-character read starts—2 opens ond8756e5418showed 3 and 8"",7f4b2e38d5showed 0 across 2,647 rows) and reworded the limit row reason at6431ffbe41.take_textchunks.🤖 Generated with Claude Code