Skip to content

bench(web-ui): transcript replay harness: acpmux logs at top speed, shift, per-token slope, long tasks, heap, idle - #34382

Merged
teamleaderleo merged 5 commits into
feat-cmux-nextfrom
perf/transcript-replay-harness
Nov 4, 2026
Merged

teamleaderleo merged 5 commits into
feat-cmux-nextfrom
perf/transcript-replay-harness

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Leo, 2026-11-03, asking for fast simulations in place of more compute: "play things back at, like, 30,000 times speed" (point 3 of manaflow-ai/cmuxterm-hq#6740).

What

A replay harness for the agent transcript, as one more bench of the shared web UI perf harness (webviews/bench/web-ui-suite.ts, the perf cron's advisory web-ui part, #31704). It adds no new harness, job, gate or runs-on.

  • bench/replayLogs.ts: acpmux session logs, one EventRecord per record as _acpmux/attach and _acpmux/event carry them. Each log is keyed by seq (1, 2, 3... per session, like acpmux's SessionEvent), and checkSeq refuses a log with a gap, a second session or time running back, so a recorded daemon log or a simulated agent's log lines up record for record. The logs:
    • every seeded ?mock chat (mockFixture.ts: the worked turn and each session's history);
    • the recorded chat the replay screen and gallery use (replay/replayFixture.ts);
    • a long, real-shaped session: 600 loadFixture.ts turns (reads, large edits, long shell logs), 4,196 records and 2,716 rows, with a streamed turn at six checkpoints. Each streamed turn has 80 reply tokens and a shell call whose output streams in over 30 updates;
    • --log FILE: any recorded log (JSON lines of SessionEvents, or {events: [...]}).
  • bench/transcript-replay.bench.ts: plays each log into the production pane (a vite build of the pane's entry, joined to a stand-in acpmux) as fast as the page can take it. A replay clock makes Date read the time of the newest record played, so elapsed labels read what they read live, and no step waits on wall time. Each log is played in two phases:
    • open: the whole log arrives on attach. Every row in view is sampled each painted frame, from first paint until the view rests. The first frame should be the final frame.
    • live: the session starts empty and the records arrive as live events, 25 per frame, with each measured burst played one record per frame.
  • Rows and budgets (one rule each, never today's number):
row budget
open.cls, live.cls 0.01
open.moved_px (a row in view at first paint that moved; a row that left counts the view height) 1 px
live.long_tasks during bursts 0
long.token_ms, long.tool_output_ms (main-thread task time per record) 10 ms (a frame's work)
long.*_slope_ms_per_krow (least-squares slope over the checkpoints, so O(rows) per token shows as a slope) 0.1 ms per 1000 rows
long.heap_mb (after GC, compared with the empty pane) 64 MB
long.idle_ms_per_s (after the replay settles) 1 ms/s
  • When a budget is broken, the bench prints a BUDGET MISS line naming the row, the value, the budget and the cause: the elements that shifted (summed by source), or the per-checkpoint costs behind a slope. With --strict it exits 1. The suite runs it without --strict, so in CI it warns through the cron's regression issue and never fails a check.
  • PROFILE=1 builds the pane unminified, profiles every burst, and prints the functions whose self time per record grew most between the first and the last checkpoint. These are where the O(rows) work is.
  • Suite: transcript-replay has a 150 s timeout (the run below took about 75 s). thread-rail-jump's timeout drops from 300 s to 150 s, so the timeouts still sum to 29.5 minutes, under perf-cron's 30-minute cap. That bench ran in well under that in perf cron: web UI perf harness on Linux (web-ui part, PERF_ROW lines) #31704's runs.

First numbers

Fleet Linux, 8 vCPU, headless Chromium, run 41743692374, via bun bench/web-ui-suite.ts --only transcript-replay: 90 s, exit 0, failed []:

row p50 p95 budget
transcript_replay.long.token_ms 6.58 ms 7.64 ms 10
transcript_replay.long.token_slope_ms_per_krow 0.702 0.702 0.1
transcript_replay.long.tool_output_ms 9.07 ms 11.13 ms 10
transcript_replay.long.tool_output_slope_ms_per_krow 0.639 0.639 0.1
transcript_replay.live.cls 0.0003 0.1455 0.01
transcript_replay.live.long_tasks 0 0 0
transcript_replay.open.cls 0 0.0001 0.01
transcript_replay.open.moved_px 0 0.3 px 1
transcript_replay.long.heap_mb 39.5 39.5 64
transcript_replay.long.idle_ms_per_s 0.75 0.75 1

Per-token cost at each checkpoint: 11 rows 5.70 ms, 545 rows 5.92, 1087 rows 6.58, 1629 rows 6.99, 2171 rows 7.64, 2709 rows 7.24.

Performance

This PR changes no product code. These are the bench's first values on this head, so there is no before.

metric before after delta harness or run link
per-token main-thread ms at 2,709 rows n/a 7.24 new row transcript-replay.bench.ts, run 41743692374
per-token growth, ms per 1000 rows n/a 0.70 new row same
tool output update, ms per 1000 rows n/a 0.64 new row same
live CLS, long log n/a 0.1455 new row same

Found

What the first runs found (filed as follow-ups, with the PRs from git log -S):

Verification

  • bun test bench/replayLogs.test.ts: 8 pass (seq keys of every log, a gap named, burst ranges, recorded log parsing, rows, slope, judging and the miss message).
  • bun run check on the fleet: no type or lint errors. Its one red, check:design-tokens on subagents/subagents.css, is a file this PR does not touch.
  • vp fmt --check bench/: clean.
  • bun bench/web-ui-suite.ts --only transcript-replay: the bench's rows were collected and the bench was not listed as failed (fast-checks runs 41741180064, 41742499741 and 41743692374).

Observed / Not run

  • Observed: the runs above.
  • Not run: the perf cron itself. Its first tick on feat-cmux-next after the merge runs the bench as part web-ui.

Changelog

none

Agent session: agent session

🤖 Generated with Claude Code


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


Summary by cubic

Adds a transcript replay benchmark to the web UI perf suite that plays recorded and generated acpmux session logs into the production transcript pane as fast as the page can take them, measuring layout shift, main-thread cost per streamed token and tool output update as the transcript grows, long tasks, heap, and idle CPU. A replay clock makes Date read the time of the newest record, so a session hours long replays in seconds. The suite adds a 150 s timeout for transcript-replay and drops thread-rail-jump's from 300 s to 150 s. No product code changes; this is the bench's first run on this head, so there are no before values.

First numbers

Fleet Linux: token cost 6.58 ms p50 growing 0.70 ms per 1000 rows, tool output update 9.07 ms growing 0.64 ms per 1000 rows, live CLS 0.0003 p50, heap +39.5 MB, idle 0.75 ms/s — budgets are 0.1 for slope, 10 ms per record, 0.01 CLS, 64 MB heap, 1 ms/s idle.

Found

  • Per streamed token and per tool output update the pane spends ~0.7 ms more per 1000 rows already in the transcript; at 2,700 rows a tool output update costs 11–14 ms, over the 10 ms frame budget. Profiles name withoutQuietThoughts, the inbox projection's prefix copy, rowPresence, and layoutScrollTop.
  • Rows already painted shift while a long chat streams (live CLS 0.02–0.26): the live turn's "Worked for" line, earlier code blocks, and the minimap rail.
  • Opening mock-home-screen intermittently shifts the dock and header tools by 0.0458.

Budgets

  • Each row has one budget; an overrun prints a BUDGET MISS line naming the row, value, budget, and cause, and --strict exits 1. The suite runs without --strict, so CI warns through the perf cron's regression issue.
  • Each log plays twice: open (the whole log arrives on attach) and live (records stream in). PROFILE=1 builds the pane unminified and diffs profiles across checkpoints; --log FILE replays any recorded daemon log (JSON lines or {events: [...]}).

Written for commit 8dedabb. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 4 commits November 3, 2026 15:41
… speed, shift, per-token slope, long tasks, heap, idle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-fb75b7af9902231028aa
…s summed, live only for streamed logs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-fb75b7af9902231028aa
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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

Review 559bd32: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr34382 -f ref=perf/transcript-replay-harness -f platform=macos -f backend_mode=local

Shipped in:

@github-actions github-actions Bot added risk:high Risk tier (docs/ci/risk-tiers.md) and removed risk:low Risk tier (docs/ci/risk-tiers.md) labels Nov 4, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Found 5 test failures on Blacksmith runners:

Failures

Test View Logs
main.DeveloperIdAppTests.test_download_prints_the_active_profile_only/
test_download_prints_the_active_profile_only
View Logs
stubs: /System/Library/Frameworks/Security.framework/Versions/A/Security has no stub/
Security has no stub
View Logs
stubs: CoreFoundation.tbd: install-name /System/Library/Frameworks/
CoreFoundation.framework/Versions/A/CoreFoundation, missing 1: ['_CFRetain']/
CoreFoundation, missing 1: ['_CFRetain']
View Logs
stubs: CoreFoundation.tbd: install-name /System/Library/Frameworks/
CoreFoundation.framework/Versions/A/CoreFoundation, missing 1: ['_log2']/
CoreFoundation, missing 1: ['_log2']
View Logs
test_the_type_check_covers_every_webviews_test_file (main.WorkflowShape.test_the_ty
pe_check_covers_every_webviews_test_file)/
test_the_type_check_covers_every_webviews_test_file (main.WorkflowShape.test_the_ty
pe_check_covers_every_webviews_test_file)
View Logs

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 559bd32

Reviewer: codex gpt-6.1-sol xhigh, fast tier.

Follow-ups: 2. Each lands as an issue in this repo that links this receipt; the lane that opened the PR fixes it forward.

SHIP at 559bd32

Visual verdict: no images; Leo tries the build

  1. [P2] [follow-up] replayLogs.ts:230: Valid JSONL with leading spaces on subsequent records fails because "\n{" is absent, so the parser attempts JSON.parse on the entire file. Reproduced with two records joined by "\n "; use whole-document parsing with a JSONL fallback and cover this case.
  2. [P2] [follow-up] transcript-replay.bench.ts:278: No after images were available; the replay’s rendered states need a visual check in the build.

Follow-ups:

  • [P2] [follow-up] Fix JSONL format detection and add whitespace coverage.
  • [P2] [follow-up] Visually verify the replay in the build.

@teamleaderleo teamleaderleo removed the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
@github-actions github-actions Bot added the risk:high Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
cmux-bot[bot]
cmux-bot Bot previously approved these changes Nov 4, 2026

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves 559bd32: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 4, 2026 01:12 Inactive
@cmux-bot
cmux-bot Bot dismissed their stale review November 4, 2026 01:15

A newer verdict blocks 8dedabb (no independent SHIP at the head).

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 4, 2026 01:32 Inactive
@teamleaderleo
teamleaderleo merged commit 04c95aa into feat-cmux-next Nov 4, 2026
148 of 155 checks passed
@teamleaderleo
teamleaderleo deleted the perf/transcript-replay-harness branch November 4, 2026 02:28
lawrencecchen pushed a commit that referenced this pull request Nov 4, 2026
…e red from #34382) (#34695)

* fix(webviews): move replayLogs.test.ts under test/ so the type check covers it

#34382 put the test in webviews/bench/, outside tsconfig's include, so
test_cmux_next_fast_gates.py's every-test-file-is-type-checked assertion
failed and turned cmux-next guards / tooling-tests red on feat-cmux-next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-d750cf10922c785efa64

* fix(webviews): point the moved replayLogs test's imports at ../bench/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-d750cf10922c785efa64

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 8dedabb1 Deployed Nov 4, 2026 by cmux-bot[bot] via wait for same-key tree publisher #108469
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant