Skip to content

Perf/scroll performance - #13255

Merged
danielhanchen merged 61 commits into
unslothai:mainfrom
Sneakr:perf/scroll-performance
Oct 12, 2026
Merged

danielhanchen merged 61 commits into
unslothai:mainfrom
Sneakr:perf/scroll-performance

Conversation

@Sneakr

@Sneakr Sneakr commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

In long conversations, especially ones with large responses, expanded thinking sections, code blocks and LaTeX, the app can become effectively unusable. The slowdown affects the whole interface:

  • Hover states and tooltips respond with long delays.
  • Typing in the chat box becomes slow or briefly unresponsive.
  • Resizing the window, dragging panel boundaries and adjusting controls feel sluggish.
  • Buttons, menus and scrolling respond late or appear frozen. On Unsloth Desktop for Windows, scrolling through math-heavy chats is visibly choppy.

This PR reduces the frontend work behind those stalls: repeated rendering, syntax highlighting, broad style recalculation, layout measurement, and scrolling that waits on the main thread. Expensive updates are deferred, reused or split into smaller tasks, so more time is left for input and painting.

Before

before.mp4

After

after.mp4

Changes

Chat rendering and scrolling

  • Render long thinking transcripts in bounded batches and defer layout work for offscreen content.
  • Preserve the reading position when thinking sections expand, streamed text is rewritten, or content above the viewport changes size.
  • Remeasure settled thinking rows one per frame after a width change, pausing during panel drags, without moving the reader.
  • Keep automatic scrolling attached during generation until the user intentionally scrolls away, including past long code blocks on WebKit.
  • Adjust streaming render frequency to rendering cost, leaving time for input between updates.
  • Reuse derived message data and Markdown processing results instead of reprocessing unchanged content.

Code blocks and thinking sections

  • Defer syntax highlighting until code blocks approach the visible area.
  • Limit syntax-token elements in large code blocks to nearby lines while keeping the underlying text.
  • Move expensive highlighting to a worker where appropriate, with recovery for failed or stalled requests.
  • Colour code inside thinking sections off the main thread: a closed block when it nears the screen (cached), a block that is still streaming only while it is on screen, at most four times a second. Without the worker it stays plain, selectable text.
  • Preserve selection, copying, find-in-page navigation and printing when rendering is deferred.
  • Remeasure deferred content after interface zoom and font changes.

Window resizing, panels and controls

  • Scope drag state, corner offsets and backdrop updates to the elements that use them, reducing page-wide style recalculation.
  • Keep sidebar width out of the sidebar context, and share resize, storage and scale listeners across panel width consumers, so a width change re-renders only what uses it.
  • Avoid searching the conversation DOM when checking whether overlays cover a native Browser view.
  • Use the Browser snapshot during split resizing and keep its content aligned below the toolbar.
  • End panel drags correctly when pointer capture is lost, and keep a closed floating monitor out of panel drags.
  • Keep slider drafts local to their controls so dragging does not repeatedly update unrelated chat content, and re-render only the Run settings panel for a sampling change.
  • Preserve slider commits across pointer cancellation, multiple pointers and unmounting.

Unsloth Desktop

  • Keep wheel scrolling on the compositor thread on Windows and Linux. Before this change, every scroll in the chat waited on the main thread for two reasons:
    • Interface zoom: The interface zoom kept a blocking wheel listener on the window. It now uses the same gating as the web app: the blocking listener is armed only while Ctrl or Meta is held, or while the pointer is over a zoom scope. A Ctrl+wheel after a missed keydown arms it, so only that first notch scrolls. macOS keeps the listener armed, because a pinch reaches its zoom scopes without a keydown.
    • Pinned sidebar decoration: The pinned sidebar edge decoration was a full-height box laid over the chat. It is now drawn with borders that do not cover the chat, and looks the same.
  • Watch modal changes for menu shortcut availability only on macOS, where the native app menus exist. Other desktop builds no longer rerun every shortcut check on each body mutation.
  • Scroll the chat on the compositor below 1.5x display scale on Windows while keeping ClearType text.
  • Start the chat scroller below the custom titlebar so the titlebar no longer covers its scrollbar.

Responsive styles and reloads

  • Convert supported viewport media queries into document-level gates during production builds, preserving print rules and selector specificity. The build plugin parses CSS with PostCSS and postcss-selector-parser. It leaves invalid selector lists as written, and it leaves a stylesheet it cannot parse ungated with a warning instead of failing the build.
  • Refresh breakpoint gates before application resize handlers measure layout.
  • Keep the retained reload shell synchronized with breakpoint changes.
  • Resolve the gate boot script using Vite's configured base path.
  • Rewrite Tailwind spacing and divider selectors so the browser checks the parent before a child's position, reduce other positional selector checks, and use explicit thread-width states for chat layout changes.

Frontend data and persistence

  • Share eligible in-flight thread reads and invalidate them after relevant writes and history changes.
  • Use message counts when filtering nonempty threads, keeping the existing message-loading fallback.
  • Keep project-document associations current without repeated thread reads.
  • Avoid redundant frontend checkpoints while a confirmed durable generation stream is owned locally, while keeping checkpoints for streams that depend on them.

Validation

  • Unit and static checks: 11,183 frontend unit tests pass, the typecheck is clean, and ESLint reports no new findings.
  • Desktop scrolling, long math chat: Unsloth Desktop on Windows, both thinking boxes expanded (about 56,500 elements), real mouse-wheel scrolling up from the bottom and back. Dropped frames went from 40% to 0–1%, with every frame scrolled on the compositor.
  • Window resize, same chat: An 800 CSS px resize crossing several breakpoints, with and without the breakpoint gates.
    • Desktop: The slowest 1% of frame gaps went from 68.8 ms to 18.8 ms, and long animation frames per resize from 10 (636 ms) to 0.
    • Chrome: 75 ms to 16.7 ms, and 8 long frames to 0.
  • Hover stall on Windows desktop: Hovering message action buttons stalled for 68 ms before the macOS-only modal watching; afterwards, no stalls.
  • Breakpoint gate equivalence: The gated CSS produced the same computed styles as the original CSS everywhere checked (0 differences):
    • Chromium, Firefox and WebKit: every rule in the gated blocks, at 45 widths, during resize and in print.
    • Unsloth Desktop and Chrome: the long chat and the Hub, Images, Projects and Studio pages.
  • Ctrl+wheel zoom on desktop: Zooms without scrolling while Ctrl is held, and leaves no blocking listener once Ctrl is released.

