Skip to content

Fix Images and Video header controls clipping in narrow windows - #15798

Merged
danielhanchen merged 6 commits into
unslothai:mainfrom
Imagineer99:fix/media-header-overflow
Oct 30, 2026
Merged

danielhanchen merged 6 commits into
unslothai:mainfrom
Imagineer99:fix/media-header-overflow

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

The sibling Video/Images shortcuts added in #15520 could be cut off when the window narrowed. Since then, #15919 added MediaHeaderActions, which hides the API, Library and sibling links when they cannot fit beside Create / Train. One defect remained on main: the header column's minimum is a fixed 13rem, which ignores the UI scale and the native window-control inset, so at a raised UI scale the Create / Train pill itself is clipped at the window edge (Train cut off at 1100px / 140%, 1280px / 160% and 1600px / 200%, on both Images and Video).

This PR keeps main's link step-down and fixes the boundary it sits on:

  • --media-header-min-width (14rem * --ui-space-scale plus the header right inset, falling back to the window-control inset) replaces the fixed 13rem minimum for the Images and Video header column and the settings rail cap, so the pill always has room for its scaled size.
  • Below the 50rem split (rail stacked over the preview) that minimum is capped at half the header row, so the model selector keeps its room at high UI scale on a narrow page.
  • The rail resize handle computes the same cap in px, so drags and arrow keys start from the width that is actually shown. A present 0px header inset wins over the window-control fallback, matching the CSS var().
  • The Images / Video Train rail follows the same boundary, so it stays under the header divider in Train mode.
  • The Video rail fallback width is 408px, matching useMediaRailWidth.

Audio keeps its existing 13rem minimum.

Validation:

  • A Studio built from main and one built from this branch, measured over Images and Video, Create and Train, at 16 width / UI-scale combinations (480px to 1600px, 100% to 200%), in Chromium, WebKit and Firefox (identical counts in all three): header controls clipped by an overflow ancestor or the viewport went from 42 of 64 cells to 12, and every remaining cell shows at least as much of the control as main (all are stacked layouts at or below 640px with 150% to 200% scale); no overlapping controls on either side, including the model selector at 500px / 200%; links hidden by MediaHeaderActions unchanged (same cells as main).
  • Without the Train rail change, Train mode left the rail up to 224px off the header divider at high UI scale; with it, 0px in all 16 Train cells.
  • npm run typecheck passes; targeted header, rail-cap and UI-spacing tests pass (38/38); the frontend contract tests in tests/studio/test_desktop_reliability_frontend_contract.py now pin the scaled minimum for Images and Video (45/45).

Before (main) and after, 1280px wide at 160% UI scale:

Images header at 1280px and 160% UI scale: Train tab clipped on main, fully visible after

Video header at 1280px and 160% UI scale: Train tab clipped on main, fully visible after

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T14:59:17.525974Z 032f36d PR opened
ℹ️ 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.

danielhanchen added a commit that referenced this pull request Oct 28, 2026
## Summary

`studiobench-ui-parity` fails its `Merge base vs itself, the null`
control on unrelated PRs (#15798 and #15799, both runs around 15:00):
one of the four cells times out and the control refuses to print a
verdict over the remaining pairs.

```
cell FAILED: TimeoutError: ElementHandle.click: Timeout 8000ms exceeded.
  15 x waiting for element to be visible, enabled and stable
     - <div class="mt-4 flex shrink-0 flex-wrap items-center justify-end gap-x-1 gap-y-2">...</div>
       from <div data-testid="overlay-rail" ...> subtree intercepts pointer events
1 of 4 planned cells left no usable reading
```

The element in the way is the button row of the llama.cpp update card
(`components/llama-update-banner.tsx`), which floats in the bottom-right
`overlay-rail` over the composer. It appears when the backend sees a
newer llama.cpp prebuilt than the runner installed, so whether a cell
gets it depends on release timing, not on the build under test. Neither
side of a null control is wrong here; the run just has an out-of-band
card in it.

## Change

`studiobench/runtime/lifecycle.seed_init_script` now also writes
`unsloth_<channel>_notification_frequency = "off"` for every
notification channel (`llama`, `whisper`, `audio`, `unsloth`). With
every channel muted, `updateBannerAllowed` finds no audible component
and the card never renders; the update check itself still runs. Callers
can still override any key through `extra_local_storage`.

`runtime/selftest/test_studiobench_quiet_notifications.py` keeps this
honest against the frontend: the muted channels must equal
`NOTIFICATION_CHANNELS`, the key must match `frequencyKey` in
`use-notification-frequency.ts`, `"off"` must still be a
`NOTIFICATION_FREQUENCIES` value, and the seed script must write them.

## Testing

- `tests/studio/studiobench`: 1509 passed, 145 skipped (the new selftest
included).
- Sabotage, one at a time: dropping the mute from the seed payload,
dropping the `unsloth` channel, and renaming the frontend key to
`unsloth_${channel}_notify_frequency` each fail exactly one of the three
new tests.
- Not reproduced end to end here: forcing a pending llama.cpp update on
a local Studio needs a newer prebuilt than the one installed. The mute
path itself is the frontend's own (`updateBannerAllowed` requires an
audible, unmuted component), covered by
`notification-frequency*.test.ts` and `llama-job-lifecycle.test.ts`.
@danielhanchen

Copy link
Copy Markdown
Member

Repo tests (CPU, studio) on this PR fails four Studio contract tests that pass on main, all from the header changes here (reproduced locally at 032f36d41a):

tests/studio/test_desktop_reliability_frontend_contract.py::test_images_header_tracks_preview_and_preserves_titlebar_controls
    expects grid-cols-[minmax(0,var(--media-rail-width,408px))_minmax(13rem,1fr)]
    header now uses minmax(var(--media-header-min-width),1fr)
tests/studio/test_desktop_reliability_frontend_contract.py::test_image_page_structural_panes_share_the_container_breakpoint
    expects @[50rem]:w-[min(var(--media-rail-width,408px),calc(100%-13rem))] on the rail
tests/studio/test_desktop_reliability_frontend_contract.py::test_compact_media_link_keeps_accessible_name_and_truncation
    the compact media link's label span no longer carries `hidden` before its container breakpoint
tests/studio/test_ui_font_scale_contract.py::test_css_font_sizes_reference_the_scale
    index.css: font-size: calc(1rem * var(--ui-space-scale, 1));

The first three pin the old header / rail widths, so if the new --media-header-min-width layout is the intended one, those assertions need to move with it (the rail and header should still agree on one width so the panes keep sharing the 50rem breakpoint). The last one is a product slip: a font size scaled by --ui-space-scale ignores the UI font-size preference; it should multiply by var(--ui-font-scale, 1) (or be allowlisted in that test with a reason if it is really a spacing value).

The other four failures in that job (test_adapter_bounds_its_logits_buffer_by_chunk_size) are not from this PR; #15803 fixed them on main.

danielhanchen added a commit that referenced this pull request Oct 28, 2026
…rowth (#15822)

## Summary

`Frontend build + bundle sanity` fails on main (seen on #15806, #15799,
#15798, #15795; reproduces locally on `556b28bb40`):

```
eager startup JS: 5837.8 KB raw, 1806.0 KB transfer, 85 chunks
over the startup budget: transfer 1806.0 KB > 1795.7 KB, raw 5837.8 KB > 5819.8 KB
```

Building every frontend commit since the last budget base (`8222149ee`)
and measuring the eager set the same way
`scripts/check-bundle-budget.ts` does:

| commit | raw B | transfer B |
|---|---|---|
| `ed9857c0c3` (#15718) | 5,942,150 | 1,836,750 |
| `39b8a6ce13` (#15678, Trick or treat row) | 5,972,134 | 1,847,702 |
| `556b28bb40` (main) | 5,977,895 | 1,849,311 |

Every other step in the range moves by 0.0 to 0.5 KB. #15678 added
29,984 B raw / 10,952 B transfer in one step and merged without
re-measuring. #15485 then raised the budget by its own 1,953 B, but
measured against `8222149ee`, a base from before #15678, so main has
been over ever since.

## Change

`BUDGET` in `studio/frontend/scripts/check-bundle-budget.ts` is raised
by #15678's measured growth (+29,984 B raw, +10,952 B transfer), with
the measurement recorded next to the earlier raises. Main is then within
budget with 0.5 KB transfer / 11.3 KB raw to spare, so the next
unmeasured growth still fails here.

I tried the gate's first suggestion before raising it. Loading the Trick
or treat dialog on first open (`React.lazy` in `app-sidebar.tsx`) saves
only 10.4 KB raw / 3.0 KB transfer, and it raises the startup set from
85 to 90 chunks: the case the script warns about, where a dynamic import
splits shared modules into extra startup chunks. The rest of #15678's
weight is its Halloween color themes in
`features/settings/lib/color-themes.ts`, which the theme store reads at
startup to apply the saved theme. So that is not a laziness fix, and I
left it out.

## Testing

- `npm run build && npm run bundle:check`: over on main, `within budget
(0.5 KB transfer, 11.3 KB raw to spare)` with this change.
- `tests/bundle-budget-cli.test.ts`,
`tests/bundle-budget-closure.test.ts`: 43 passed.
- Measurements on Node 24.22.1, one machine and build, as the earlier
entries.
danielhanchen added a commit that referenced this pull request Oct 28, 2026
## Summary

UI jobs fail on unrelated PRs when a llama.cpp, whisper.cpp or audio.cpp
release is published mid-run. The prebuilt the job just installed
becomes one behind, and Studio shows its update card in the bottom-right
overlay rail, over the controls the scripts click:

- **Windows UI lane** (the `Chat UI Tests` staging run for #15796, on
current main `56278f5f65`): `FAIL in step "turn 3: 'Reply with exactly:
world'"`, `Locator.click` on `button[aria-label="Send message"]` times
out because the card's button row (`components/llama-update-banner.tsx`)
intercepts the click.
- **UI parity null control** (`Merge base vs itself, the null` on #15798
/ #15799): one cell times out the same way.

`UNSLOTH_DISABLE_UPDATE_CHECK=1` already keeps the card down: with it
set, `get_update_status` never reports an update
(`utils/update_status.update_checks_disabled`), and
`test_studiobench_ci_update_checks_off.py` already requires it, but only
for two named workflows (`studiobench-ci.yml`, `studio-ui-smoke.yml`).
The Windows and Mac UI smokes, the parity arms, inline images, composer
compatibility and the frontend browser jobs never set it.

#15805 muted the notifications in studiobench's browser seed; this
covers every browser lane at the backend, including the Playwright
scripts that seed nothing.

## Change

- `UNSLOTH_DISABLE_UPDATE_CHECK: '1'` at job level in every job that
installs Playwright's browsers or runs studiobench:
`studio-windows-ui-smoke` / `studio-mac-ui-smoke` `ui-smoke`,
`studio-ui-smoke` `ui-indicator`, `studiobench-ui-parity` `arms` /
`verdict`, `studiobench-ci` `selftests`, `studio-inline-images`
`images`, `studio-composer-compatibility` `composer`,
`studio-frontend-ci` `build` / `windows`. Jobs without a real Studio
backend are unaffected by it.
- `tests/studio/test_studiobench_ci_update_checks_off.py` now discovers
those jobs across all workflows (installs Playwright browsers, runs
studiobench, or boots Studio for Playwright) instead of checking two
named files, so a new UI lane cannot ship without the switch. A `KNOWN`
set of five lanes fails the guard if discovery stops recognising them.
The step-level override check and the backend-name check are unchanged.

No update-flow lane is touched: `studio-update-smoke` /
`studio-windows-update-smoke` do not drive a browser, and
`playwright_update_banner_layout.py` (Mac UI smoke) stubs
`/api/llama/update-status` and `/api/studio/update-status` with
`context.route`, so it does not depend on the backend's check.

## Testing

- The guard: 14 passed with this change; against main's workflows it
fails for all 10 uncovered jobs, the Windows UI lane and parity arms
included.
- All 124 test files that read `.github/workflows`: main and this branch
fail the same single test
(`test_cached_paths_hold_no_credentials.py::test_model_cache_variables_are_not_treated_as_credential_homes`,
pre-existing on this host); 6058 passed on main, 6069 here (the new
parametrized cases).
@danielhanchen danielhanchen self-assigned this Oct 30, 2026
Keep main's MediaHeaderActions step-down for the header links; carry over the
UI-scaled header minimum that the header column, settings rail, Train rail and
resize handle share.

[skip ci]
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 30, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Review record for #15798, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#646. The mirror's single commit is a squashed replay of this PR's change (same 8 files, same lines); every fix below was committed here, so nothing was replayed back.

Round 1: reviewed mirror fcf05bf08 (this PR at 73a9733e0)

P2: Relax the header minimum before it hides the model selector (studio/frontend/src/index.css:60)

On the web frontend at 200% interface scale with a 500px-wide page, this minimum reserves 448px for the right header column, leaving only 52px for the model selector. The mobile selector column in both Images and Video has scaled pl-12 padding (96px) and overflow-hidden, so the selector becomes completely inaccessible. Previously, the 13rem minimum left 292px for that column. The compact grid override only activates below 30rem (480px), so it does not protect this case. Apply a compact or stacked header layout before the scaled minimum consumes the selector column.

Triage: agreed. Fixed in 0274e07: below the 50rem split the header column minimum is capped at half the row, so the model selector stays visible (measured at 500px / 200%: selector shown on this branch; main hid the Train tab there instead). Regression test in ui-font-size-scales-spacing.test.ts.

Round 2: reviewed mirror 32a3c4b5b (this PR at 13d319dc0)

No major issues found.

Verdict

The review converged at mirror 32a3c4b5b, equivalent to this PR's head 13d319dc0.

@danielhanchen
danielhanchen merged commit d697fef into unslothai:main Oct 30, 2026
1 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants