Skip to content

Studio: stop Reduce motion turning on a transition for every element - #17466

Merged
danielhanchen merged 3 commits into
mainfrom
studio-reduce-motion-implicit-transitions
Nov 11, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-reduce-motion-implicit-transitions

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Reduce motion is on by default since #17377, and its blanket rule in index.css gives every element transition-duration: 0.01ms. transition-property defaults to all, so that one line turns on transitions for every property of every element, including the many no rule ever meant to animate.

Chromium makes this expensive. * { scrollbar-color } sets a scrollbar colour on every element, and Chromium starts a scrollbar-color transition on each of them whenever they are restyled, even when the value does not change (the from and to keyframes are identical). With any non-auto colour, a body-level restyle in a 40 turn Liquid Glass chat started about 2,000 of these transitions, and more as the chat grows. This is behind the Chromium long-chat gate cells that keep failing on recent PRs (area thread_scroll (liquid-3d) and area stream (liquid-3d) growing 2.5x to 2.8x from 40 to 200 turns, e.g. #17453 and #17460).

Change

  • Both Reduce motion blocks (html.force-reduced-motion, on by default, and the OS prefers-reduced-motion block) now give the * blanket transition-duration: 0s. A transition that lasts 0.01ms and one that does not run look the same, so nothing on screen changes and Reduce motion stays on.
  • A second rule in each block keeps 0.01ms for elements that still need their transitionend:
    • elements that declare a transition through a Tailwind class ([class*="transition"]), which covers the reasoning and sidebar collapsibles that unmount on transitionend;
    • the overlays native-view.ts follows by their transition events (CLICKABLE_SELECTOR: toasts, the find bar, native clickables and the rail), so the Desktop browser view keeps its hole in place while they appear.
  • The annotation layer's zoom only had a transition because of the blanket. Its comment now says what happens without one: the existing [zoom] effect redraws it.

Guard

New studio/frontend/tests/reduced-motion-implicit-transitions.test.ts:

  • fails if either Reduce motion * blanket sets a nonzero transition-duration, with its own cases for the checker;
  • requires the 0.01ms exemption in both blocks, and that it lists every part of native-view.ts's CLICKABLE_SELECTOR, so the two cannot drift apart.

reasoning-grid-collapse.test.ts now checks that the collapse is reached through the class exemption instead of counting the old blanket lines.

Against main's index.css the new test and the updated collapse test fail (3 failures); with this change all 20 tests in the four related files pass.

Measurements

Chromium (the long-chat gate's headless build and harness, this host), Liquid Glass 3D, main-thread CPU per area at 200 turns, three interleaved runs each:

Area main this PR
thread_scroll 1,166 / 679 / 628 ms 186 / 209 / 166 ms
stream 3,072 / 3,242 / 3,244 ms 1,450 / 1,241 / 1,175 ms
command_palette 1,370 / 1,058 / 1,172 ms 326 / 236 / 346 ms

Scrollbar-color transitions started by one body-level restyle at 40 turns: 2,550 on main, 0 with this change.

Long-chat gate: Settings ceiling

With the blanket transitions gone, the gate's 40 turn reading of opening Settings in the default appearance drops from about 6,100 elements restyled to about 2,400, while the 200 turn reading stays near 7,900. That made area settings (default) read 3.3x against the 2.0x element-growth limit.

The growth itself is on main already. Measured on fresh pages with the gate's harness, default appearance:

40 turns 200 turns growth
main 1,975 elements, 290 ms CPU 9,721 elements, 816 ms CPU 4.9x
this PR 1,663 elements, 217 ms CPU 7,760 elements, 461 ms CPU 4.7x

The gate only passed on main because the transitions inflated its 40 turn reading. KNOWN_DEFAULT in tests/studio/_area_matrix.py now records it as length:settings=5, so Settings keeps a ceiling instead of being skipped. This changes only the element and layout count check for that one area; its CPU and paint growth checks are unchanged. Finding what restyles the thread when Settings opens is a separate fix.

Not covered

The Firefox long-chat gate failure that also started with #17377 is a different cost: forcing every transition to 0s does not change the Firefox numbers, so this PR does not address it.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T04:52:45.098131Z ac1abaa Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: cb150ede4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: da8dfb07a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ac1abaa46b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit e4ef631 into main Nov 11, 2026
@danielhanchen
danielhanchen deleted the studio-reduce-motion-implicit-transitions branch November 11, 2026 05:30
danielhanchen added a commit that referenced this pull request Nov 11, 2026
)

## Summary

`Repo tests (CPU, rest)` can fail on any PR, depending on which tests
share an xdist worker (seen on #17466, which only touches the Studio
frontend):

```
tests/test_parallel_env.py:1210: in test_pre_init_query_reads_a_pending_peft_config
E   AssertionError: Regex pattern did not match.
E     Expected regex: 'cp x tp'
E     Actual message: "Unsloth: context parallelism (context_parallel_size = 2) does not compose with tensor parallel (UNSLOTH_TP_SIZE=2) yet: ..."
```

`unsloth.models.tp_env.env_layout()` reads the `UNSLOTH_TP_SIZE` /
`UNSLOTH_PARALLEL` layout once per process, by design.
`tests/test_parallel_env.py`'s `clean_env` fixture resets that cache on
teardown only. When an earlier test in the same worker, from another
file, read the layout with tensor parallel unset, `None` stays cached.
The test above then sets `UNSLOTH_TP_SIZE=2` and `UNSLOTH_CP_SIZE=2`,
`_composed_layout()` sees the stale `None`, and the trainer raises the
generic "does not compose" refusal instead of the layout's own `cp x tp`
one.

The refusal logic and the test's expectation are both right; only the
cache crosses tests. Reproduced on main by running any test that calls
`env_layout()` before this one (1 failed).

## Change

- `tests/conftest.py`: a new autouse fixture clears the tp_env layout
cache before every test. It only does so when `unsloth.models.tp_env` is
already imported, so it adds no unsloth import to tests that do not use
it.
- New `tests/test_tp_layout_isolation.py`: the first test leaves the
layout read, the second asserts it starts unread. Run in file order
without the fixture, the second test fails.

No library code changes.

## Testing

- `tests/test_tp_layout_isolation.py` with `tests/test_parallel_env.py`,
file order: 136 passed. With main's `tests/conftest.py`:
`test_the_next_test_starts_with_the_layout_unread` fails.
- A test that calls `env_layout()` followed by
`test_pre_init_query_reads_a_pending_peft_config`: fails on main, passes
here.
- With `-n 4` and random order: `test_tp_layout_isolation.py`,
`test_parallel_env.py`, `test_tp_env_gloo.py`, `test_pp_env_gloo.py`,
`test_parallel_capabilities_precision.py`: 198 passed, 1 skipped.
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