Scope

  • Changes are limited to the frontend and related tests, plus two Python contract tests (tests/studio/test_chat_eject_in_flight.py and tests/studio/test_model_picker_contracts.py) that read frontend source.
  • postcss and postcss-selector-parser are added as frontend dev dependencies, at the versions already in the lockfile, and are used only by the build plugin.
  • Backend code, inference behavior, API contracts, CI workflows and Playwright files are unchanged.

Not included

  • Math paragraph rendering: Math paragraphs still use upstream's content-visibility: auto with fixed placeholder heights. Scrolling into a long math chat for the first time can briefly show a block before it renders, and placeholder corrections move content above the reader. Rendering blocks earlier removes this but doubles painting work, so it is left for a follow-up with its own measurements.
  • macOS desktop zoom: macOS desktop keeps the always-armed zoom wheel listener. It was not measured on a Mac.

UI before / after

Two clean Studio installs from this PR's merge base (160cb41) and head (7c185b9), driven by the same Playwright scene. Every reply is the same scripted stream on both sides, so the text cannot differ. Facts read from the page matched on both sides: answer text hash, math and table counts, block spacing at 1500, 1000 and 700 px, thread widths, thinking code coloured mid-stream and settled, slider count, find count, menu items, dialog text. Nine of the twelve pairs are pixel identical; the answer pair differs only in the reply timing label, the settled thinking pair by an 18 pixel hairline, and the long trace pair by a one pixel scroll offset.

Answer with inline and display math, a table and a highlighted Python block.

Answer with inline and display math, a table and a highlighted Python block.

Code inside a thinking block while it is still streaming: coloured on both.

Code inside a thinking block while it is still streaming: coloured on both.

The same thinking block after it closes.

The same thinking block after it closes.

A 20K character thinking trace, aligned on the same code block, coloured on screen.

A 20K character thinking trace, aligned on the same code block, coloured on screen.

1000 px window: same thread width (744 px) and block spacing.

1000 px window: same thread width (744 px) and block spacing.

700 px window: same thread width (640 px) and block spacing.

700 px window: same thread width (640 px) and block spacing.

Run settings sheet with its four sliders.

Run settings sheet with its four sliders.

Find in page for "hypotenuse": 1/4 on both, matches inside the code block too.

Find in page for "hypotenuse": 1/4 on both, matches inside the code block too.

Chat options menu.

Chat options menu.

Delete chat dialog (cancelled).

Delete chat dialog (cancelled).

Model menu.

Model menu.

Sidebar closed, pointer at the left edge.

Sidebar closed, pointer at the left edge.

Not shown here: the Desktop only changes (custom titlebar offset, window backdrop, low display scale, zoom wheel listener) and panel or split drags, whose change is timing rather than appearance.

Sneakr added 30 commits October 6, 2026 05:28
Long reasoning transcripts made the whole window sluggish: every token
publish re-rendered the message tree on the sync lane, two mutation
observers forced layout per publish, the open code fence was re-lexed and
rebuilt three times at completion, and on Windows the custom scrollbar
dragged the thread on the main thread with a full relayout per hover.

- Render streaming text on a cost-aware cadence instead of per publish,
  and keep the open fence to a line window while it streams.
- Read nothing from layout inside the autoscroll mutation callback; pin
  instantly at run start so the follow never detaches.
- Drive the message list through a portal so the library's resize
  observer stops measuring the viewport, and skip content selectors
  while a message is running.
- Own the strings sliced out of the transcript so V8 drops the parents.
- Arm the zoom wheel listener only while Ctrl/Meta is held.
- Give the thread Chromium's standard thin scrollbar on Windows and
  scope the hover reset to the lists that need it.
- Mount the response details sheet only while it is open, skip
  checkpoint saves during a durable run, and let find-in-page observe
  the document only while it is open.
Long replies with 100K+ reasoning traces and 900-line fences made the whole
UI sluggish once their boxes were expanded: 29.7K DOM elements at rest,
half-second reopens, 300-450 ms layouts on every width, font or theme change,
and blank bands while scrolling the traces.

Fences: FenceMode "window" is the ship default (240-line cap). Off-screen lines
of a long fence render as one text node, the body carries its height in
--unsloth-fence-height so the engine can skip it under content-visibility: auto
(code-block containment flag, same gate and ablation switches as the math one),
line windows measure from the body's computed line-height instead of descendant
geometry and skip frames while the scroller is flying. Fences past the
highlight limit are tokenized in the worker and seeded into the fence cache.

Reasoning transcript: rows in flow instead of a virtualizer. A character and
pixel budgeted progressive mount (4K chars first, 24K chars per frame shared
across open transcripts, quarter budget during the first 300 ms) with a
trailing spacer of estimates, rows settle after two frames and only then
become skippable (reasoning-row containment flag), code fragments are grouped
per fence under one one-way IntersectionObserver with worker highlighting whose
replies keep identical line arrays. Reading position: captured per scrolled
frame with one reused Range (a Range per text node per frame left thousands
attached until GC and made every DOM removal walk them), ignored in frames the
engine's own scroll anchoring shifted before the width handler ran, restored
across reopen, threshold hand-over and width changes.

Store selectors: per-message-parts derivations and compaction notice owners are
memoized on the array identity, the copy button reads the store at click, the
thread list filters by message counts.

Measured on the user's 11-message thread (two 130K traces, two 900-line
fences): DOM 29.7K -> 4.4K elements; reopen 528-758 -> ~270-500 ms; width
change 330 -> ~70 ms, font scale 447 -> ~150, theme ~310 -> ~150; blank bands
while scrolling expanded traces 333 -> 85 px at 300 px ticks and 778 -> 268 px
at 600 px; Windows Chrome wheel p50 16.6 -> ~12 ms with all boxes open and no
checkerboarded frames collapsed. Maintainers' transcript checks pass 15/15 on
chromium; the code-block flicker contract is clean on chromium and firefox.
…ngine

With every thinking box open on a long thread (two 130K-character traces,
two 900-line fences), opening, jumping, resizing and streaming still cost
long frames, and on Firefox and WebKit the reading position slipped or jumped.

Reasoning transcript
- Widening is commit-bounded: one shared frame budget (24K characters and 64
  rows across every open transcript), a starved request is re-issued, and the
  limit always lands on a chunk boundary of a fixed grid, so chunk keys never
  change and no row is ever remounted.
- Jumping into an unmounted stretch mounts an island of rows under the viewport
  at once. Islands only grow and keep their identity; every unmounted stretch
  is the spacer of the island below it or of the tail, and a closed stretch
  keeps a zero-height spacer in place. Commits therefore only insert or restyle
  nodes: WebKit lays a size container out mid-style-resolution, and removing a
  tall spacer threw a reader parked at the bottom 120K px up (HEAD jumped at
  cover).
- The limit and the islands carry the document they were computed for, so a
  widening, print or re-issue still queued for a replaced document can never
  bring its prefix back.
- Chunks of rows are the content-visibility units. They are their own
  formatting context while containment is on, so settling no longer drops a
  code group's collapsed margin for a frame and makes a following reader
  detach. A chunk settles only after a whole frame has laid it out at the
  current width, counted per row; one whose rows render again before it
  settles waits a fresh frame, and a transcript shown again after rows settled
  while it had no box is laid out again.
- The reading anchor is held relative to the transcript root: corrections are
  whole pixels and the sub-pixel remainder carries into the next anchor, so
  Firefox and WebKit no longer creep 4-14 px over a fill. A trace wholly above
  the viewport undoes its own growth, measured across each commit, which
  WebKit otherwise leaves a reader in a later trace to slide under.
- Code groups position their own copy and download actions. A print mounts
  every open trace in one synchronous commit and latches the fences it
  brought. The parsed index is cached per reasoning round.

Highlighting
- The highlight worker answers a ready handshake; a slow boot is "stalled",
  not "unavailable", so speculation resumes when it recovers, while a fence's
  whole-body request keeps waiting on the late worker. A fence over 20K
  characters is never tokenized on the main thread outside a print: without a
  worker it stays plain rather than freezing 0.3-0.5 s per fence. A request
  that never settles fails after 15 s, so it cannot hold a speculation slot.
- Settled fences are pre-tokenized at idle (budgeted, up to three in flight,
  paused while a reply streams or the worker is stalled) and seeded exact-hit
  only. Exact requests fork a shared prefix entry, so sibling fences that
  extend one another are tokenized once each and none keeps a plain tail.
- Common grammars are warmed at idle after the first quiet moment. A selection
  inside a windowed fence pins only the lines holding its boundaries, and a
  drag freezes the window until the button is released (WebKit sends neither
  pointerup nor pointercancel after a text drag, so dragend, drop and a
  buttonless move release it too).

Thread
- A scroll-up that arrives with a shorter page is content leaving, not the
  reader leaving the bottom, unless a scroll-up key was just pressed.
- The message rhythm rule no longer uses a universal sibling combinator, which
  made Blink restyle every mounted row on each insertion.
- Thread reads are shared while in flight, the documents bar follows the row
  it announces instead of re-reading on every project change, and the split
  handle releases on blur or a buttonless move.

Measured on the user's thread with every box open, against HEAD: fast wheel
60.0-60.2 vs 56.0-56.5 fps, 0 vs 8-10 frames over 33 ms, 1-18 vs 402-468 ms
dropped, script 560-563 vs 1,809-1,864 ms, style 26-27 vs 310-352 ms;
Windows Chrome expanded wheel 57.2 fps, 23 ms worst, 13% busy vs 55.8 fps,
105 ms, 37%; resize keeps the passage with zero drift. WebKit: a reader at
the bottom or mid-trace is no longer thrown (HEAD 70-99K px at cover), and a
reader in a later trace stays within 2 px while an earlier one fills (HEAD
jumps 23K px); a jump into the later trace while both still fill can take one
326 px step. Fast streams keep following in Chromium and Firefox (lost 4/4
before). Maintainers' transcript checks pass 4/4 in Chromium on dev and 2/2
on a production build.
The thread's rows render through a portal from a hidden host, and React
routes their drag events to that host instead of ThreadPrimitive.Root, which
owns the page-wide drop handlers. In a browser a file dropped on a message
was therefore never attached: dragover was not cancelled and Chromium opened
the file in a new tab. The host now carries the same four handlers. Each
native event still reaches exactly one of the two, so the drag depth stays
balanced and the composer's drop affordance shows and hides as it did before
the portal. Unsloth Desktop was unaffected, since its native drop path skips
these handlers.

The split handle's width collapse and its disabled hit test read
`!artifactLayoutActive || browserFullView` directly again instead of a
hoisted constant, which is the expression the deep research frontend
contract pins (tests/studio/test_deep_research_frontend_contract.py).
Conflicts resolved:
- studio/frontend/src/features/chat/api/chat-api.ts: kept the shared
  thread-read helpers and upstream's export of notifyChatProjectsUpdated
  for the conversation import (unslothai#8561).
- studio/frontend/src/index.css: took upstream's removal of the Canvas panel
  shell rules (unslothai#12804) and kept the drag-cursor rule for the chat split,
  whose handle still exists and opts out of the library's cursor.
- studio/frontend/tests/rag-thread-initialization.test.ts: kept both harness
  extensions, announced rows and document scopes from this branch and the
  knowledge-base source and uploadItemFromIntent stub from unslothai#12779.
Upstream's Browser overlay (unslothai#12804) is an inline aria-modal dialog. This
branch had replaced the `html:has([aria-modal="true"])` rule that kept the
find bar under modals with document flags, and nothing sets one for an inline
modal, so on the first open of a session (compare mode, phone width or a
project view) the find bar stayed drawn over the overlay for 300-450 ms,
until the lazy browser panel loaded. The overlay now flags the document while
it is mounted, and a separate rule hides the find bar from the overlay's
first frame. The zoom popup keeps upstream's behaviour.

Windowed code blocks reserve their height before they first render, from
their line count times the line pitch. The pitch came from the body's
computed line-height, which upstream's 12px code font (unslothai#12805) moved off the
1/64 px grid Chromium and WebKit lay lines out on: at non-default UI sizes
or interface scales a 900-line block reserved 3-11 px too much and moved the
reader when it rendered. With a custom Code font size the body never
reported the code's line-height at all, so the reservation was off by
hundreds to thousands of px and visible lines could fall outside the line
window and lose their colours. The pitch is now measured from layout, once
per font setting and device pixel ratio, with a hidden 64-line probe built
like the block's own lines and placed beside the body, so a skipped body is
never laid out. On this thread's two 900-line blocks, at UI sizes 15-19 and
custom Code sizes 13 and 16, the reserved height now matches the rendered
one within 0.02 px in Chromium, Firefox and WebKit (before: up to 11 px, and
up to 6,600 px with a custom size).
WebKit restyles every element under a size container whenever the
container's inline size changes, so with the thread root as an
`@container` every pane drag, sidebar toggle and window resize restyled
the whole thread. On the long test thread (15K elements, every thinking
box open) that cost about 400 ms per step on WebKitGTK, and Unsloth
Desktop runs on WebKit on macOS and Linux.

The root is no longer a container. A ResizeObserver sets
data-thread-narrow (31.5rem and under), data-thread-tiny (18.75rem and
under) and data-thread-wide (36rem and over) on it, with rem read from the
root font size as a container query reads it, and the rules that queried
the container select on those attributes inside :where(), so their
specificity is unchanged. The thinking pill keeps its own container query
on the composer surface. A print is laid out at the page's width, which no
observer reports, so print takes the wide code header a page always got.

Dropping the container also stops a WebKit scrollTop clamp. Under a size
container WebKit lays the document out in the middle of style resolution,
so a commit that removed or re-keyed a tall element, such as streamdown
replacing a block of a streaming reply, clamped a following reader's
scrollTop and read as a scroll-up: a stream started from an empty thread
was never followed. Setting container-type: normal on the root alone
stopped it.

WebKitGTK 2.44 / 2.50 / 2.52 on the long thread: a pane resize step
405 / 383 / 450 ms -> 89 / 43 / 61 ms (p50), a drag frame about 400 ms ->
20 ms, the sidebar toggle's first frame 460 / 445 / 528 ms ->
186 / 117 / 160 ms, and moving the split with the arrow keys 2 fps ->
11 / 23 / 18 fps. In Chromium the forced layout per step halves
(8-14 ms -> 4-5 ms); the one frame in which the width crosses a step does
an extra layout, 66-108 ms against 32-35 ms.
WebKit remembers a `contain-intrinsic-size: auto` size in the zoom it was
laid out at, and lays out contain-intrinsic-size lengths without the page
zoom (WebKit bug 308137). After an interface scale change in Unsloth
Desktop on macOS and Linux, every skipped reasoning chunk, windowed code
body and maths block above the reader kept a height from the old zoom,
and the thread jumped as they came back on screen.

While setZoom runs, and for 300 ms after, html carries
data-interface-zooming and those blocks render, so WebKit measures them at
the new zoom before they are skipped again. WebView2 rescales remembered
sizes itself, so Windows skips the hold, and a setZoom that never settles
releases it at the first-paint deadline. A code body's reserved height is
scaled by a measured contain-intrinsic-size factor, which the line-pitch
cache also keys on, since devicePixelRatio ignores page zoom on WebKitGTK
2.50 and Safari 26.3 and earlier.

On Windows the thread's scrollbar gutter now divides by the zoom: the
native thin scrollbar keeps its size when the page zooms, so the gutter
reserved for it grew and shrank with the interface scale.

Off macOS a trackpad pinch arrives as Ctrl+wheel with no keydown, so the
wheel listener that turns it into an interface zoom also arms while the
pointer is over a zoom scope.

WPE and WebKitGTK 2.52, zooming the test thread: display maths measured
wrong afterwards 119 of 120 -> 0 of 120, and the reader's passage moved
850-900 px -> 2-93 px. Reasoning and code at 80% and 90%: median drift
27-31 px -> under 1 px.
JavaScriptCore never compiles a regular expression with a lookbehind to
native code, and Shiki's grammars are full of them, so highlighting runs
5-25 times slower on WebKit than in V8. Unsloth Desktop on macOS and Linux
stalled for 0.5-1.6 s whenever a settled code block, or a block waiting
on a worker that could not answer, was tokenized on the main thread.

On engines without requestIdleCallback, which today means WebKit:
- a settled code block is tokenized by the highlight worker, unless the
  main thread's own cache already covers all but its last 512 characters,
  as it does for the block that just streamed. Whatever the cache already
  coloured stays on screen while the worker finishes, so a block never
  goes plain on the way;
- a reasoning code group falls back to the main thread only up to 2,000
  characters;
- grammar warm-ups, the fallback queue and scheduleIdleTask's fallback
  wait for 300 ms without input, within their deadlines, so none of them
  lands in the middle of a scroll.

On JavaScriptCore, told apart by its user agent so the worker makes the
same choice, regular expressions are built for an ES2018 target, which it
compiles several times faster than the default target's v-flag patterns.
V8 matches the emulated patterns about 7% slower, so Blink keeps the
default.

The worker client: a request for a block the main thread could tokenize
no longer waits out a late boot; a ready worker that sends nothing for
15 s while such a block waits is treated as late until it answers; and a
second evaluation of the worker's entry, which WebKit runs when a grammar
chunk imports it back, keeps the first message handler. The grammar
prewarm waits for 1 s without input. Reasoning line tokens keep a
coloured line over an uncoloured reply for the same text, and a reasoning
code fragment re-renders when any of its lines' tokens change, not only
its first line's.

WPE and WebKitGTK 2.52 under tauri:// with the app's CSP, streaming three
code blocks: the longest main-thread stall 497-708 ms -> 218-238 ms, and
every block ends coloured, where one or two used to stay plain. With the
worker missing, 60 s late or silent, every block up to 20K characters ends
coloured, with stalls of 353-406 ms against 1.0-1.6 s before.
A windowed code body is skipped with content-visibility: auto and sized
by contain-intrinsic-size: auto var(--unsloth-fence-height). It was marked
windowed on its first render, before the measurement that writes that
height, so an upgrade off screen was first laid out as an unsized skipped
body and collapsed. When the previous reply's 900-line block upgraded from
plain to highlighted about 1.8 s into a new stream, the thread shrank by
15,600 px for that layout. Desktop WebKit has no scroll anchoring, so the
following reader's scrollTop was clamped and stayed there, which read as
the reader scrolling up and stopped following for the rest of the reply.

The body is now marked windowed only once it has been measured, and its
height is compared with the element's own declaration rather than the
last value written, so a body that remounts is given its height again.

The reasoning transcript's hold, which keeps a detached reader's passage
still while rows above it grow, now learns whether the scroller acted on
its correction even when WebKit applied none of it, so the unapplied part
carries to the next commit instead of being lost.

Real app on WPE, with and without scroll anchoring, streaming after the
long thread: followed to the end in 6 of 6 runs, against 0 of 6 before.
The smoke harness follows 24 of 24 streams on WebKit, Chromium and
Firefox and 12 of 12 on WebKitGTK 2.50 and 2.52, and wheel, PageUp,
selection drag, find and scrollbar still detach exactly as before
(64 of 64, and 12 of 12 on WebKitGTK).
Dragging the chat split set a `:root[data-chat-split-resizing] *` cursor
rule. It matches every element, so starting and ending a drag restyled
the whole document: 55-69 ms in Chromium and about 320 ms in WebKit on
the long test thread. The drag now places a transparent full-window
overlay at the drag-cursor layer for its duration, which carries the
cursor and keeps the pointer off the panes and their iframes; starting
or ending a drag costs 18-21 ms on both engines.

Find-in-page rebuilt its index on a timer even while the reader was
scrolling. A rebuild now waits until no wheel or touch movement has been
seen for its interval, and autoscroll's own scrolling does not count, so
a followed stream still gets its rebuilds.
A reasoning transcript mounts its rows a bounded step per frame. On
engines without requestIdleCallback the step now scales by how long the
last growing commit took, aiming at 16 ms, never below an eighth of the
full budget and at most doubling back per frame. Blink commits a full
step inside a frame and keeps the fixed budget.

WebKitGTK 2.52, expanding and scrolling the long test thread: frames over
33 ms 22 -> 11, over 50 ms 8 -> 3, p90 38 -> 27 ms, for a fill 13% longer
(3.9 s -> 4.5 s).
The custom Windows/Linux titlebar dimmed itself under a modal through
`body:has(> [data-viewport-backdrop="true"][data-state="open"])
[data-slot="window-titlebar"]::after`. That made <body> a non-subject
:has() anchor, and checking its children marked #root as inside a
:has() scope. At a cold start the titlebar renders before the app
mounts, so every subtree mounted later inherited that mark, and each DOM
mutation (a keystroke's textarea update, a streamed token, a row
mounting while scrolling) walked up to <body> and invalidated every
:has() rule over the whole document. Unsloth Web has no custom titlebar,
and a reload mounts the app before the first style pass, so only a
freshly started desktop app showed it.

The titlebar now watches the body's direct children and marks itself
while an open viewport backdrop is among them. Matching is unchanged:
only direct children of the body count, stacked modals keep the dim
until the last one starts closing, and panel-local overlays and menus
never dim it.

Unsloth Desktop on Windows (WebView2 154), cold start, long thread:
style recalc per keystroke 21.6-33.4 -> 0.4-0.5 ms (3,400 -> 5
elements); a 4 s wheel scroll with the thinking box expanded spent
831 -> 95 ms in style recalc, frame p99 33.3 -> 4.3 ms.
Below 1.5x device scale Chromium keeps LCD text in preference to
composited scrolling, so it scrolls an overflow container on the main
thread unless the container's scrolling background is known to be
opaque. The thread viewport is transparent. On 100% and 125% Windows
displays, and in Unsloth Desktop wherever its own zoom sits on such a
display, every scrolled frame repainted, re-layerized and re-rastered
the visible thread.

Below that scale the viewport now paints the page background itself.
Chromium only counts a solid background as scrolling contents with an
auto gutter, so the stable both-edges gutter becomes an always-shown
bar plus a transparent start border of the same width. Layout and text
stay pixel-identical, LCD text included. The flag divides the desktop's
page zoom out of the pixel ratio, since Chromium decides on the
display's own scale. 1.5x and above is unchanged, and the docked
browser chat keeps its rounded surface.

Unsloth Desktop on Windows, long thread with the thinking box expanded,
4 s fast wheel scroll at 1x with 150% interface zoom: scroll latency p99
29.2 -> 13.1 ms, main thread 764 -> 496 ms, compositor 253 -> 136 ms,
GPU 321 -> 76 ms, raster 90 -> 15 ms. Unsloth Web in Edge at 1x: main
thread 593 -> 512 ms, GPU 277 -> 94 ms, layerize 85 -> 26 ms, with
identical screenshots.
Dragging the Run settings panel restyled the whole window on every
frame. The panel's ResizeObserver wrote --studio-chat-settings-inset on
<html> as the edge moved, and a custom property set on the root is
inherited by every element, so each frame Chromium recomputed the style
of the entire document (about 9,000 elements on a long thread) only for
the toast column and the stacked overlay cards to read it. The browser
panel wrote --studio-browser-page-inset the same way.

Both insets now go to the elements that read them: the toaster and the
two overlay rails register themselves, take the current values when
they mount and receive every later write. Nothing is written to <html>.

Unsloth Desktop on Windows (WebView2 154), long thread with the thinking
boxes expanded, a 3 s drag of the Run settings edge: style recalc per
frame 8,997 -> 188 elements at p90, frame p90 87.5 -> 17.6 ms.
The floating monitor follows the painted width of the Run settings
panel and of the sidebar through ResizeObservers, so it can stay clear
of them. Both stayed attached while the monitor was closed, so every
frame of either drag re-rendered a monitor that was not on screen. They
now attach only while it is open, and attach again when it opens.
The table toolbar's buttons were styled through
`[data-streamdown="table-wrapper"] > div:first-child:not(:last-child) >
.relative` and `... > button`. A :first-child in an ancestor compound
makes Blink file the subject's features, `.relative` and `button`,
under :first-child invalidation. Every modal and menu inserts a focus
guard at the start of <body>, which changes #root's :first-child state,
and that then invalidated every `.relative` and every button in the app.

The rules now select the toolbar's children directly. The table's own
box holds only the <table>, so they match the same elements, and the
margin rule that does need the position keeps it on its subject.
When a thread contains math, KaTeX's MathML loads Chromium's MathML
stylesheet, whose `mmultiscripts > mprescripts ~ :nth-child(2n+1)` puts
a whole-subtree set into the universal sibling invalidation set. From
then on, inserting or removing a child anywhere but at the end of a
parent restyles that parent's entire subtree, if the parent was ever
flagged for sibling rules. A selector with a featureless subject is
tried against every element, so `.aui-branch-chevron-btn + *`,
`.aui-branch-chevron-btn + :not(...)` and
`:where(.aui-assistant-message-content > .h-0 + *)` flagged every
parent in the document, <body> included, and
`:where(.aui-assistant-message-content > :not(:first-child))` made every
element track :first-child. Tailwind's space-* and divide-* utilities
did the same for :last-child through `:where(.X > :not(:last-child))`,
and with the thread's trailing-margin chain that made appending to any
container restyle its previous last child's whole subtree.

The branch picker's rules now name the count between the chevrons by
its class, and the message rules check the parent first inside
:where(), keeping zero specificity. A small Vite transform rewrites
Tailwind's `:where(X > :not(:last-child))` to
`:where(X > *):where(:not(:last-child))` in dev and build alike: the
same elements and the same zero specificity, but Chromium matches simple
selectors left to right, so it only checks the position of children of
X. The computed styles of every affected element are unchanged.

Unsloth Desktop on Windows (WebView2 154), long thread with math, one
element inserted and removed at the start or middle of <body>, #root,
the app shell, <main>, the thread root or the viewport: 2,400-2,700
elements restyled, 25-36 ms -> 1 element, 0.2 ms. Appended at the end
of the app shell's containers: 2,400-2,600 -> 1-2. Radix focus guards
(every modal and menu) and tooltip and popover portals are such inserts
and removals.
The desktop sidebar's edge strip returned null while the sidebar was
pinned, so every pin and unpin, Ctrl+B included, inserted or removed a
child between the sidebar and <main>. <main>'s
`peer-data-[variant=inset]` rules flag their parent for sibling
changes, and with math on the page Chromium then restyles everything
below that parent, which is the whole app. The strip's container now
stays mounted and only its handle comes and goes.

Unsloth Desktop on Windows (WebView2 154), long thread with math,
Ctrl+B: style recalc 8,950 -> 175 elements, 65-72 -> 4-7 ms, longest
task 111-126 -> 46 ms.
A resize drag lays a full-window overlay over the app to own the cursor
and tears it down on pointerup or pointercancel. If the capture was lost
without either, the overlay stayed and swallowed every click until a
reload. Losing the capture mid-drag now ends the drag like a cancel; a
normal pointerup has already ended it by the time its capture goes.
While a native browser page is open, a check every 300 ms (and on every
browser store change or new body child) looks for menus, dialogs and
toasts over it, and for the docks that shorten it. Both lookups were
document-wide querySelectorAll calls, so on a long thread each check
walked every element of every message: 2.7 ms for the docks and 4.6 ms
for the overlays on a 61,000-element thread, and the check came to
10.6 ms, a dropped frame or three at 240 Hz every 300 ms.

Nothing that can cover a native page renders inside the thread's
viewport: menus, dialogs, tooltips and the image zoom portal into
<body>, toasts render from the app shell and the page's own covers live
in the browser panel. The lookups now run the same native queries on
everything except the viewport's subtree, which still finds the
full-view dock that encloses it.

Unsloth Desktop on Windows (WebView2 154), long thread, Wikipedia in the
browser panel: the check 10.6 -> 0.56 ms.
…ragged

The split between the chat and the browser pins the page at its size
while it is dragged, so it lays out once on release. A native page is
not clipped by the DOM and was not told about the drag, so it kept its
old bounds the whole time: shrinking the panel slid the chat under the
page, growing it opened a gap.

The split now holds the same drag overlay the sidebar and Run settings
handles use, moved to its own module. Its slot already counts as
covering a native page, so for the length of a drag the page shows the
snapshot it shows under a menu, which the DOM clips with the panel, and
comes back at its new size on release.
react-resizable-panels sets pointer-events: none on both panels for
the length of a drag. The property is inherited, so pressing and
releasing the split each restyled the entire thread, about 6,000
elements and 40-60 ms. The thread panel's wrapper now sets
pointer-events: auto itself, as the browser side's surface already did,
so the change stops there; the drag overlay keeps hover and clicks off
the content as before.

Thinking boxes re-measure every row 150 ms after their width stops
changing. A drag that paused, or met a panel's limit, did that in the
middle of the drag, 20-45 ms each and again after release. They now
wait for any panel drag to end first.

Unsloth Desktop on Windows (WebView2 154), long thread with the thinking
boxes expanded, Wikipedia in the browser panel, a 3 s drag of the split:
long animation frames 6 (400 ms) -> 0, frames over 33 ms 16 -> 0, frame
p99 33.4 -> 20.9 ms, largest style recalc 6,994 -> 785 elements,
drawn-frame gap median 27 -> 17 ms. Unsloth Web in Edge, same drag:
longest task 57.6 -> 9.9 ms, worst frame 58 -> 17 ms.
The page was pinned with top: 0 inside the panel's body, so for the
length of a split drag it covered the address bar and the bookmarks bar
in both Unsloth Desktop and Unsloth Web. It is now pinned at the offset
it had, under the toolbar.
Every slider in Run settings and in the model picker's configure page
wrote its owner's state on each pointer move. A Run settings slider
wrote the chat runtime store, which the whole chat page subscribed to,
and a picker slider wrote the configure page's draft config, so each
move re-rendered the entire page around the slider.

A drag now moves its row's thumb and number box on a local draft
(useSliderDraft) and hands the owner one value when it ends. Keyboard
steps and typed values still commit as they go. Labels such as Off, Max
and Auto take a format callback instead of a fixed displayValue, so
they follow the thumb. What an owner shows beside its slider follows
the drag through onDraft: the VRAM Budget advice and the music editor's
extend tail. The context warning moves into the Context Length row, and
the MLX Context Length box shows the dragged length instead of a dash.

Each move still renders synchronously, as the store write it replaces
did, so the thumb is drawn in the frame the pointer moves. The drag
commits its last move when pointer capture ends, so a release right
behind a move commits that move, and a cancelled touch keeps the value
it reached, as before. The memory estimate and the VRAM Budget save
follow once per drag instead of once per move.

Unsloth Desktop on Windows (WebView2 154), 3 s drags. Temperature in
Run settings: pointermove handler p50 3.41 -> 0.46 ms, max 11.1 -> 0.70
ms, DOM mutations 6,715 -> 1,966, frame p90 8.2 -> 4.2 ms. Context
Length in the model picker: p50 4.48 -> 0.52 ms, max 15.4 -> 0.77 ms,
mutations 6,894 -> 1,276, frame p99 12.5 -> 4.3 ms.
The chat page subscribed to the whole sampling params object, directly
and through useChatModelRuntime, though it reads only the selected
model from it. Every change to temperature, top P, max tokens and the
rest, whether a drag's release, a keyboard step, a typed value or a
preset, re-rendered the chat page's top component and its 600-odd
hooks. Both now subscribe to the checkpoint alone, and the Run settings
panel reads and writes params from the store itself instead of through
props.

Unsloth Desktop on Windows (WebView2 154), six Temperature keyboard
steps: chat page re-renders 6 -> 0, key handler p50 2.8 -> 2.3 ms, max
3.9 -> 2.8 ms.
The model picker's configure page scrolls inside its popover and, like
the rest of the app, draws the custom ::-webkit-scrollbar. With an
auto scrollbar gutter, Chromium re-checked that scrollbar whenever
anything inside the scroller was laid out, and relaid out the whole
configure page twice a frame for it ("Scrollbar changed"). A slider
drag lays the page out on every move, so every frame paid for the
entire page. The Run settings sliders never did, because that
scroller already reserves a stable gutter.

The configure page's scroller now reserves its gutter as well. Nothing
moves while the page scrolls, since the scrollbar already takes that
space. A page short enough not to scroll keeps an empty 8 px gutter,
and toggling Advanced settings no longer shifts every row by the
scrollbar's width.

Unsloth Desktop on Windows (WebView2 154), long thread behind the
picker, Context Length drag: layout per frame 0.58 -> 0.29 ms,
pre-paint 0.21 -> 0.07 ms, frame time p50 4.17 -> 3.18 ms, move to
drawn frame p90 5.10 -> 4.07 ms and p99 6.01 -> 4.36 ms, level with
the Run settings sliders (3.95 and 4.35 ms).
A review of this branch against main found ten regressions it
introduced. Each is fixed here and measured against main and against
the branch before this commit.

- Long code blocks in thinking: every row of a fence formed one mount
  group, so opening or streaming a long fence mounted, coloured and
  laid out all of it at once, and every streamed update asked for the
  colours of every line again. Groups now stop at the chunk budget,
  splitting only where a line starts. A group that starts mid-fence
  gets no leading line break, a group the fence has moved past keeps
  the source it finished with, so only the tail asks for colours while
  streaming, and the worker keeps one copy of a source its groups
  share. 500K-character saved fence: 221,543 -> 4,938 elements, worst
  frame 2.1-2.5 s -> under 0.1 s (main 1,603 elements). 900 lines
  streamed: frames over 50 ms 31-36 -> 2, long frames 3.4-3.8 s ->
  0.3-0.4 s (main 1 and 0.3-0.4 s); 3,000 lines: 51 s -> 0.38 s (main
  0.39 s). WebKit p95 frame 218-439 -> 41-57 ms.

- Menus: the thread's wrapper set pointer-events: auto at all times,
  so the click that dismissed a modal menu, select or context menu also
  pressed whatever lay under it in the thread, and hover leaked through
  while it was open. The override now applies only while
  html[data-panel-resizing] is set, which is when the panel library
  blanks the panels. The dismissing click lands on <html> again, as on
  main, and a split drag still restyles about 27 elements (main
  restyles the whole 60,000-element test thread).

- Streaming text: the measured render cost included the wait for the
  next frame, so a 60 Hz screen rendered every third frame. The cost is
  now the commit itself, and the 16 ms floor is checked against frame
  timestamps instead of a timer. Updates per second 19.7 -> 59.4 in
  Chromium, 19.5 -> 59 in Firefox, 16 -> 55 in WebKit (main 59.4, 59.2,
  56).

- Font changes: skipped code blocks and thinking chunks kept the height
  they had at the old font size, so scrolling back to them jumped. A
  change of UI or code font size, font family or the browser interface
  scale now renders them once at the new metrics, as the desktop zoom
  already did, on every engine. Scroll-in jump 6,623-6,640 -> 0 px for
  the code font size in Chromium, Firefox and WebKit, 3,136 -> 0 for
  the UI font size, 3,923 -> 0 for the interface scale, 186 -> 0 in a
  thinking box.

- Autoscroll: the first pin of a freshly opened thread waited until the
  thread overflowed, however long that took, so a card opened by hand
  in a short chat snapped the view to the bottom. It now resolves at the
  first frame that shows messages. Reopened threads still land at the
  bottom.

- Search images: a running message passed no texts to subject image
  placement, so an earlier part showed a card a later part had already
  placed. The texts pass again whenever the message has search images.

- Highlight worker: the idle teardown of a stalled worker left the
  state stalled, so long fences stayed uncoloured for the rest of the
  session. It now resets to untested.

- Forced colours: a contrast theme painted the low device scale rule's
  transparent 10 px border as a solid bar. The rule now skips forced
  colours.

- Find in page: stepping onto a match whose text a fence's line window
  had just swapped read a stale index and revealed nothing. Next and
  previous now rebuild it first. Steps that missed at 60 ms intervals:
  23/40 -> 0/40 in Chromium, 31/40 -> 0/40 in Firefox and WebKit, as on
  main.

- Pinch zoom: Unsloth Desktop on Windows and Linux armed its wheel
  listener only after a Ctrl keydown, and a touchpad pinch sends
  Ctrl+wheel without one. The desktop listens all the time again, as
  main does. Unsloth Web keeps the narrower listener.

tests/studio/reasoning-transcript-checks.js and
smoke-reasoning-transcript-main.tsx are back to main's version. Main's
first check bounds a saved trace's mounted text below 20,000
characters, which this branch's transcript does not do by design: rows
stay mounted and the engine skips them. Without that one check the
branch passes the other 15, with and without row containment.

general-settings-token-sync.test.ts faked the update banner module
without the audio.cpp functions unslothai#12893 added, so all nine of its tests
failed on main. The fake now has them.
…he Windows gutter

A second review of this branch found more regressions it introduced.
Each is fixed here and measured against main and against the branch
before this commit.

- Long code blocks in thinking: since groups stop at the chunk budget,
  a fence renders as several blocks. A group that ended on a blank
  line lost it, because a trailing line break draws no line, and a
  copy across the seam dropped it in Chromium and WebKit. Firefox's
  copy added a blank line between every two <pre> blocks. Groups are
  now block elements that are not <pre>, carry the code font
  themselves, and end with the line break when the next row starts a
  line. 2,400-line fence with a blank line every 7 lines: 2,395 ->
  2,400 lines drawn, copies across seams exact in Chromium, Firefox
  and WebKit, line pitch across seams unchanged.

- Thinking code colours: a group the stream had moved past asked for
  colours with the source it finished with and got the throttled
  approximation with a plain tail, and the next group's request on the
  same cache entry dropped its queued refresh. Nothing asked again, so
  those lines stayed plain until the thread was reopened: 460-604 of
  2,400 lines after a followed stream, 1,432 after a detached one
  (main and the branch before the previous commit: 0). Every group but
  the growing tail now asks the worker for exact colours, which never
  cancels the tail's refresh, and a group keeps its own source only
  while its fence grows, so a finished fence shares one source again
  and the worker keeps one copy of it. 0 plain lines in Chromium,
  Firefox and WebKit.

- Streaming text cadence: frame times come in whole frames, so the
  16 ms floor rounded up to the next frame and a 75, 90 or 144 Hz
  display rendered every second or third frame (37.5, 45 and 48
  updates per second). The floor now allows half of the measured frame
  interval: 75, 90 and 72 per second, still 60 at 60, 120 and 240 Hz,
  and the spacing by render cost is unchanged. WebKit at 60 Hz: 56.8
  -> 59.5 per second.

- Idle work: the branch made the shared scheduleIdleTask wait for
  300 ms without input where requestIdleCallback is missing, which
  also delayed the settings prefetch, the hub readme and markdown
  previews in Safari and Unsloth Desktop on macOS and Linux (120 ms ->
  up to 250-400 ms). scheduleIdleTask is main's again, and the wait
  moved to scheduleQuietIdleTask, which only the chat's highlighting
  uses.

- Windows gutter: the native thin scrollbar keeps its device size
  under a browser zoom as it does under the desktop zoom, so in
  Unsloth Web the gutter stayed 10 px while the bar was 8 px at 125%
  and 12.5 px at 80% (Windows Chrome). The gutter is now the measured
  bar, measured again whenever the pixel ratio changes, and
  --studio-interface-zoom is gone. Gutter, start border and bar match
  at 80, 100 and 125% on 1x and 1.5x displays.

- Safari 16, and so Unsloth Desktop on macOS 11, has no
  contain-intrinsic-size, so the zoom scale probe measured 0 and was
  inserted again on every measure of a long code block. It is skipped
  there.

tests/reasoning-code-groups.test.ts drives the real highlight worker
and fails on the previous commit.
… and fast-stream following

A third review of this branch found more regressions it introduced.
Each is fixed here and measured against main and against the branch
before this commit.

- Reading position in thinking code: code groups became <div>s in the
  previous commit, so the reading anchor no longer saw their text.
  With only code on screen, narrowing the window from 1280 to 520 px
  moved it 2,559 px in Chromium, Firefox and WebKit. Code groups count
  as passages again: 0.4 px.

- Code font size: a custom size only reached the inner <code>, so the
  block kept the default line spacing (18.89 px at a 10 px setting,
  15.5 px on main). The size rule covers code groups too, as a
  separate selector so existing matches keep their specificity.

- Highlight worker stalls: a caller turned away while the worker was
  late cancelled the idle teardown, so a stalled worker could stay
  stalled for good. Groups whose requests were failed, or that mounted
  during the stall, never asked again, and fences too long for the
  main thread stayed plain until reopened. Turning a caller away no
  longer touches the teardown, and every mounted group asks again when
  a late worker answers.

- Find in long code blocks: find draws its highlights on live ranges,
  and the 240-line window swapped a line's text for token spans as the
  reader moved, so highlights vanished until the index was rebuilt
  (21 of 60 after a scroll, and the active match for about 320 ms
  after Enter; main 0). While the find bar is open a long block
  renders every line, as it does for print, and windows again once
  the bar closes.

- Worker transfers: each group of a long thinking fence sent the
  whole fence to the worker, 28 times for a 250K character stream
  (about 3.6M characters). A group's first request now edits the
  source the worker already holds for that fence: one full transfer,
  as on main.

- Following fast streams: code rows were estimated with the prose line
  height (21.3 px for 18.9 px code lines) and a 16 px footer (12.25 px
  rendered), so mounting them shrank the transcript under a reader
  pinned to the bottom. The browser clamped the scroll position and
  the autoscroll took it for the reader scrolling up. Estimates now use
  the code block's measured line height, font size and footer, and the
  transcript no longer shrinks while it streams. At 512 characters
  every 12 ms the stream stayed followed in 16 of 16 runs (lost in 3
  of 8 before). Firefox and WebKit were unaffected.

- Sliders: a row that unmounts mid-drag, such as the model picker
  closing on Escape, commits the dragged value, as main's live writes
  did.

- Continue on a reasoning-only reply uses main's whitespace check
  again, which the backend guard mirrors, and the zoom comment in
  provider.tsx is back above the function it describes.

tests/highlight-worker-stall.test.ts drives the hook through a stall
and through a fence split across groups, and fails on the previous
commit.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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 pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 12, 2026
@danielhanchen
danielhanchen merged commit e36527d into unslothai:main Oct 12, 2026
Lyxot added a commit that referenced this pull request Nov 5, 2026
…scaling (#16702)

At Windows display scaling below 150%, the chat background shows on the
new-chat screen and in the Settings previews but not in an open
conversation. The low-device-scale scrolling rule from #13255 paints
`.aui-thread-viewport` solid so Chromium will scroll it on the
compositor, and that rule beats the background's translucent thread
fill. The glass backdrop with no image is affected the same way.

The solid fill now applies only when no chat background or glass
backdrop is shown (`html:not([data-chat-wallpaper-ready])`). With a
background on, the thread gives up compositor scrolling at that scale,
because a see-through scroller can't have it. The gutter and overflow
settings from #13255 are unchanged. Linux, macOS and Windows at 150% or
higher never match this rule, which is why they were already fine.

Tested in Unsloth Desktop 0.1.915-beta on Windows 11 at 100% scaling
with Liquid Glass 3D. Before the fix the thread computes to
`rgb(24,24,24)`. After it, the thread computes to the expected
translucent mix and the image shows at the configured "Visibility in
conversations". With the background removed, the thread is solid again.
`tests/desktop-webkit-paths.test.ts` asserts the new split.


**Before / after** (Unsloth Desktop 0.1.915-beta, Windows 11, Liquid
Glass 3D, the same conversation and background in all four, real Windows
display scaling at 100% and 175%). "After" is the installed build with
this PR's CSS change applied in the running page. At 100% the thread
computes to `rgb(24,24,24)` before and to the translucent wallpaper fill
after. At 175% `data-low-device-scale` is off, so the rule never applied
and nothing changes.

![before and after at 100% and 175%
scaling](https://raw.githubusercontent.com/LeoBorcherding/unsloth/215713555190f22940db249b3ce2ccbc3bc2b534/before-after-chat-background.png)

---------

Co-authored-by: Lyxot <[email protected]>
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.

3 participants