Skip to content

Studio: keep chat toasts clear of header controls - #8377

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
oobabooga:fix/studio-toast-position
Aug 11, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
oobabooga:fix/studio-toast-position

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Problem

Upper-right notifications on the Chat page sit 64px from the right edge, which makes them look detached from the corner. That spacing originally made room for the header controls, but the header now has more controls and the toast still overlaps the temporary-chat button.

Because the offset belongs to the shared toast container, the same chat-specific spacing also applies on pages that do not have those controls.

Fix

Make the offsets route-aware. Chat notifications now start below the 48px header and use the normal right-edge inset. Other routes keep their existing top placement and return to the normal right inset.

Preserve the additional desktop titlebar clearance and set the mobile offsets explicitly. The existing two-toast visible stack and downward expansion behavior are unchanged.

Screenshots

Before

unsloth-toast-stacking-before-collapsed-sidebar

After

unsloth-toast-stacking-collapsed-sidebar

Testing

  • Focused toast-offset tests (3 passed)
  • npm run typecheck
  • npm run build
  • Focused Biome checks
  • git diff --check
  • Playwright at 1440x900 with three persistent notifications and the sidebar collapsed. Main placed the visible stack 64px from the right and overlapped the temporary-chat control by 18px. This branch places it 12px from the right and 11px below the controls, with both visible toasts aligned and unobstructed.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 438831c956

ℹ️ 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

Went through this one carefully, including two isolated Studio installs to photograph the change and a set of simulations across browsers and window chrome. Summary first: the problem is real and measured, the fix is correct on every platform this can ship on, and I could not find anything it regresses. I pushed one test-only commit to the branch (521103fb) adding edge case coverage.

Before and after, from two installs

Merge base af53029c1 on the left, head 438831c95 on the right. Both are real install.sh --local builds with their own UNSLOTH_STUDIO_HOME, driven by the same Playwright scene at 1440x900. The toast is a genuine one, raised by opening /chat?thread=<missing> so ChatPage fires its "Chat not found" notice.

toast placement before and after

Measured from the same page, not read off the picture:

merge base this branch
toast rect [1020, 12, 356, 80] [1072, 52, 356, 80]
inset from right edge 64px 12px
inset from top 12px 52px
--offset-right / --offset-top 64px / 12px 12px / 52px
overlap with the temporary chat control 18px 0px

The 18px matches the figure in the description exactly.

One thing the description undersells: the mobile case was worse than the desktop one. Before this branch no mobileOffset was passed at all, so every route fell back to sonner's 16px default and the toast sat 25px over the chat header controls at 375px wide. This branch takes that to 0.

viewport merge base overlap this branch
1440px 18px 0px
600px 25px 0px
375px 25px 0px

Does it hold on every platform

getToastOffsets is the whole platform decision, so I ran the full matrix of every registered route and every pathname shape against the geometry the chrome variable tables in provider.tsx actually produce, rather than against the numbers the function returns. 3368 assertions, no failures. The invariants were: the toast never sits under the window titlebar, it always clears the page header's controls on a route that has one, it never runs away more than a header's worth below, and it stays in the corner.

I also applied MAC_NATIVE_CHROME_STYLE and CUSTOM_CHROME_STYLE to a live page so the real headers moved into their desktop positions, then measured them:

chrome header controls sit at offset clearance
web 11 to 41px 52 11px clear
macOS native titlebar 9 to 39px 52 13px clear
Windows / Linux custom titlebar 43 to 73px 86 13px clear

So both of the earlier review points hold up. /images and /video are exactly the other two routes that paint a 48px header, and on macOS shouldUseCustomWindowTitlebar() is false while --studio-content-top-inset is 0px, so adding the 34px band there would have left a gap rather than closed one.

WSL is the web path, since Studio runs in a Windows browser there and isTauri is false.

Browsers

Same scene on Chromium, the real Edge binary, Firefox and WebKit. Identical on all four: top 52, right 12 at 1440px, top 52, right 16 at 375px, zero overlap everywhere. sonner switches to --mobile-offset-* purely in CSS at @media (max-width: 600px), and the boundary measured exactly where it should: 600px gets the mobile inset, 601px gets the desktop one.

The case the unit tests cannot reach

