You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(renderer): pause animations nobody can see and move the last svg spinners to the compositor - #45773
Some loading animations kept running, and costing CPU and GPU, even when nobody could see them: rows just outside the visible part of a list, a browser page hidden behind another tab, and shimmering "stale review" labels that each ticked on their own schedule. A few pending-check spinners also redrew the whole window on every frame. Now the hidden ones pause until they come back into view, the shimmers tick together, and the remaining spinners turn like the other loaders do, which is much cheaper. Nothing looks different, except that those last spinners now turn in the same small steps as the other loaders, at the same speed.
Files
Added
Deleted
Net
Test
5
$\color{#1a7f37}{\Huge{\mathbf{+}}}$221
$\color{#cf222e}{\Huge{\mathbf{−}}}$37
$\color{#1a7f37}{\Huge{\mathbf{+}}}$184
Prod
20
$\color{#1a7f37}{\Huge{\mathbf{+}}}$222
$\color{#cf222e}{\Huge{\mathbf{−}}}$97
$\color{#1a7f37}{\Huge{\mathbf{+}}}$125
What Changed
Remaining svg spinners on the compositor: pending CI check rows and the checks summary icon (PR page Checks tab, Conversation side rail and the GitHub item dialog), plus the VM provisioning/waking badge, now rotate through SpinnerFrame (the stepped compositor loader from perf(renderer): keep the working loader on the compositor at the rings' step rate #45315) instead of animate-spin on the svg. They run 12 steps/s at 1 turn/s, stop when scrolled away and hold still under reduced motion.
Overscan rows: the sidebar worktree list and the native chat transcript mark rows outside the viewport (overscan included) with data-row-offscreen through one shared IntersectionObserver per document. CSS pauses only endless loops in them (animate-spin, animate-pulse, endless shimmer); finite animations such as a row's exit still finish. A ref re-attach in the same commit keeps its observation, so no observe/unobserve churn on re-renders, and hidden chat transcripts register no rows.
Inactive browser page: the page shell gets data-animation-offscreen while it is not the active page, so the agent glow (including its ::before, which the generic rule didn't reach) pauses; it resumes when the page is shown.
Stale-review shimmers: anchored to one document clock on animationstart (shared-animation-clock.ts, which replaces spinner-phase.ts), so all rows step on the same frames. Offscreen rows drop the shimmer and it re-anchors when they come back.
LoadingSpinner sizing:h-*/w-* classes now count as a caller size, not only size-*.
Spinner benchmark (tests/tools/benchmarks/spinner-rendering): horizontally clipped rings count as hidden; --scale-factor rejects empty or invalid values; traces fail on Chromium data loss and rates use the interval the trace actually covers; scroll and display checks assert each ring's state from geometry and check that a hidden ring stops before the grid is restored; the candidate ring must keep stepping without seeking; trace counts skip flow events and still count instant events; pnpm bench:spinners has a redraw gate again, adjusted for running animations.
Why
Chromium can't run a transform animation on an svg element on the compositor, so every animate-spin svg made the renderer produce a main-thread frame on every refresh. CSS animations also keep ticking when clipped by a scroller or hidden with opacity: 0, so overscan rows and inactive browser pages paid full frame cost for nothing. Pausing through attributes and CSS adds no timers or per-frame JS; the observer only fires when a row crosses the viewport edge, and it is bounded by mounted rows, not by worktree or chat count.
Linked Issue
Tracked in #45315 (follow-ups) and #45445 (deferred invisible-animation costs and the benchmark review threads).
Visual Proof
Main (231420904f0) vs this head (3b781e4a036), Windows, 1400×900 at 2× scale, animations frozen at the same time (both at 90°). Left is main, right is head.
PR page Checks tab: pending row and summary icon
Conversation side rail and GitHub item dialog Checks tab
VM state badge (provisioning, waking) and its tooltip on head
Motion, main (left) vs head (right): main spins smoothly; head turns in 12 steps per second at the same 1 turn per second.
prpage-checks-main-vs-head.mp4
The full set (every spinner in light and dark, tooltips and more clips) is in the review status comment.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Production builds of main and this head on Windows, side by side on the same machine with the same scripts, 1400×900, fresh profiles, real data: 60 worktrees, real pending CI on stablyai/orca PRs, real browser tabs driven by the orca CLI, and a real Claude chat.
Frozen-time pixel comparisons, main vs head: overscan rows, the browser glow and the stale shimmers are pixel-identical (0 differing pixels).
Reduced motion: check spinners hold still, pixel-identical to main.
Every spinner, light and dark: same size, position, colour and stroke. The only difference is the intended motion (smooth spin → 12 steps/s, same 1 turn/s); a few pairs differ only in edge anti-aliasing at the same angle.
Tooltips: the VM badge and the sidebar agent "Working" tooltips open on head as on main. Check rows and summary icons have no tooltip of their own on either build, and the nearby Refresh checks tooltip still opens.
Native chat: the prompt row above the viewport is marked and its pulse pauses; scrolled in, it runs. A hidden chat pane holds no observations, and showing it again re-marks rows.
Sidebar re-derivations (rename, mark unread, status, sort): rows stay mounted with 0 observe/unobserve calls, and marks persist.
offscreen-animation-pause.performance.test.ts pins one observation per row across a same-commit re-attach; it fails on revert.
pnpm bench:spinners --verify-only passes on Windows and Linux (720 pixel comparisons, offscreen pause, phases, reduced motion, scroll and display reveal). The full run's redraw gate needs a host where a hidden window draws frames. Windows and a Linux virtual display draw none, so there the gate reports that it can't measure rather than passing; frame rates above come from the real app instead. Its CPU samples on Linux: 200 rings scrolled away cost 2–4 ms/s renderer vs 20–42 ms/s for the old spinner.
Performance
This PR removes work. Windows, production builds, 30 s windows, main → head:
Scenario
Renderer ms/s
GPU ms/s
Redraws/s
Main frames/s
PR Checks tab, real pending CI
19.0 → 10.3
75.5 → 38.0
56.0 → 12.0
3.9 → 0
Conversation side rail, real pending CI
29.0 → 10.5
75.9 → 37.5
56.1 → 12.0
3.8 → 0
Spinners only in overscan sidebar rows (60 worktrees)
33.0 → 0.7
66.1 → 0.5
45.5 → 0
3.8 → 0
Agent-driven browser page inactive
16.5 → 5.0
30.9 → 0.7
0 → 0 (52.6 → 0 compositor frames/s)
1.6 → 0
30 stale-review shimmers visible
161.2 → 123.1
173.3 → 71.3
55.9 → 12.5
55.9 → 56.1
New work is event-driven and bounded by mounted rows (viewport plus overscan, about 40–50 in the sidebar and 20–30 per visible chat). There are no timers, polls or per-frame JS, and nothing grows with worktree, chat or agent count. Main frames for the shimmer stay at ~56/s because background-position can't run on the compositor; that predates this PR and is not worsened.
Risk
Level: Low
The riskiest part is the offscreen marker: if a row kept data-row-offscreen while visible, its spinner or pulse would look frozen. Releases remove the marker, observer entries for released rows are ignored, and only endless loops are paused, so finite animations always finish. Renderer-only CSS/DOM change with no saved data, settings, IPC or platform-specific code; it behaves the same locally, over SSH and on all platforms. Back out with a plain revert.
AI Disclosure
Review
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
Chromium can't composite a transform animation on an SVG element, so the
spinning Loader2 ran on the main thread and forced a full renderer frame
every refresh while an agent was working. Rotate an HTML wrapper instead.
A smooth composited spin still made the GPU present every refresh. Run the
loader at 24 steps/second on the rings' keyframes, anchored to the same
start, so its frames land with theirs; pause it offscreen like the rings.
Without a caller size class the wrapper span had no size and the inner svg
opted out of Button's [&_svg] sizing, so an xs button's spinner grew to 24px.
Pending checks spun their LoaderCircle svg, which Chromium runs on the main
thread, often for minutes while a workspace is open. Spin them in the same
stepped wrapper as the loading spinner.
…compositor
The PR checks tab, PR page check rows and the VM provisioning badge spun an svg on the main thread; they now use SpinnerFrame. LoadingSpinner also treats h-*/w-* classes as a caller size.
- Virtual sidebar and chat rows outside the viewport (overscan included) pause their spinners, pulses and shimmers; finite animations still finish.
- A browser page hidden at opacity 0 pauses its agent glow.
- Stale-review shimmers share one clock, so their steps land on the same frames, and offscreen rows drop the shimmer so reveal re-anchors it.
- census counts horizontally clipped rings as hidden
- --scale-factor rejects empty or invalid values
- traces fail on data loss and rate over the measured interval
- scroll and display checks assert each ring's state from geometry
- the candidate ring must step without seeking
- bench:spinners fails when rings draw on the main thread, faster than their step rate, or while scrolled away
…; count trace slices once
The checks summary icon beside pending rows still spun an svg, so the PR page kept redrawing every refresh. The benchmark's trace counts skipped Chromium's flow events, which tripled main-frame counts.
perf-scan: PASS at da079f27f5665e8ff448dbfd3297fa1e0f743f71 (base 2c9caf4a3b3, #45315 head). No P0/P1 left.
Fixed during the scan: sidebar row refs re-attach whenever the row list re-derives (status updates, about 1–2/s at fleet scale). Each re-attach would unobserve, re-observe and re-mark every mounted row (about 60). A same-commit re-attach now keeps its registration (df4111c5aeb). The perf contract offscreen-animation-pause.performance.test.ts holds it at 1 observe and 0 unobserves, and fails on revert (2 / 1).
One toggleAttribute per call (a no-op when unchanged); [data-animation-offscreen] * invalidates the overlay subtree
Per active-page switch
Shimmer clock anchor
animationstart (mount/reveal)
One getAnimations() on the target
Per mount/reveal, never per frame
SpinnerFrame on check rows, summary icons and VM badge
Mount
1 observe each (moved from the row element for the rows; +1 per summary icon)
Constant per view
Regression classes touched: hidden/unobserved owners keep working (this PR removes work: inactive browser glow 52 → 0 compositor ticks/s, overscan rows 22 → 2 redraws/s); new idle wakeups (none: no timer, poll or subscription added; spinners moved off the main thread); per-entity state outliving its owner (row registrations are deleted on release; the observer disconnects at 0 targets); fixed-cadence loops (none added).
Six questions: 1) the skip gate comes before work (CSS pause; no JS per frame); 2) one observer per document, re-attach deduped; 3) renderer main thread only, event-driven; 4) bounded by mounted rows; 5) host-independent DOM/CSS, measured on Windows; 6) release unobserves and removes the marker, and a late entry for a released target is ignored (da079f27f56).
Measured (Windows high spec, production build, 30 s windows): pending-checks views 55 → 12 redraws/s, 3.9 → 0 main frames/s, renderer 19.2 → 8.6–10.5 ms/s. 30 stale shimmers 55.5 → 12.5 redraws/s, GPU 190 → 72 ms/s. Main frames there stay at ~56/s because background-position can't run on the compositor; this predates the PR and is not worsened.
Verdict: clean, no P0 or P1 findings. The change adds no timers, polls, IPC or subprocesses. Every new IntersectionObserver target is limited to rows that are actually mounted, and none of it grows with the 750-worktree fleet. The idle compositor frames it removes are a real reduction. That reduction comes from reading the code; I didn't profile it.
Findings
None. The candidates I priced and dismissed are listed below.
Row ref attach, i.e. mount, and re-attach whenever measureVirtualRowElement changes identity. Identity changes when renderRows changes (use-virtualizer.ts:72-81), roughly 1–2/s at fleet hook rate.
Mounted virtual rows only: viewport (~15–30) plus overscan: 10 on each side (use-virtualizer.ts:161), about 35–50. It does not grow with 750 or 7,500 worktrees.
On re-attach: one map lookup, one count ±1, one queueMicrotask per mounted row. That's ~50–100 microtasks/s at the status rate, with zero observer unobserve/observe calls thanks to the same-commit dedupe (offscreen-animation-pause.ts:54-73). virtualizer.measureElement(null) per detach was already paid before, because React 19 called ref(null).
Source trace. The perf contract offscreen-animation-pause.performance.test.ts passes locally (1/1). It would fail without the microtask dedupe.
Row mount/unmount. measureRow deps are [virtualizer] (stable), so there is no re-attach churn. Visibility toggle: one pass over mounted rows.
Rows of visible transcripts only: viewport plus NATIVE_CHAT_WINDOW_OVERSCAN = 6 on each side, about 10–30 per visible pane. Hidden (display:none) transcripts register 0 targets, however many chats exist.
O(mounted rows) per tab switch. The rowObservations entry is deleted in the same cleanup, so it doesn't outlive its row.
An animation starts: mount, or reveal after animation:none offscreen.
At most 1 per mounted stale card (status slot), plus 2 spans in the hover reference row while it is open. Bounded by mounted rows (~50).
One event per animation start; no recurring JS. The style is already resolved when animationstart fires. React delegates the event at the root, so no native listeners are added. The props object is recreated each render, but ref is the stable module function, so it causes no re-attach.
applyBrowserPageViewportLayout calls from attach and URL sync
1 per browser page
toggleAttribute with an unchanged value doesn't mutate, so there is no style invalidation
Source
5
SpinnerFrame migration (pending checks rows and summaries, VM badge)
Render of a pending state
Pending check rows: same count as before (the observer moved from the <button> to the span). Summary icons: +1 target per open checks view, which previously had no observer. VM badge: same count.
The animation changes from an svg animate-spin that repaints on the main thread every frame to a compositor-stepped rotation at 12 steps/s (steps(1036800) over 86,400 s)
main.css:2225-2247, LoadingSpinner.tsx:11-27
6
attributeByTarget / rowRegistrations maps
Observe/stop
One entry per live target
Deleted in stop() or in the microtask once the count reaches 0, so the maps don't grow over time
offscreen-animation-pause.ts:9,37,66-71
Listener and observer census
Before
After
IntersectionObserver instances
1 shared, created lazily, disconnected at 0 targets
1 shared (unchanged)
IntersectionObserver targets
AgentWorkingSpinner + SpinnerFrame/LoadingSpinner instances + stale-review elements + pending check <button>s + VM Loader2
Same set, plus ~35–50 sidebar rows, plus ~10–30 rows per visible chat transcript, plus 1 per pending checks summary. Pending checks and VM keep the same count (moved to the SpinnerFrame span). Now usually ≥1 target while the sidebar is mounted, so the observer stays connected.
animationstart handlers (React-delegated, no native listeners)
SpinnerFrame and AgentWorkingSpinner
Same, plus stale-review status slot and reference row. Handlers on spinner and shimmer elements now read event.target.
Native listeners, timers, rAF
—
No change. The existing requestAnimationFrame in use-row-measurement.ts is untouched.
Idle wakeups per process
Process
Before
After
Electron main
0 from this surface
0
Daemon
0
0
Renderer main thread (JS timers/IPC)
0
0 (IntersectionObserver runs alongside frames the renderer is already producing; it schedules no timers)
Renderer main-thread frames
Each visible pending-check svg animate-spin caused ~60 repaints/s on the main thread, and overscan rows kept their animate-spin/animate-pulse/shimmer loops running. Each stale shimmer (30 steps per 2.4 s ≈ 12.5 Hz) ran on its own phase, so N rows could invalidate on N different frames.
Overscan rows are paused ([data-row-offscreen]). Stale shimmers are anchored to one clock, so they share ≈12.5 Hz. Svg spinners move to the compositor at 12 steps/s. An inactive browser page's cursor glow is paused.
Compositor
Ticked for all offscreen loops
Ticks only for loops that are on screen and shown
The before/after frame rates come from the CSS timing values, not from a trace. I didn't run bench:idle-cpu or the spinner benchmark.
Regression classes touched
Class
Disposition
New wakeups in steady idle
Matched and disproved: no timer, poll, subscription or IPC is added, and the wakeup count drops (see above).
Hidden or unobserved owners keep working
Matched; this is what the PR fixes. Hidden chat transcripts register 0 targets. The browser shell is marked while inactive. When the shell goes display:none, the attribute is left set, but nothing inside it runs.
Per-entity state outlives the entity
Matched and disproved: attributeByTarget, rowRegistrations and rowObservations are all deleted in the same teardown.
Per-row derivation over the whole collection per write
Matched and disproved: re-attach costs O(1) per mounted row, bounded by about 50, and no observer calls happen (contract test).
Fixed-cadence poll
No matching code: queueMicrotask fires once per detach and isn't self-rescheduling.
Every mounted instance loads what only the active one shows
Disproved: there is no IO, git or IPC; the work is DOM attributes only.
The six scan questions
Unused work before the skip gate: reviewed. The attributeByTarget gate drops entries that arrive after unobserve. toggleAttribute with an unchanged value is a no-op.
Ownership multiplication: reviewed. There is one shared observer. Target count is bounded by mounted virtual rows. The microtask dedupe keeps re-attach from multiplying observer calls.
Thread and storage: reviewed. All work is on the renderer main thread and light: map operations, plus getAnimations() once per animation start. Nothing is serialized or written to disk.
Growth and progress: reviewed. Nothing scales with worktree count, chat count or history.
Execution host: not applicable. This is renderer CSS and DOM only, and it behaves the same locally and on SSH hosts. Chromium compositor behaviour is the same on mac, linux and windows.
Obsolete work stops: reviewed. Cleanup runs on unmount and on visibility toggle, the observer disconnects at 0 targets, and finite animations still finish (:not(.shimmer-once), only infinite utility classes are paused).
Coverage and residual gaps
Ran:pnpm test offscreen-animation-pause.performance.test.ts passed (1/1). Everything else here comes from reading the code.
Unmeasured: Chromium's per-frame IntersectionObserver geometry cost for the ~50–100 added targets during terminal or chat streaming frames that change layout. Chromium caches rects, so I expect this to be microseconds per target, but I have no trace.
Unmeasured: the actual compositor frame reduction. The spinner-rendering benchmark wasn't run.
Pre-existing, outside this span: a .loading-spinner inside an inactive browser shell at opacity 0 still animates. Its selector needs the attribute on the spinner itself, and the observer treats opacity 0 as on-screen. The PR's new descendant rule only covers the cursor glow and stale shimmer.
Not runtime: the tests/tools/benchmarks/spinner-rendering/* tooling changes, which I looked at but didn't trace.
No P0 or P1 findings. This span removes renderer animation work and adds no new idle wakeups. All of this comes from reading the source: I didn't launch the app or run bench:idle-cpu or the spinner benchmark, so there are no measured timings.
Trigger: row mount and unmount, plus a ref re-attach on every commit where renderRows changes. renderRows changes → getExpectedVirtualRowKey → isCurrentVirtualRowElement → the ref callback gets a new identity. That plausibly happens 1–2 times/s under heavy status traffic.
Process: renderer main thread.
Work per re-attach: two Map lookups, a count change and one queueMicrotask per mounted row. The measureElement(null) / measureElement(el) pair already ran before this PR.
Bound: mounted rows = visible rows plus overscan: 10 on each side (use-virtualizer.ts:161), about 50. It does not grow with worktrees, so it is the same at 750 and at 7,500.
Price: about 2 commits/s × 50 rows ≈ 100 microtasks/s, all inside commits that already happen. That is tens of µs per second, with no IO observe/unobserve churn. offscreen-animation-pause.performance.test.ts pins this: re-attaching in the same commit gives observe=1, unobserve=0. I read that test but didn't run it.
Trigger: row mount and unmount. The ref callback depends only on [virtualizer], which is stable, so there is no per-commit re-attach. It also runs on the isVisible flip, which walks the mounted rows once.
Bound: mounted rows in visible transcripts only = viewport rows + 2 × NATIVE_CHAT_WINDOW_OVERSCAN (6) + pinned rows, about 20–40 per visible pane.
Hidden chats: transcripts hidden with display:none hold no observations. So the cost scales with visible panes, not with the tens of thousands of transcripts or the number of mounted chats.
Trigger: only when a target's intersection changes (scroll, or the initial entry after observe). Each entry costs one Map get and one toggleAttribute.
Style cost: each toggle invalidates styles under that row, via the [data-row-offscreen] .animate-spin/.animate-pulse/.shimmer selectors.
Bound: rows crossing the viewport edge per scroll frame, about 1–2.
Per-frame IntersectionObserver geometry
Chromium computes intersections during each lifecycle update that produces a frame. This adds about 50 sidebar rows plus about 20–40 rows per visible transcript as targets.
Estimate: about 90 targets × an estimated 1–5 µs per target (not measured) × 60 frames/s ≈ 0.5–3 ms/s.
This only applies to frames that are already being drawn, such as terminal output or typing. It adds no frames itself and stays the same at 10× fleet because it is bounded by the viewport.
It is below the P0 threshold (≥ 50 ms/s) and does not scale with the fleet, so it isn't a finding.
Trigger: an animation starts — on mount, or when an element comes back on screen after animation:none.
Work:getAnimations() plus one startTime write. This happens only on animation start, never on a recurring timer.
Bubbling: the shimmer handler on the reference-row container also receives events bubbling up from child spinners. Those exit early on the animation-name check.
One toggleAttribute per layout apply. A toggle to the same value causes no mutation.
The existing [data-animation-offscreen] * rule already paused descendants; the new ::before rule covers the agent glow pseudo-element.
SpinnerFrame migration (pending check rows and headers in both checks surfaces, VM badge)
Same IntersectionObserver target count for check rows and the VM badge; each target is now the span instead of the button or svg.
Pending summary icons are now observed too (+1 per open checks header or summary, about 2–4 at most). There is +1 animationstart handler per pending spinner.
The svg animate-spin moves to the compositor .loading-spinner (12 steps/s).
Listener and observer census (one shared IntersectionObserver per renderer)
about 20–40 per visible transcript; 0 for hidden ones
animationstart handlers
Before
After
SpinnerFrame/AgentWorkingSpinner
1 per spinner
unchanged; now also on pending checks, summary icons and VM spinners
Stale review (card status slot, reference row)
0
1 per stale owner (fires only when an animation starts)
Both registries are cleaned up in the same teardown: attributeByTarget.delete happens inside the stop path, rowRegistrations deletes in a microtask, and the observer disconnects when the count reaches 0.
Idle wakeups per process (source-derived, not measured)
Renderer main thread: new timers, polls, rAF loops or IPC: 0 before, 0 after. The microtasks only run inside existing commits.
Renderer frame rate: goes down.
Pending-check svg spins previously forced a main-thread frame every refresh (60/s while one is visible). Now they are compositor-only at 12 steps/s.
Visible stale shimmers (main-thread background-position, 12.5 Hz each) previously ran out of phase, up to min(60, 12.5 × K) frames/s for K visible stale rows. Now they share one clock at 12.5 frames/s.
Endless loops in overscan rows and the agent glow on an inactive browser page are now paused, where they previously drew every frame.
Electron main and daemon: untouched; 0 → 0.
Benchmark tooling (tests/tools/benchmarks/spinner-rendering/*): test harness only, with no effect on the app at runtime.
Regression classes touched
Class
Disposition
Hidden or unobserved owners keep working
This is what the PR fixes. Overscan rows, the opacity-0 browser shell and hidden transcripts now pause their animations. Leftover gap: only the cursor ::before gets the inactive-browser ::before treatment.
New wakeups in steady idle
Checked and not present: no timer, poll or rAF is added.
Per-row derivation over the whole collection per write
Matched (per-commit row ref re-attach). Disproved: the cost is bounded by about 50 mounted rows, does not grow with worktrees, and is pinned by the contract test.
Per-entity state outlives the entity
Matched (rowRegistrations, attributeByTarget). Disproved: both are deleted in the teardown path, and the microtask always runs.
Fixed-cadence poll or loop
No matching code.
Every mounted instance loads what only the active one shows
Matched (chat row observers). Disproved: observations are gated on isVisible.
The six questions
Unused work before the gate: reviewed. Hidden transcripts register no observers, and the IntersectionObserver callback checks attributeByTarget before any DOM write.
Ownership multiplication: reviewed. One shared observer; row re-attach is de-duplicated by the refcount plus microtask.
Thread: reviewed. All of it is on the renderer main thread, and it is constant and small (numbers above). Compositor animations stay on the compositor.
Growth: reviewed. Bounded by viewport plus overscan and by the number of visible panes, never by worktrees, chats or history.
Execution host: not applicable. Renderer CSS and DOM only, and remote and local hosts behave the same.
Teardown and idle: reviewed. Unobserve and attribute removal happen on cleanup, the observer disconnects at 0 targets, and no idle work is added.
Coverage and evidence gaps
What I examined: the diff and its production callers — sidebar virtualizer and row measurement, native chat transcript window, SpinnerFrame, main.css animation rules, text-shimmer.css, and the browser page viewport.
Not run:
The bounds above are proven from the source.
The per-target IntersectionObserver cost is an estimate.
I assumed, without confirming, that renderRows changes on every status update. Either way the cost is bounded by about 50 rows.
Still unmeasured: actual compositor and GPU frame rates. The spinner benchmark's new redraw gates in run.mjs would check this.
Perf scan: PR #45773 (2c9caf4a3b3..b9db690ee31): no blocking findings
Verdict: clean. I found no P0 or P1 regression. Every new piece of work is capped by how many rows are mounted, not by fleet size, and it runs only on events. The change adds no timer, poll, rAF or IPC. Idle JS wakeups stay at 0/s in every process. Compositor and renderer frames go down.
Evidence types: everything below comes from reading the source at HEAD. I did not run the app, bench:spinners or bench:idle-cpu, and node_modules is missing from this checkout. I also did not run the new offscreen-animation-pause.performance.test.ts; I only read its assertions. Any timing given is an estimate and is labelled as one.
Findings
None.
Pre-existing, not introduced here (no block)
Sidebar row ref re-attach (use-row-measurement.ts:74-92): measureVirtualRowElement depends on isCurrentVirtualRowElement, which in turn depends on renderRows. So every time renderRows is re-derived, React detaches and re-attaches the ref on every mounted row (about 40–50 at viewport plus overscan 10). Each detach calls virtualizer.measureElement(null), which sweeps the elements cache. That cost existed before this PR because the old ref also detached. The PR adds no IntersectionObserver churn on top: observeOffscreenRow refcounts the row and defers the stop to a microtask, so a release and re-attach in the same commit leaves exactly 1 observe and 0 unobserve. The new perf contract asserts this.
New work per change: trigger → population → bound at the reference fleet
Work
Trigger
Population at the reference fleet (750 worktrees, 100+ agents)
Bound and 10× check
observeOffscreenRow on sidebar virtual rows (use-row-measurement.ts:84)
row ref attach (mount, scroll into range, renderRows re-derive)
mounted rows only: about 20–30 in the viewport plus 2×10 overscan, so about 40–50
Fixed by viewport, not worktree count, so the same at 7,500 worktrees. On a renderRows re-derive (status updates at 1–2/s): about 50 × (Map get, count++, one queueMicrotask) and 0 IO calls. Est. tens of µs per commit, constant.
IO callback toggling data-row-offscreen
a row crosses the scroller clip
about 1–3 rows per scroll frame
Event-driven only, never at idle. Style is recalculated for that row's subtree only.
mounted rows of visible transcripts only (viewport + 2×6 overscan + pinned). display:none transcripts register 0 rows.
Fixed by viewport × visible chat panes. It does not grow with the 10k+ transcripts or history bytes. Entries leave the per-hook Map in the ref cleanup. The isVisible layout effect loops over mounted rows only, once per toggle.
toggleAttribute on the browser shell (browser-page-viewport.ts:311)
animationstart of tw-shimmer (mount, or reveal after animation:none)
stale-review rows that are mounted and on screen (≤ about 50 sidebar rows; 2 spans per reference row)
One getAnimations() plus a startTime write per start. It does not run on a steady tick. The row-level pause uses play-state: paused, which does not restart the animation, so it never re-fires animationstart.
SpinnerFrame at 5 checks sites and the VM badge
mount / reveal → animationstart → getAnimations() once
one per pending check row (could be 100–300 checks on a big PR) + 1–2 summary icons + VM badges in mounted sidebar rows
Runs once per mount, and style is already clean at animationstart. Re-renders from check polls keep their keys, so they don't remount. The summary icon remounts once each time pending ↔ settled flips. One-time cost, not a finding.
Module Maps attributeByTarget, rowRegistrations
observe / release
equal to the live IO targets
Both are deleted in the same teardown (observe cleanup, and the microtask stop), so neither outlives its element.
Listener and observer census
IntersectionObserver instances: 1 before (shared, created lazily, disconnected at count 0), 1 after. No new instance.
IO targets (all on the one shared observer):
Owner
Before
After
Agent working spinners, LoadingSpinner/SpinnerFrame
1 each, mounted
unchanged
VM provisioning/waking icon
1 (on the Loader2 svg)
1 (on the SpinnerFrame span)
Pending check rows (dialog + PR page)
1 per pending row (on the <button>)
1 per pending row (on the SpinnerFrame span). Same count.
Checks summary icons (4 sites)
0 (bare animate-spin svg, never paused)
+1 per mounted summary while pending
Stale-review containers
1 per stale row/slot
unchanged
Sidebar virtual rows
0
+about 40–50, the same at 10× fleet
Native chat rows
0
+(viewport + 12 overscan + pinned) per visible transcript; 0 for hidden ones
Net change: about +60–80 targets in a typical layout, capped by the viewport. The per-frame intersection computation over these targets runs only on frames that already render for some other reason. I did not measure it. At ≤ about 80 targets it can't grow with worktrees, terminals, agents or chats, so it is the same at 10× fleet.
animationstart handlers: none of these are native listeners. They are React synthetic props and go through React's single root animationstart listener, which already existed, so native listeners go 0 → 0.
Before: SpinnerFrame/AgentWorkingSpinner via handleSpinnerAnimationStart.
After: the same, plus two new React handlers for the stale-review shimmer (WorktreeCardReferenceRow, WorktreeCardStatusSlot) and 6 new SpinnerFrame sites (5 checks sites, 1 VM badge).
Handlers return early on a name mismatch, so events bubbling up from nested spinners cost one string compare.
0 → 0. No setInterval, setTimeout, rAF or IPC added. queueMicrotask runs only on a ref release, and IO callbacks run only when an intersection changes.
Goes down, from four sources:
endless animate-spin, animate-pulse and .shimmer loops in overscan rows (sidebar, chat) are paused
the agent glow on an inactive browser page at opacity 0 is paused
4 checks summary icons and pending rows move from main-thread svg animate-spin (a renderer frame every refresh) to compositor-only 12 steps/s, and pause when offscreen
N stale shimmers, each 12.5 main-thread paints/s at its own phase, now share one phase, so total paints drop to at most 12.5/s
Daemon / relay
0 → 0 (not touched)
n/a
Regression classes the diff touches
Class
Disposition
Fixed-cadence poll or loop that never settles
Matched endless CSS loops; disproved. The change removes loops; it adds no JS cadence.
New wakeups in steady idle
Disproved: no timer, poll, rAF or IPC added (table above).
Hidden or unobserved owners keep working
The change fixes this class: overscan rows, opacity-0 browser shell, display:none transcript rows not registered.
Per-entity state outlives the entity
Matched (attributeByTarget, rowRegistrations, chat rowObservations); disproved. Each is deleted in the same teardown as its IO unobserve.
Per-row derivation over the whole collection per write
Matched (per-row ref work on renderRows re-derive); disproved. It touches mounted rows (about 50, viewport-bound), not all worktrees, and does 0 IO operations per commit thanks to the refcount and microtask deferral.
Every mounted instance loads what only the active one shows
Matched chat hook; disproved. The isVisible gate means hidden transcripts register nothing.
The six questions
Unused work before the skip gate: reviewed. The animationstart handlers check the animation name before calling getAnimations(). A row that a hidden transcript would never animate is skipped before observe.
Ownership multiplies work: reviewed. There is still one IO for every owner, and per-row registration is refcounted. React delegates the onAnimationStart handlers, so there are no per-element native listeners.
Which thread pays: reviewed. IO callbacks and handlers run on the renderer main thread, on events only. Checks spinners move from main-thread svg frames to compositor-only, so cost moves off the main thread.
What grows: reviewed. Every population is capped by the viewport or overscan (sidebar 10, chat 6), or by the pending checks in an open PR view (one-time mount cost). Nothing grows with history, worktrees or process lifetime.
Execution host: not applicable. This is renderer-only CSS and DOM with no host or SSH paths. Platform note: the bench's own gate says hidden windows draw no frames on Windows, which affects the benchmark, not runtime.
Obsolete work stops: reviewed. Releases unobserve and remove the marker, the observer disconnects at count 0, and the chat visibility effect stops observations on hide. The overscan pause uses play-state, so finite exit animations still finish.
CI and tooling (kept separate from runtime)
The spinner benchmark files (run.mjs, trace-iterations.mjs, verify-rendering.mjs, app-variants.mjs) run only through the manual pnpm bench:spinners script and are not wired into CI. They add frame-rate gates, reject bad --scale-factor values, throw on trace data loss or an empty trace, and add the viz trace category. None of this affects app runtime.
Gaps not covered
I took no runtime measurements. The per-frame IO intersection cost for about 60–80 extra targets on frames rendered for other reasons is unmeasured. It is fixed by the viewport, so this is unmeasured magnitude, not unknown growth. The cheapest check is pnpm bench:spinners plus a scroll trace with the sidebar at 750 rows.
I did not check how often renderRows is re-derived under 100+ agents. Per-commit ref work is capped at about 50 rows whatever the rate.
I ran the perf-scan workflow on #45773 at 3b781e4, and it found nothing that blocks merge: no P0 or P1. The whole change runs in the renderer. Nothing new fires while the app sits idle. All new per-row work is limited to the rows the virtual lists actually mount, so it doesn't grow with worktree, chat or agent count.
I didn't run anything. This review workspace has no node_modules, and review workspaces don't install. Everything below comes from reading the code. Frame-rate claims that come from the PR's own comments or its benchmark are labelled as author-reported.
Findings
None.
New work: trigger, population and bound at the reference fleet
The reference fleet is 750+ worktrees, 100+ agents, 1–2 status updates/s. The growth target is 10× that.
Ref attach. The ref callback depends on renderRows through isCurrentVirtualRowElement (use-virtualizer.ts:65-82), so every mounted row's ref detaches and re-attaches whenever renderRows changes, about 1–2/s from status updates
Mounted rows only (M): visible rows plus 10 overscan on each side (use-virtualizer.ts:161), about 40
Each row looks itself up in a map, adjusts a counter and queues one microtask. The real observe/unobserve happens only on true mount or unmount, because the release is deferred to a microtask after the commit (offscreen-animation-pause.ts:60-76). That's about 40 microtasks per commit, ≪1 ms/s
M depends on sidebar height, not worktree count. Same at 750 and 7,500 worktrees
None of the handlers repeat: each fires once when an animation starts.
Idle wakeups per process, before → after
Process
Before
After
Why
Electron main
0/s
0/s
Not touched
Renderer, JS
0/s
0/s
No timers or animation-frame loops were added. The observer is event-driven, and the microtasks in #1 run only on commits
Daemon / relay
0/s
0/s
Not touched
Renderer and GPU frames
Overscan-row spin/pulse/shimmer loops, pending-check SVG spins and the inactive browser page's agent glow all kept drawing
Those now pause or move to the compositor's 12 steps/s
This is the PR's goal. The "SVG spin forces main-thread frames" premise is author-reported (code comment plus the new benchmark gate), not reproduced here
Regression classes the diff touches
Class
Disposition
Hidden or unobserved owners keep working
Disproved. This is what the PR fixes. Hidden transcripts (display: none) register nothing; collapsed or scrolled-away sidebar rows are reported as offscreen and pause
Per-row derivation over the whole collection per write
Disproved. Each re-attach does a map lookup for its own row only, with nothing over the whole list. Per-commit work is O(M), with M about 40 and fixed in fleet size
Fixed-cadence poll / new idle wakeups
Disproved. No setInterval, timeout chain or animation-frame loop added. The microtask in #1 runs only on React commits
Per-entity state outlives the entity
Disproved. The new registration maps delete their entry on release, and the native chat map deletes on ref cleanup. The PR's test checks that after release the observe and unobserve counts are 1 and 1 (read, not run)
Every mounted instance does what only the active one needs
Disproved. Native chat registers only while visible (isVisibleRef gate plus the effect)
Update published when nothing changed
Disproved.toggleAttribute with an unchanged value doesn't mutate the DOM, so no style invalidation
The six scan questions
Unused work before the skip gate: Reviewed. Observer entries for targets already released are dropped before any DOM write (offscreen-animation-pause.ts:17-20). The anchoring handlers skip other animations by name before calling getAnimations().
Ownership multiplying work: Reviewed. One shared observer. The row ref churn of Linux support #1 is absorbed by the deferred release, so a same-commit re-attach causes no real observe/unobserve. The PR's offscreen-animation-pause.performance.test.ts guards this (read, not run).
Which thread pays: Renderer main thread only. Observer and attribute work per scroll edge-crossing is O(changed entries). There is no SQLite, filesystem, IPC or subprocess work.
What grows: Nothing grows with worktrees, chats, history or agents. Every population is limited to what the virtual lists mount or what is on screen.
Execution host: Not applicable to the app; this is renderer CSS and DOM only. Windows only matters to the benchmark, which already flags hosts that draw no frames for hidden windows.
Obsolete work stops: Reviewed. Releases unobserve, clear the attribute and discard the observer at zero. Hiding a transcript removes its rows' observations, and leaving a page on opacity 0 pauses its glow.
Pre-existing (not caused by this PR, doesn't block)
Each time renderRows changes (status-driven, about 1–2/s), every mounted sidebar row re-runs measureElement(null) and measureElement(element). From memory of the list library's source, which I couldn't check here because nothing is installed, measureElement(null) loops over the mounted-element cache. That would make it about M² ≈ 1,600 cheap steps per commit. This was already happening before the PR (React called the ref with null on detach). It's limited by sidebar height, not by worktree count.
Gaps left open
I didn't measure frames, CPU or GPU, and I didn't run the PR's test or benchmark (no install here). The frame savings are the PR's claim. The work counts above are read from the code.
I didn't check the extra case where a shimmer starts inside an overscan row that is already paused. Re-anchoring it there could make Chromium stop honouring the CSS pause for that animation. The wrapper's own observer then sets animation: none, which removes the animation regardless, so I expect no lasting hidden work. I haven't confirmed it in a run.
Problem: pending CI check spinners and the VM badge spun an svg on the main thread at full frame rate, and spinners, pulses, shimmers and the browser agent glow kept animating where nobody could see them (rows just outside a list's viewport, an inactive browser page).
User-facing change: none visible, except that those last spinners now turn in 12 steps per second (like the other loaders) instead of a smooth spin, at the same 1 turn per second. Hidden loops pause and resume when shown.
Verified on the exact head (this PR merged onto main 231420904f0):
Blinded regression audit: SAFE, no findings. Perf-scan: clean, no findings (comment above). Remote typecheck, lint and changed-file unit tests: pass.
QA on Windows, production builds of main and head side by side, real data (60 worktrees, real pending CI, real browser tabs driven by the CLI, a real Claude chat):
Frozen-time pixel comparisons, main vs head: overscan rows, browser glow and stale shimmers 0 differing pixels. Reduced motion: 0 differing pixels.
Native chat: off-screen rows are marked and their loops pause; scrolled in, they run; a hidden chat pane holds no observations.
Sidebar rename/sort/status changes keep rows mounted with 0 observe/unobserve calls.
Spinner look and tooltips (merge condition): every spinner, in light and dark, has the same size, position, colour and stroke as main (frozen at the same 90° angle). A few pairs differ only in edge anti-aliasing at the same angle. The only change is the intended motion. Tooltips: the VM badge and the agent "Working" tooltips open on head as on main. Check rows and summary icons have no tooltip of their own on either build, and the Refresh checks tooltip next to them still opens.
Benchmark: head=3b781e4a0360b777e97e51be621364a26095c7d1 gate=PASS name=real-app-qa (Windows, production build; mounted listeners: sidebar and chat row offscreen observers, check-row and summary SpinnerFrames, browser shell marker, shimmer animationstart anchors; pass = pending checks ≤12 redraws/s and 0 main frames/s, hidden loops 0 redraws/s, frozen frames pixel-identical to main)
Benchmark: head=3b781e4a0360b777e97e51be621364a26095c7d1 gate=PASS name=bench-spinners-verify (pnpm bench:spinners --verify-only, Windows and Linux: 720 pixel comparisons, offscreen pause, phases, reduced motion, scroll/display reveal, hidden window)
Not measured: the full bench:spinners redraw gate needs a host where a hidden window draws frames. On Windows and on a Linux virtual display it draws none, so the gate reports that it can't measure (its own validity check), not a regression; no macOS host was available for this run. Its CPU samples did run on Linux: 200 rings scrolled away cost 2–4 ms/s renderer vs 20–42 ms/s for the old spinner. Frame rates above come from the real app instead.
Deferred: none. The 7 benchmark review threads on #45445 were fixed and answered there.
Spinners: main (left) vs head (right), light and dark
PR page Checks tab: pending row
(screenshot removed: contained real product data) (screenshot removed: contained real product data)
PR page Checks tab: summary icon
(screenshot removed: contained real product data) (screenshot removed: contained real product data)
Conversation side rail: pending row and summary icon
(screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data)
GitHub item dialog Checks tab: pending row and summary icon (rendered from the real components; this dialog needs a Projects scope the test machine's GitHub sign-in lacks)
(screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data)
VM state badge: provisioning and waking
(screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Agent working spinner (sidebar card, chat sub-row, tab label): unchanged look, already stepped on main
(screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Loading spinner (chat "Thinking" line)
(screenshot removed: contained real product data) (screenshot removed: contained real product data)
Motion: main (left) vs head (right)
PR page checks:
(screenshot removed: contained real product data)
side rail:
(screenshot removed: contained real product data)
sidebar agent:
(screenshot removed: contained real product data)
loading spinner:
(screenshot removed: contained real product data)
Tooltip hover on head
VM badge, provisioning:
(screenshot removed: contained real product data)
VM badge, waking:
(screenshot removed: contained real product data)
Sidebar agent spinner ("Working"):
(screenshot removed: contained real product data)
Chat sub-row agent spinner:
(screenshot removed: contained real product data)
Chat loading spinner:
(screenshot removed: contained real product data)
PR page pending check spinners (no tooltip, same as main):
(screenshot removed: contained real product data)
PR page pending check spinner 2:
(screenshot removed: contained real product data)
PR page Refresh checks:
(screenshot removed: contained real product data)
Side rail pending check spinners (no tooltip, same as main):
(screenshot removed: contained real product data)
Side rail pending check spinner 2:
(screenshot removed: contained real product data)
Side rail Refresh checks:
(screenshot removed: contained real product data)
Dialog pending spinner (no tooltip, same as main):
No actionable comments were generated in the recent review.
Walkthrough
The changes add shared offscreen observation for virtualized rows and update CSS to pause selected animations in offscreen regions. Spinner and pending-check indicators use shared animation timing, and stale-review indicators use a shared shimmer class and handler. The spinner-rendering benchmark now measures redraw and frame rates, validates scale-factor input, and checks visibility and animation state.
Merge Risk: Minimal · up to abb19
This change pauses invisible animations and moves the remaining SVG spinners to the compositor, which lowers renderer and GPU work. No outstanding defects remain from review, and the reported collapsed-clip benchmark issue was fixed.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the two main changes: pausing animations that are not visible and moving the last SVG spinners to the compositor. The changeset matches both parts, including offscreen pausing for rows…
Description check
The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, and Checklist sections, and the Performance section…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the two main changes: pausing animations that are not visible and moving the last SVG spinners to the compositor. The changeset matches both parts, including offscreen pausing for rows, browser pages, and shimmers, and the SpinnerFrame migration for check and VM spinners. The title follows the conventional perf(renderer) form and is a single sentence, though it is long at 96 characters.
Full details: Description check
Explanation
The description follows the repository template closely. It has the ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, Performance, Risk, and Checklist sections, and the Performance section gives a concrete measured table. Gaps: the Linked Issue section lists #45315 and #45445 as tracking issues but has no 'Fixes #' line, which the template asks for. The AI Disclosure section is empty. The Review section is empty. The Risk level is set to Low. The Testing checkboxes are all ticked, but the full bench:spinners redraw gate could not run on the available hosts, and macOS was not tested.
Resolution
Optional: add a 'Fixes #' issue reference if one applies, and fill in or mark N/A the empty AI Disclosure and Review sections. Also state explicitly that macOS was not tested, since the Notes section asks for cross-platform coverage.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
CodeRabbit (benchmark census): a clip region that collapsed to zero size still counted a straddling spinner as visible. Fixed in fe5bb770b54 and answered on the thread. A fresh Codex review of the fix found nothing (verdict SAFE). Benchmark tooling only; nothing that ships changed.
Codex native chat QA (head build 3b781e4a036, real Codex chat, GPT-6.1-Sol): the prompt row above the viewport is marked and its pulse pauses; scrolled into view, it runs (5/5 captures differ); a hidden chat pane holds no observations (2 unobserves at the switch, then none); shown again, rows are re-marked. The sidebar agent spinner shows and its "Working" tooltip opens.
CI is green on abb193667c0.
Everything else in the status above stands: blinded audit SAFE, perf-scan clean, Claude QA, every spinner the same as main in light and dark apart from the intended stepped motion, and the tooltips work. The full bench:spinners redraw gate is still not measured; see above.
(screenshot removed: contained real product data) (screenshot removed: contained real product data)
A fresh Claude review of the fix batch (fe5bb770b54 and abb193667c0) found nothing. The census fix is correct on both axes, the lockfile change is fully reverted, and nothing that ships changed. Together with the earlier fresh Codex review of the fix, both reviewers' latest passes are clean.
pnpm bench:spinners --verify-only passes on this head (Linux, virtual display, scale factor 1): 720 pixel comparisons, offscreen pause, phases, reduced motion, scroll and display reveal, hidden window.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Some loading animations kept running, and costing CPU and GPU, even when nobody could see them: rows just outside the visible part of a list, a browser page hidden behind another tab, and shimmering "stale review" labels that each ticked on their own schedule. A few pending-check spinners also redrew the whole window on every frame. Now the hidden ones pause until they come back into view, the shimmers tick together, and the remaining spinners turn like the other loaders do, which is much cheaper. Nothing looks different, except that those last spinners now turn in the same small steps as the other loaders, at the same speed.
What Changed
SpinnerFrame(the stepped compositor loader from perf(renderer): keep the working loader on the compositor at the rings' step rate #45315) instead ofanimate-spinon the svg. They run 12 steps/s at 1 turn/s, stop when scrolled away and hold still under reduced motion.data-row-offscreenthrough one shared IntersectionObserver per document. CSS pauses only endless loops in them (animate-spin,animate-pulse, endlessshimmer); finite animations such as a row's exit still finish. A ref re-attach in the same commit keeps its observation, so no observe/unobserve churn on re-renders, and hidden chat transcripts register no rows.data-animation-offscreenwhile it is not the active page, so the agent glow (including its::before, which the generic rule didn't reach) pauses; it resumes when the page is shown.animationstart(shared-animation-clock.ts, which replacesspinner-phase.ts), so all rows step on the same frames. Offscreen rows drop the shimmer and it re-anchors when they come back.LoadingSpinnersizing:h-*/w-*classes now count as a caller size, not onlysize-*.tests/tools/benchmarks/spinner-rendering): horizontally clipped rings count as hidden;--scale-factorrejects empty or invalid values; traces fail on Chromium data loss and rates use the interval the trace actually covers; scroll and display checks assert each ring's state from geometry and check that a hidden ring stops before the grid is restored; the candidate ring must keep stepping without seeking; trace counts skip flow events and still count instant events;pnpm bench:spinnershas a redraw gate again, adjusted for running animations.Why
Chromium can't run a transform animation on an svg element on the compositor, so every
animate-spinsvg made the renderer produce a main-thread frame on every refresh. CSS animations also keep ticking when clipped by a scroller or hidden withopacity: 0, so overscan rows and inactive browser pages paid full frame cost for nothing. Pausing through attributes and CSS adds no timers or per-frame JS; the observer only fires when a row crosses the viewport edge, and it is bounded by mounted rows, not by worktree or chat count.Linked Issue
Tracked in #45315 (follow-ups) and #45445 (deferred invisible-animation costs and the benchmark review threads).
Visual Proof
Main (
231420904f0) vs this head (3b781e4a036), Windows, 1400×900 at 2× scale, animations frozen at the same time (both at 90°). Left is main, right is head.PR page Checks tab: pending row and summary icon
Conversation side rail and GitHub item dialog Checks tab
VM state badge (provisioning, waking) and its tooltip on head
Motion, main (left) vs head (right): main spins smoothly; head turns in 12 steps per second at the same 1 turn per second.
prpage-checks-main-vs-head.mp4
The full set (every spinner in light and dark, tooltips and more clips) is in the review status comment.
Testing
Production builds of main and this head on Windows, side by side on the same machine with the same scripts, 1400×900, fresh profiles, real data: 60 worktrees, real pending CI on stablyai/orca PRs, real browser tabs driven by the
orcaCLI, and a real Claude chat.offscreen-animation-pause.performance.test.tspins one observation per row across a same-commit re-attach; it fails on revert.pnpm bench:spinners --verify-onlypasses on Windows and Linux (720 pixel comparisons, offscreen pause, phases, reduced motion, scroll and display reveal). The full run's redraw gate needs a host where a hidden window draws frames. Windows and a Linux virtual display draw none, so there the gate reports that it can't measure rather than passing; frame rates above come from the real app instead. Its CPU samples on Linux: 200 rings scrolled away cost 2–4 ms/s renderer vs 20–42 ms/s for the old spinner.Performance
This PR removes work. Windows, production builds, 30 s windows, main → head:
New work is event-driven and bounded by mounted rows (viewport plus overscan, about 40–50 in the sidebar and 20–30 per visible chat). There are no timers, polls or per-frame JS, and nothing grows with worktree, chat or agent count. Main frames for the shimmer stay at ~56/s because
background-positioncan't run on the compositor; that predates this PR and is not worsened.Risk
Level: Low
The riskiest part is the offscreen marker: if a row kept
data-row-offscreenwhile visible, its spinner or pulse would look frozen. Releases remove the marker, observer entries for released rows are ignored, and only endless loops are paused, so finite animations always finish. Renderer-only CSS/DOM change with no saved data, settings, IPC or platform-specific code; it behaves the same locally, over SSH and on all platforms. Back out with a plain revert.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)