Skip to content

perf(agent-pane): skip 300 hidden row elements in folded running tray (SW-04) - #29250

Merged
teamleaderleo merged 6 commits into
feat-cmux-nextfrom
sw04-skip-collapsed-tray-rows
Nov 1, 2026
Merged

teamleaderleo merged 6 commits into
feat-cmux-nextfrom
sw04-skip-collapsed-tray-rows

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

SW-04: closed running tray stops building hundreds of invisible row elements

The default agent-pane SubagentTray starts folded when more than three agents/commands are running. Its render nevertheless unconditionally maps every live and completed item through line(item) into React <li> children before the return statement. The returned JSX already gates the fold body using useFold(...).present. At 300 active agents, a fully collapsed tray builds 300 AgentLine trees on every render (including its elapsed-time header tick), discarding those trees because the fold body is absent.

Change: construct cards only while fold.present is true. This exact existing hook stays true while a close animation is playing, so open/close animation and focus semantics are preserved. Once it has finished closing, no hidden row creation. Header count, oldest elapsed time, stop semantics, arrival identity tracking, View all and full open tray are unchanged. The shared AgentsPill.nestAgents helper also now appends to indexed sibling groups instead of cloning the prior array for every sibling, preserving order and the existing fallback for cyclic parent links.

Regression: webviews/test/subagent-tray.test.tsx covers 300 siblings and a historical parent cycle, plus adds 300 agents with observable name reads. Before opening, the collapsed tray must have zero AgentLine DOM rows and zero name reads during row construction; expanding must show all 300 and read their names. This tests the render cost that DOM-count-only coverage missed (the old implementation also had zero mounted rows but created 300 hidden element trees).

Source: feat-cmux-next@38550c7743b27f346ae45b75fbd72cbda80af737; branch sw04-skip-collapsed-tray-rows, head 01a768bbfdd335dc2cd30c3869aee865b8b1316b. Three files changed (tray, shared pill nesting helper, focused tray tests). No daemon, Chief or wire contracts changed. A separate active #27886 owns workflow progress and is not modified.

Validation: source-only from this chat; new webview test was committed but the repository bun suite has not been executed here. Gate on cd webviews && bun test test/subagent-tray.test.tsx, bun run check, and a narrow Mac live tray open/close capture if needed.

Performance

Metric Before After Delta Harness or run link
Hidden row name reads, first render of a folded 300-agent tray 1200 0 -1200 cmux-ci job ef23bb758f5d739c562c2785
Hidden row name reads per header rerender (folded, 300 agents) 600 0 -600 same job
Median folded rerender, ms (jsdom, 50 renders) 0.601 0.119 -80.2% same job

Harness: webviews/test/sw04-bench.test.tsx (uncommitted bench; before = feat-cmux-next's code, after = this PR's, same process), run on the fleet Linux pool via cmux-ci test, job ef23bb758f5d739c562c2785, source 4f1a46121bd7. No new timer, observer or animation loop; the fold keeps its existing cleanup.

Capture

No capture: the closed tray is visually the same header; open/close motion and results are unchanged. The user-visible difference is lower invisible work, to be validated under a signed NEXT build.

Related SW-04 results and other narrow PRs: HQ #5599.


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


Summary by cubic

Stops the folded SubagentTray from building hundreds of invisible row elements on every render. Previously the tray mapped every live and completed agent through line(item) into <li> children regardless of fold state, so 300 collapsed agents constructed 300 AgentLine trees per header tick and discarded them. Rows are now built only while fold.present is true, which stays true during close animation so open/close motion and focus behavior are preserved.

The shared AgentsPill.nestAgents helper now appends to indexed sibling groups instead of cloning the prior array for every sibling, preserving order and the fallback for cyclic parent links.

  • Adds regression tests for 300 agents: zero row name reads while collapsed (including a repeated collapsed render), 300 rows after expanding, and nesting order with a cyclic parent fallback.

Written for commit 87cc164. Summary will update on new commits.

View guided diff Turn on auto-fix

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 31, 2026
@blacksmith-sh

blacksmith-sh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Found 10 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp5w9sp62q/summary-missing.json (live):/summary-missing.json (live): View Logs
/tmp/tmpof9nsfjr/summary-fail.json (live):/summary-fail.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
convention violations found (ERROR lines above)./
convention violations found (ERROR lines above).
View Logs
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)/
test_every_listed_hook_is_one_glaeda_released_with_the_check (main.SigningHooksInSt
epWithGlaedaTests.test_every_listed_hook_is_one_glaeda_released_with_the_check)
View Logs
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)/
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)
View Logs
test_no_runner_picker_returns_a_hosted_mac (main.NoHostedMacInNightlies.test_no_run
ner_picker_returns_a_hosted_mac)/
test_no_runner_picker_returns_a_hosted_mac (main.NoHostedMacInNightlies.test_no_run
ner_picker_returns_a_hosted_mac)
View Logs

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

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

Review 87cc164: 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=pr29250 -f ref=sw04-skip-collapsed-tray-rows -f platform=macos -f backend_mode=local

Gallery before/after for 87cc164: 16 states rendered, 24 images differ, 392 more touched states not rendered. Images are in the run's artifact, not on this public PR; the independent review of this head reads them on its own, so the PR needs no hand-made screenshots of these states.

gh run download 41289635760 -R manaflow-ai/cmux -n gallery-advisory-29250-87cc164cbc694326a2110e77957b82101057f6d4 (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.subagent-row-anatomy/done-one Apple System Colors Light unchanged 0% own SubagentTray.tsx
agent-pane.subagent-row-anatomy/done-one Apple System Colors unchanged 0% own SubagentTray.tsx
agent-pane.subagent-row-anatomy/running-stats Apple System Colors Light changed 0.0432% own SubagentTray.tsx
agent-pane.subagent-row-anatomy/running-stats Apple System Colors changed 0.0116% own SubagentTray.tsx
agent-pane.subagent-row-anatomy/mixed Apple System Colors Light changed 0.0129% own SubagentTray.tsx
agent-pane.subagent-row-anatomy/mixed Apple System Colors changed 0.0122% own SubagentTray.tsx
agent-pane.subagent-tray/grid-31 Apple System Colors Light changed 0% own SubagentTray.tsx
agent-pane.subagent-tray/grid-31 Apple System Colors changed 0% own SubagentTray.tsx
agent-pane.subagent-tray/panel-two Apple System Colors Light changed 0.0211% own SubagentTray.tsx
agent-pane.subagent-tray/panel-two Apple System Colors changed 0.0169% own SubagentTray.tsx
agent-pane.subagent-tray/panel-one-running Apple System Colors Light changed 0.0124% own SubagentTray.tsx
agent-pane.subagent-tray/panel-one-running Apple System Colors changed 0.0086% own SubagentTray.tsx
agent-pane.subagent-tray/short-dock Apple System Colors Light unchanged 0% own SubagentTray.tsx
agent-pane.subagent-tray/short-dock Apple System Colors unchanged 0% own SubagentTray.tsx
agent-pane.subagent-tray/panel-118 Apple System Colors Light changed 0% own SubagentTray.tsx
agent-pane.subagent-tray/panel-118 Apple System Colors changed 0% own SubagentTray.tsx
agent-pane.subagent-tray/workflow-progress Apple System Colors Light changed 0.0132% own SubagentTray.tsx
agent-pane.subagent-tray/workflow-progress Apple System Colors changed 0.01% own SubagentTray.tsx
agent-pane.subagent-tray/one-running Apple System Colors Light changed 0.0114% own SubagentTray.tsx
agent-pane.subagent-tray/one-running Apple System Colors changed 0.0108% own SubagentTray.tsx
agent-pane.subagent-tray/duration-columns Apple System Colors Light changed 1.8% own SubagentTray.tsx
agent-pane.subagent-tray/duration-columns Apple System Colors changed 0.0319% own SubagentTray.tsx
agent-pane.subagent-tray-head/folded Apple System Colors Light changed 0.0404% own SubagentTray.tsx
agent-pane.subagent-tray-head/folded Apple System Colors changed 0.0353% own SubagentTray.tsx
agent-pane.subagent-tray-head/open Apple System Colors changed 0.0429% own SubagentTray.tsx
agent-pane.subagent-tray-head/open Apple System Colors Light changed 0.0425% own SubagentTray.tsx
agent-pane.subagents/agents-pill Apple System Colors Light changed 0.0459% own AgentsPill.tsx
agent-pane.subagents/agents-pill Apple System Colors unchanged 0% own AgentsPill.tsx
agent-pane.subagents/running Apple System Colors Light unchanged 0% own AgentsPill.tsx
agent-pane.subagents/running Apple System Colors unchanged 0% own AgentsPill.tsx
agent-pane.subagents/mixed Apple System Colors Light changed 0.0342% own AgentsPill.tsx
agent-pane.subagents/mixed Apple System Colors unchanged 0% own AgentsPill.tsx

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

Passes: CI passes on 87cc164cbc.

CI passes on 87cc164cbc (run 41269107539 attempt 1).

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: cmux-next checks (god files, concurrency, crash safety, l10n); base red: the same failure on the base 2809196; does not block

Shipped in:

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

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


Carrying all five authored commits in #29794 together with the tray alignment and folding fixes, preserving the hidden-row and sibling-index regression coverage.

Resolve the conflict in webviews/src/agent-session/acpmux/subagents/SubagentTray.tsx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (claude opus, correctness first): SHIP at 87cc164

Read the full diff against feat-cmux-next. cards was only ever rendered inside {fold.present && ...}, so building it only while fold.present changes no output: fold.present stays true through the close animation, and arriving() (refs and entrance bookkeeping) runs only for rows that mount, as before. nestAgents now pushes into the existing sibling array instead of copying it; order and the cycle fallback are unchanged, and both have tests. Webview shards (react-apps-base-check 1-8) are green at this head. The other reds are risk evidence (it waits for this review) and cmux-next checks, which fail the same way on base.
Follow-ups: none blocking. #29885 carries these same commits; identical hunks merge cleanly.

@teamleaderleo
teamleaderleo marked this pull request as ready for review November 1, 2026 09:37
@teamleaderleo
teamleaderleo merged commit 3d9c00e into feat-cmux-next Nov 1, 2026
229 of 246 checks passed
@teamleaderleo
teamleaderleo deleted the sw04-skip-collapsed-tray-rows branch November 1, 2026 09:37
teamleaderleo added a commit that referenced this pull request Nov 1, 2026
…ion Info

Base turned workflows on by default (#30192), so a running workflow leaves
the tray; stopped building rows in a folded tray (#29250); and renamed the
Session Info aside (#29921). The App tests turn workflows off as the
workflowLabs push would, open the tray for their chats, and read
aside.acpmux-session-info.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-63b9964940c20354b639
teamleaderleo added a commit that referenced this pull request Nov 1, 2026
#27886) (#29777)

* fix(agent-pane): show workflow progress in tray and inspector

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): refresh workflow progress rows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): refine workflow progress row layout

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): order agent row trailing columns

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): restore fixed agent status track

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): refresh only changed progress rows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): update only changed progress rows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): keep inspector rows memoized

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): subscribe each workflow row to live progress

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): update only changed workflow progress

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): scope progress updates to changed rows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): use row progress context

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): publish keyed progress from the event fold

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): key bridge progress by agent versions

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): preserve unversioned bridge progress updates

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): key bridge progress by versions

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): retain full snapshot compatibility without scanning direct events

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* Revert "fix(agent-pane): retain full snapshot compatibility without scanning direct events"

This reverts commit 420a013.

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): preserve bridge updates without versions

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): restore workflow progress after base merge

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): publish only changed progress values

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* test(agent-pane): model keyed bridge progress updates

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): reset bridge progress per session

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): keep compatibility progress snapshots live

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): preserve producer generations and narrow controls

Agent-Session: https://cmux.com/deeplink/agent?id=aid-f518dd20e1523aa0398c

* fix(agent-pane): retain versioned bridge progress and satisfy web checks

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* test(agent-pane): cover late root retirement in keyed UI lists

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* fix(agent-pane): retire phantom root progress with its worker identity

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* test(agent-pane): require inspector card to follow keyed progress

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* fix(agent-pane): keep inspector hover progress subscribed

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* fix(agent-pane): align tray header with status and duration columns

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* fix(agent-pane): wrap workflow counts within narrow rows

Agent-Session: https://cmux.com/deeplink/agent?id=aid-bb9506d641d2e48855d5

* fix(agent-pane): keep tray fill under stop hover

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8944087bebabdd95b89c

* fix(agent-pane): reconcile progress row props after base merge

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8944087bebabdd95b89c

* fix(agent-pane): subscribe tray rows to live progress

Agent-Session: https://cmux.com/deeplink/agent?id=aid-8944087bebabdd95b89c

* test(agent-pane): workflow progress tests follow base's tray and Session Info

Base turned workflows on by default (#30192), so a running workflow leaves
the tray; stopped building rows in a folded tray (#29250); and renamed the
Session Info aside (#29921). The App tests turn workflows off as the
workflowLabs push would, open the tray for their chats, and read
aside.acpmux-session-info.

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

---------

Co-authored-by: cmux-bot[bot] <348531757+cmux-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 87cc164c Deployed Nov 1, 2026 by teamleaderleo via wait for same-key tree publisher #93397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant