Skip to content

perf(webviews): avoid redundant New Tab motion scans - #21320

Merged
teamleaderleo merged 5 commits into
feat-cmux-nextfrom
perf/react-hotspot-listmotion
Oct 18, 2026
Merged

teamleaderleo merged 5 commits into
feat-cmux-nextfrom
perf/react-hotspot-listmotion

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

Avoid redundant layout scans in the cmux-next New Tab list-motion hook. The hook now remeasures only when its row selector or key signature changes, while ResizeObserver continues to rebaseline geometry for resize-only changes. Cleanup restores the observer lifecycle under React StrictMode, cancels stale animations on transient DOM mismatches, and uses a collision-safe key signature.

Verification

  • bun build webviews/src/agent-session/acpmux/newtab/listMotion.ts --outfile /tmp/cmux-listMotion-check2.js --target browser --external react
  • git show --check 207dd96e89c3
  • Independent read-only review of call sites and StrictMode lifecycle

The full React Doctor script is already present in webviews/package.json, but this checkout has no installed webview dependencies, so bun run react-doctor:ci could not start (react-doctor: command not found).


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


Summary by cubic

Avoids redundant New Tab layout scans by running the list-motion effect and turn-marker pass only when their inputs change instead of on every render.

  • The list-motion hook remeasures only when the list, row selector, or row keys change; ResizeObserver still handles resize-only rebaselining.
  • Uses JSON.stringify for a collision-safe row key signature and restores ResizeObserver cleanup so StrictMode remounts stay in sync.
  • Cancels in-flight animations on transient DOM mismatches.
  • The turn-marker layout effect runs only when the rows, range, or last turn change; pointer-driven updates still call the callback directly.

Written for commit 2fdb8ad. Summary will update on new commits.

View guided diff Turn on auto-fix

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0a640449-a5c7-4833-b927-322b30117680

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

all web/size checks green

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Passes: CI passes on 2fdb8ad1bf.