The offset now comes from useRouterState rather than a constant, so it has to follow a client side route change. Raising a toast on /chat and then clicking through the sidebar with that same toast element alive:

  • to Train, /studio, --offset-top 52px to 12px, toast top 12
  • to Images, /images, stays 52px, toast top 52
  • to Model hub, /hub, 52px to 12px
  • to Projects, /projects, 52px to 12px

AppProvider renders inside the router from __root.tsx, so the hook is legal there, and RootLayout already re-renders on pathname, so this adds no render work.

Stacking is unchanged, as claimed: four toasts expand downward on a 94px pitch on both sides, nothing off screen, the new placement just moves the origin.

Compatibility

Nothing here touches the backend, the Rust side, or any GPU path, so the hardware matrix does not apply. No persisted state, no config, no API shape, so existing installs are unaffected until they take a new build. mobileOffset is a documented sonner 2.x prop and package.json pins ^2.0.7, so a minor upgrade keeps it; npm run typecheck is what would catch it otherwise.

npm run typecheck, npm run build and the full npm test suite (1625 tests) all pass. Biome on provider.tsx reports byte for byte the same diagnostics as the merge base, so the change adds none.

The commit I pushed

521103fb is tests only. It pins down the pathname shapes the classifier has to get right, all of which I verified against the running app first:

  • a route that only shares a prefix, /chatty and /images-old, must not inherit the header clearance
  • an unrecognised pathname, including the trailing slash form of a media route. Worth knowing: this router does not normalise trailing slashes, so /images/ rests on its own pathname, and I checked in the browser that it misses the route and renders the 404 shell with no header. The no-header placement is the right answer there, but it is arrived at by accident rather than by design, so it is worth a test
  • a custom titlebar reported while isTauri is false, which cannot happen but which the signature allows
  • purity, so a caller mutating the returned object cannot poison the next lookup

Two small things, neither blocking

HEADER_ROUTES is the same set as isChatLike in __root.tsx, computed in two places. A fourth full height workspace would need both updated, and the failure mode is a toast quietly landing on that workspace's header.

HEADER_TOP_OFFSET = 52 hard codes what CSS expresses as --studio-chat-header-height, which is 48px on web and Windows and Linux but 44px on macOS. It clears both today with room to spare, so this is only a note about where the number lives.

Looks good to me.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Aug 11, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 521103fbbb

ℹ️ 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".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 11, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Aug 11, 2026
@unslothai unslothai deleted a comment from oobabooga Aug 11, 2026
@danielhanchen

Copy link
Copy Markdown
Member

Ran this across the OS matrix on a staging repo rather than the org queue, since it touches studio/. Everything that exercises the change is green.

platform result
ubuntu-latest pass
macos-14 pass
windows-latest pass
studio-live Playwright (chromium, firefox, webkit) pass

Frontend CI, Unsloth API/GGUF/Tauri CI, the Windows and Mac Studio suites and Backend CI across Python 3.10 to 3.13 all pass on the branch as well.

Two red jobs, neither caused by this PR:

  • Backend CI on Python 3.10 only, test_pending_load_can_be_cancelled_without_waiting_for_model_lock asserting an STT sidecar worker thread had stopped. 3.11, 3.12 and 3.13 passed; re-running the failed job turned it green, so it is a timing flake in a thread this change never reaches.
  • Unsloth UI CI, the image model full-footprint selector Playwright test, timing out on FLUX.2-klein-4B-GGUF. That one is already red on the staging repo's own main and on several unrelated branches, and it asserts on the image model catalog. This PR touches provider.tsx, toast-offset.ts and toast-offset.test.ts only.

oobabooga and others added 3 commits August 11, 2026 12:58
Add cases for the pathname shapes the offsets have to classify: a route that
only shares a prefix with a workspace, an unrecognised pathname (the 404 shell
and the trailing-slash form of a media route, which this router does not
normalise), a custom titlebar reported off the desktop app, and purity of the
returned object.
@danielhanchen
danielhanchen force-pushed the fix/studio-toast-position branch from 521103f to b1e736b Compare August 11, 2026 12:59
@danielhanchen
danielhanchen merged commit 496a1c7 into unslothai:main Aug 11, 2026
5 of 40 checks passed
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.

2 participants