CI passes on 2fdb8ad1bf (run 39111998066 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.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

CI fast guards passes on 2fdb8ad1bf (https://github.com/manaflow-ai/cmux/actions/runs/39111998066). This covers only the fast guards, not CI: CI's result is the ci-status check, and the CI failure attribution comment names any failing test.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-nfo41 created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

The cmux-next fast tier red is an infrastructure admission failure before checkout/tests, not a source failure. The exact-head attempt and its failed rerun both report:

glaeda-cmux-runner-hook: refused: node not eligible (rust toolchain 1.99.1-aarch64-apple-darwin is not installed)

The same hook failure appears on neighboring fast-tier runs for other heads (39016804359, 39016751220, and 39016663368), so this is a shared runner/toolchain outage. I am leaving the PR guarded and will not waive the red lane; it needs a healthy rerun or runner repair.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Gallery

Review in feed

38 states changed: agent-pane.transcript/long-code, agent-pane.chat-width/wide, agent-pane.transcript/archive-chat-key, agent-pane.chat-width/standard, agent-pane.new-tab/dictation-menu, ... · 3 play checks failed

Diff page and renders (the run's gallery-pr artifact)

State Before · after
agent-pane.transcript/long-code (Apple System Colors, webkit)
agent-pane.transcript/long-code (Apple System Colors, chromium)
agent-pane.chat-width/wide (Apple System Colors, chromium)
agent-pane.transcript/archive-chat-key (Apple System Colors Light, chromium)
agent-pane.chat-width/standard (Apple System Colors Light, chromium)
agent-pane.chat-width/wide (Apple System Colors Light, chromium)

32 more on the diff page.

Live preview (follows this branch; start it with scripts/gallery-live.sh up <branch> from an hq checkout):

  • agent-pane.transcript/long-code: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.transcript#/agent-pane.transcript/long-code
  • agent-pane.chat-width/wide: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.chat-width#/agent-pane.chat-width/wide
  • agent-pane.transcript/archive-chat-key: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.transcript#/agent-pane.transcript/archive-chat-key
  • agent-pane.chat-width/standard: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.chat-width#/agent-pane.chat-width/standard
  • agent-pane.new-tab/dictation-menu: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.new-tab#/agent-pane.new-tab/dictation-menu
  • agent-pane.new-tab/dictation-show: /wt/perf-react-hotspot-listmotion/?entry=agent-pane.new-tab#/agent-pane.new-tab/dictation-show
  • 13 more on the diff page

Play checks failed (0 px anchor movement, 0 layout shift, no frame over 33 ms unless the entry gives a reason):

  • agent-pane.new-tab/typed-dismissed (Apple System Colors Light, chromium): play: waitFor did not hold within 5000 ms
  • agent-pane.new-tab/typed-dismissed (Apple System Colors Light, webkit): play: waitFor did not hold within 5000 ms
  • agent-pane.new-tab/typed-dismissed (Apple System Colors Light, chromium): play: waitFor did not hold within 5000 ms
  • agent-pane.new-tab/typed-dismissed (Apple System Colors Light, webkit): play: waitFor did not hold within 5000 ms
  • agent-pane.new-tab/typed-dismissed (Apple System Colors, chromium): play: waitFor did not hold within 5000 ms
  • agent-pane.new-tab/typed-dismissed (Apple System Colors, webkit): play: waitFor did not hold within 5000 ms
  • 6 more on the diff page

97 nondeterministic states differed from a second render of the same head (a clock or fixture leak) and are not counted as changes.

753 unchanged · base b393e22 · head e60d5ca

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Fleet audit receipt: the exact-head web / react-apps-check (1) job ran React Doctor v0.2.14 remotely via bun run react-doctor:ci. It completed successfully with --fail-on none and reported 2,784 baseline findings: 366 architecture errors, 47 state/effects errors, 274 React Compiler errors, 16 correctness errors, and 1 accessibility error, plus warnings. React Compiler, typecheck, tests, and lint also completed in the fleet job. These diagnostics are observational; confirmed fixes are being split into focused PRs.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Reconciliation note: the current-base patch still removes the prototype stack stability fix/test from merged #21325. Please rebase and preserve the landed workspace-switch stability change; keep only the intended listMotion.ts performance delta before merging.

@blacksmith-sh

This comment has been minimized.

@teamleaderleo
teamleaderleo force-pushed the perf/react-hotspot-listmotion branch from e60d5ca to 2a4db79 Compare October 18, 2026 08:02
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Visual review: HQ feed · workflow run

- vp fmt webviews/src/agent-session/acpmux/newtab/listMotion.ts

Autofix-Run: https://github.com/manaflow-ai/cmux/actions/runs/39109931396
@cursor

cursor Bot commented Oct 18, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@cursor

cursor Bot commented Oct 18, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

- vp fmt webviews/src/agent-session/acpmux/newtab/listMotion.ts

Autofix-Run: https://github.com/manaflow-ai/cmux/actions/runs/39111552622
@teamleaderleo
teamleaderleo merged commit 9f2e416 into feat-cmux-next Oct 18, 2026
105 checks passed
@teamleaderleo
teamleaderleo deleted the perf/react-hotspot-listmotion branch October 18, 2026 09:45
teamleaderleo added a commit that referenced this pull request Oct 18, 2026
…il 10-21

From coord-2's re-review:
- Fetch the base's 9 days with blobs. Blobless, blame fetched blobs one by
  one and passed its 30 s timeout on busy files, so #21724's takeback of
  #21320 and #21536 went unflagged; with blobs it is flagged in seconds.
- A file the revert check couldn't read is listed in the report for a
  manual check, never skipped silently.
- Generated settings exports (*.sha256, settings-export/, the settings
  schema) don't count toward the 40-line runtime threshold.
- The evidence check is advisory (a warning, check passes) until
  2026-10-21T00:00Z, so pull requests already in flight can add evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
teamleaderleo added a commit that referenced this pull request Oct 19, 2026
…sk evidence check (#21718)

* ci(cmux-next): path-based risk tiers with an evidence check

Label each feat-cmux-next pull request risk:low, risk:medium or risk:high
from the paths it changes, and keep a 'risk evidence' check red until the
description has that tier's evidence: a screenshot for medium, plus a
reviewed SHA and an executed runtime test for high. The policy is in
docs/ci/risk-tiers.md and CLAUDE.md.

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

* ci(cmux-next): close the risk evidence bypasses review found

- Grade on every pull_request_target event with job-level concurrency, and
  move the unit tests to risk-tier-tests.yml, so no skipped 'risk evidence'
  run can become the newest check and read as a pass.
- Check out the classifier at github.workflow_sha.
- Grade merge gates, CODEOWNERS, publish/deploy workflows, schemas/, and the
  BrowserImport, BrowserAutomation and Cloud targets high; stop treating
  every .txt and src/ fixture as low.
- Proof needs media, not any URL; field values must be on the same line;
  a runtime SHA must be a commit on the pull request.
- risk:waived counts only when an admin or maintainer added it.

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

* ci(cmux-next): read risk:waived only when evidence is missing

A failed permission lookup no longer turns a check with full evidence red,
and reads as no waiver.

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

* ci(cmux-next): grade workflows high and keep file names out of workflow commands

From coord-2's review of #21691: every .github/workflows and .github/actions
file runs with secrets or a write token and decides what other pull requests
skip, so it is high tier. File names in the report have control characters
and backticks replaced, so a newline in a name can't start a :: command.

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

* ci(cmux-next): sharper risk designations

- Always high, at any size: release and signing, migrations, schemas/defaults,
  the protocol spec, pins, the merge gates and the workflows that route
  checks (cmux-next.yml, ci.yml, ci-guards.yml, ...).
- Runtime paths (daemon, acpmux, backend, Remote, Terminal, ...) are high
  only when the change is over 40 lines outside tests and generated files;
  a smaller one is medium, which a reviewer can read whole.
- Other workflows and actions are medium.
- New: a pull request that takes back another pull request's change from
  the last 7 days (deletes what it added, restores what it replaced) is
  high and names it. On #21194's squash this names exactly the five PRs it
  undid (#21199, #21234, #21369, #21384, #21446); moves and generated files
  don't count. The workflow fetches the base's last 9 days blobless for it.

On the 10-04..10-18 history by path: 225 low, 1207 medium, 617 high (30%),
down from 856 high (42%).

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

* ci(cmux-next): printable() also replaces C1 controls and line separators

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

* ci(cmux-next): a line moved to another file isn't taken back

#21242 moved #20398's mouseDownCanMoveWindow override from
SidebarContainerView into SidebarResizeHandle; the revert check read the
move as a revert.

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

* ci(cmux-next): full-blob base fetch, visible blame gaps, advisory until 10-21

From coord-2's re-review:
- Fetch the base's 9 days with blobs. Blobless, blame fetched blobs one by
  one and passed its 30 s timeout on busy files, so #21724's takeback of
  #21320 and #21536 went unflagged; with blobs it is flagged in seconds.
- A file the revert check couldn't read is listed in the report for a
  manual check, never skipped silently.
- Generated settings exports (*.sha256, settings-export/, the settings
  schema) don't count toward the 40-line runtime threshold.
- The evidence check is advisory (a warning, check passes) until
  2026-10-21T00:00Z, so pull requests already in flight can add evidence.

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

* test: register tests/test_risk_tier.py in the execution registry

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

* ci(cmux-next): base history in a fresh repo, a time budget, and the merge base

From review of fa3750e:
- actions/checkout turns a sparse checkout into a blobless partial clone,
  and a later fetch into it stays blobless, so blame still fetched blobs one
  at a time. Fetch the base's 9 days into a fresh repository instead (about
  60 s, not a partial clone; blame then takes about 2 s on #21724).
- The revert check stops after 120 s and lists what it didn't reach as
  'check by hand', so the job always ends inside its 5-minute timeout (a
  timed-out risk evidence check is red and can't be waived).
- Blame at the merge base the patches are relative to, not the base tip.
- Docs: re-run risk evidence on open PRs at the advisory cutover.

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

* ci(cmux-next): cap the base history fetch at 150 s

From review of 8a61191: an uncapped fetch could still run the job past its
5-minute timeout, and a timed-out risk evidence check is red. A slow fetch
now skips the revert check with a warning.

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

* test(risk tiers): cover the audit misgrades and advisory-era verdicts

The designation audit found paths graded too high (Rust *_tests.rs, spec
prose), too low (nested deploy and signing scripts, merge-gate helpers,
OptChat backend, pins), and that a risk evidence check that passed while
advisory stays green after the cutover. These tests fail until the fix.

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

* ci(risk tiers): apply the designation audit and refuse advisory-era verdicts

Agents audited the designations against 40 merged and 30 open PRs.
- Rust *_tests.rs, tests.rs and tests_v2/ grade as tests, and spec Markdown
  as docs. The cmux-tui/spec JSON stays a contract.
- Nested deploy, signing, nightly, promote and rollback scripts and workflows,
  scripts/ci/lib, the gh-merge-green helpers, merge-main.sh and the god-file
  check now grade high. The merge-gate rule moves first, so
  select_package_tests.py can never match the test rule.
- The OptChat agent backend counts as runtime (its inspector stays UI).
  ghostty.h, homebrew-cmux and .xcode-version count as pins.
- A Demo, Video or Recording heading holds proof.
- ENFORCE_FROM moves to 2026-10-24 00:00 UTC. After that, gh-merge-green
  reads ENFORCE_FROM from the base's risk-tier.yml and refuses a
  risk evidence verdict that finished before the cutover, or no verdict at all.
- The module docstring now matches the rules.

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

* test(risk tiers): judge a verdict by its start and refuse an unreadable cutover

Review nits on 83f662d: a job that started before the cutover can grade
as advisory and still finish after it, and a risk-tier.yml whose ENFORCE_FROM
no longer parses silently skipped the gate. Also test_*.py scripts and
fixtures should grade as tests. These fail until the fix.

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

* ci(risk tiers): judge a verdict by its job start; refuse an unreadable cutover

gh-merge-green now compares the risk evidence job start time with
ENFORCE_FROM, since the job decides advisory-or-not while it runs, and
refuses when risk-tier.yml is readable but has no ENFORCE_FROM in the
expected form instead of skipping the gate. test_*.py scripts and fixtures
under scripts/ grade as tests.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant