Repository navigation
Studio: open chat HTML in the Browser and remove Canvas - #12804
Conversation
Everything that opened in the Canvas panel now opens as a Browser tab. HTML and code tabs use the normal browser top bar, with the Canvas tools (preview/source, console, run again, copy, download, request edits) kept. - HTML cards show the page title and an "Open in" menu: Unsloth Browser, default browser, code view, copy and download. - "Default browser" serves the page from a one-off backend URL with the same sandbox CSP as the in-app preview. - Removes Canvas mode (composer pill, plus menu, render_html prompt). Network access and HTML block settings move to Settings > Browser. - Compare mode and phones show the Browser over the chat. - Uploaded HTML files use the code icon.
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
… browser overlay modal
…t preview pages, safe prelude placement
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35ba450c0b
ℹ️ 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".
| const bytes = kind === "html" ? blob.size : MAX_TEXT_BYTES; | ||
| void blob.slice(0, bytes).text().then((value) => active && setText(value)); |
There was a problem hiding this comment.
Bound full HTML decoding before rendering
For a large HTML file opened from an attachment, Library, or sandbox, using blob.size here decodes the entire blob into React state; ArtifactHtmlFrame then creates another full artifactHtml string and structured-clones it into the iframe. Accepted text attachments can already reach 20 MB and the Browser store supports blobs up to tens of megabytes, so this can allocate several full copies and freeze or exhaust the renderer. Preserve complete documents by rejecting them above an explicit preview limit rather than decoding every HTML blob unconditionally.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: HTML now runs whole by design, a few copies of a 20 MB string is well inside what the renderer handles, and a cap would bring back the cut pages this PR removes.
| export function htmlDocumentTitle(code: string): string | null { | ||
| const match = /<title[^>]*>([\s\S]*?)<\/title>/i.exec(code); |
There was a problem hiding this comment.
Ignore title-like text outside the document title element
For HTML containing title markup inside a comment, script string, or template before the real document title—for example <!-- <title>Draft</title> --><title>Actual</title>—this regex selects the non-structural text. The artifact card, Browser filename, and tab identity then display “Draft” even though the rendered page title is “Actual.” Extract the title with an HTML-aware parser or at least skip comments and raw-text elements before matching.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: a <title> inside a comment ahead of the real one is an exotic input, and the only effect is the card label.
| // Sandboxed page frames stay outside the trap: same-origin access would weaken their isolation. | ||
| const FOCUSABLE_SELECTOR = | ||
| 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'; |
There was a problem hiding this comment.
Include the active page frame in the overlay tab order
In phone and compare-mode Browser overlays, the active HTML or fetched-page iframe is natively focusable but is omitted from this selector. Since the iframe follows the Browser chrome in DOM order, pressing Tab on the last chrome control makes the custom trap wrap directly to the first control instead of entering the page, so keyboard-only users cannot reach links, buttons, or forms inside the preview. Including the iframe itself as a trap boundary does not require reading its cross-origin contents and preserves the sandbox.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing: the removed Canvas overlay kept its sandboxed frames outside the trap in the same way, so this matches existing behaviour.
…t opens A project view has no side pane, so a card opened there set the browser open with nothing on screen. Show it as the overlay when it was opened from the project. Research outranks the browser in the side pane, so a new browser open now closes Research instead of leaving the card marked as shown. Also drops a duplicate doc comment, an orphaned comment and stray indentation.
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…tests Locale parity runs strict in CI, so the strings rewritten for HTML pages get translations in every overlay instead of falling back to English. The token recount and research layout contracts now pin the post-Canvas behaviour.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1063c92d2a
ℹ️ 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".
| export function stageEditsPrompt(prompt: string): void { | ||
| useChatArtifactsStore.getState().stageFixPrompt(prompt); |
There was a problem hiding this comment.
Route staged edits into the compare composer
When an HTML page is opened from a compare pane, browserPanelAvailable() is false, so Request edits or Fix with model stages the prompt and closes the overlay here. However, compare mode renders SharedComposer, which never calls useStagedFixPrompt; the only consumers are the inactive hidden SingleContent and ProjectLanding. The action therefore appears to discard the edit request, and the pending text can later be inserted unexpectedly when the user exits compare. Add a consumer for the shared compare composer (or route the prompt directly to it) before closing the overlay.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not a bug: compare renders SharedComposer (CompareShell), which consumes pendingFixPrompt in its own effect (shared-composer.tsx, the pendingFixPrompt useEffect) and appends it to the compare text.
…#12868) - Python floor (workflow-trigger lint, Source lint): #8561 imports compression.zstd (3.14) inside a try whose ImportError falls back to zstandard. That except is the guard; mark the import novermin, as the repo does for its other guarded above-floor imports. - Frontend typecheck: #12804 renamed the chat-canvas-network scroll target to browser-html-network on the browser tab, and settings-deep-open-requests.test.ts still used the old name. - ui-font-size-scales-spacing: #12852 added two w-[26px] cells to the browser address bar; scale them with --ui-space-scale like the rest of that bar. - Chat UI permission step: #12855 replaced the Sandbox Low/High switch (menuitemcheckbox) with a Sandbox chip that opens a level picker. The step now reads the chip and picks High from the picker, keeping every assertion about what Low, High and the setup popup do.
* Chat: keep long replies scrolling smoothly while they stream
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.
* Chat: keep very long threads responsive with every thinking box 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.
* Chat: fill long thinking traces without moving the reader, on every engine
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.
* Chat: attach files dropped on a message again, keep the split's contract
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).
* Chat: fit upstream's Browser overlay and 12px code font
Upstream's Browser overlay (#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 (#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).
* Chat: step the thread's width layout without a size container
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.
* Chat: keep skipped blocks sized right across a desktop zoom
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.
* Chat: keep code highlighting off WebKit's main thread
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.
* Chat: keep a streaming reply followed on WebKit past a long code block
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).
* Chat: keep the split drag and find-in-page out of the reader's way
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.
* Chat: shrink the reasoning widening step where commits run long
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).
* Chat: keep the desktop titlebar's backdrop dim from restyling the window
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.
* Chat: scroll the thread on the compositor below 1.5x device scale
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.
* Chat: write the corner insets to their consumers, not <html>
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.
* Chat: keep a closed floating monitor out of panel drags
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.
* Chat: key the table toolbar rules on the toolbar, not its position
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.
* Chat: test the parent before a child's position or sibling
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.
* Chat: keep the desktop sidebar's edge strip mounted across pins
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.
* Chat: end a panel drag that loses pointer capture
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.
* Chat: scan for overlays over a native page without walking the thread
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.
* Chat: let the browser page yield to its snapshot while the split is dragged
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.
* Chat: keep a split drag from restyling and re-measuring the thread
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.
* Chat: keep the browser page below its toolbar while the split is dragged
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.
* Chat: keep a slider drag inside its own row
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.
* Chat: re-render only the Run settings panel for a sampling change
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.
* Chat: keep a model picker slider drag from re-laying out the page
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).
* Chat: fix review findings in thinking code, streaming, menus and zoom
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 #12893 added, so all nine of its tests
failed on main. The fake now has them.
* Chat: fix thinking code seams and colours, fast-display cadence and the 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.
* Chat: fix thinking code anchoring, find in long code, worker recovery 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.
* Chat: fix checkpoint skips, thinking trace reading position, highlight sources and two-finger sliders
A fourth review of this branch found more regressions it introduced.
Each is fixed here and measured against main and against the branch
before this commit.
- Checkpoint saves: they were skipped whenever the thread had a durable
run, including one the server had named earlier and that a stalled
or failed recovery left behind. A Continue, an image turn or an
external provider then streamed with no saves at all, so closing the
tab lost the reply (main saved every 8 s, capped at 30 min). Saves
are now skipped only while this tab streams its own admitted run,
which the server keeps. The cap is unchanged.
- Reply below a thinking box that is still filling: when only the
box's placeholder was on screen, nothing held the reply, and mounting
rows there moved it 131 px in Chromium and WebKit and up to 919 px
in Firefox (main 0.4 px). A box that starts above the viewport and
ends inside it now keeps its bottom edge in place: 0.6 to 1.1 px in
all three.
- Rewrites that are not an append, such as a closing think tag split
across two chunks: every row got a new key, the mount started over
and the reading position was lost (6,920 px on a static rewrite,
main 16 px; 48 paragraphs on a stream, main 18). The reader's row is
now found again by its place in the trace and mounted with the rows
under it before the next paint: 0 to 1 px in Chromium, Firefox and
WebKit. A reader following the stream is unaffected.
- Highlight sources: after a failed reply the worker drops that
client's source, but the hook still sent the next request as an edit
of it, so the fence stayed plain. A failed reply now forgets the
client's sources, as unmount does.
- Sliders: lifting the first of two fingers ended the drag and the
second finger's moves were ignored (main followed it). The drag now
ends when the last pointer is released and commits once.
- The Windows hover scrollbar rules were already covered by the
important universal rule, so they are removed, and a stale comment
about smooth scrolling at run start is gone.
tests/run-checkpoint-live-run.test.ts, the new cases in
reasoning-mount-controller, highlight-worker-stall and slider-draft
cover these and fail on the previous commit.
* Chat: fix near-end thinking rewrites, long code block hops and slider saves on unmount
A fifth review of this branch found more regressions it introduced.
Each is fixed here and measured against main and against the branch
before this commit.
- Rewrites near the end of a thinking trace: after a rewrite that is
not an append, such as a closing think tag split across two chunks,
the trace mounts again from its first rows and the rest is held by
estimates that are lower than the rendered height. A reader near the
end was clamped to the bottom, the hold measured from the transcript
and missed it, and autoscroll started following again (-6,949 px at
97% of a static rewrite, -10,985 px at 90% of a stream; main +16 px
and about 5 paragraphs). The reader's row now keeps its place on
screen across the restart and across the commit that mounts the rows
under it, where Chromium's scroll anchoring on the reply below moved
the page again. 0 to 1 px in Chromium, Firefox and WebKit, and a
reader following the stream still follows.
- Finding the reader's row after such a rewrite: a stream holds a code
fence as code rows of 16 lines, while the full parse after the
rewrite can hold the same fence as one prose row, and the paragraph
after it then starts one character later. The row was not found and
the reader was lost. The row is now matched by its place, or by the
row that holds its first character, and when a fence changes between
code rows and a prose row the passage count carries the fence's
earlier lines. A reader inside a 120-line fence: -1,152 px before,
-22 px now in Chromium and Firefox.
- Long code blocks: content-visibility sat on the code body, which
scrolls horizontally. Skipped, it lost its scrollbar in Chromium and
its padding in Firefox, so a block over 240 lines moved the page
10 px when it entered or left the viewport, and the blocks above the
reader moved it again when the find bar opened or closed (main 0).
Containment now sits on a plain box around the body, and the body is
not measured while it is skipped. 0 px in all three, with the same
layout cost on resize and scroll.
- Sliders: when a subtree unmounts, a parent's passive cleanup runs
before its children's, so the VRAM Budget row flushed before the
slider committed a drag cut short by Escape, and the value was saved
400 ms later on a row that was gone. The slider now commits in a
layout cleanup, which runs before any passive one.
- Highlight worker: an edit of a source the worker no longer holds is
answered with a failure instead of being applied to an empty string.
- Cleanup: a stale autoscroll comment is corrected, the live run check
and the part separator each have one definition, and widenRows and
REASONING_ROW_CONTAINMENT_GLOBAL, used only by tests or not at all,
are removed.
New cases in reasoning-mount-controller, reasoning-code-groups and
slider-draft cover these and fail on the previous commit.
* Chat: show thinking code as plain text and stop restyling growing blocks
Thinking code is now plain text on purpose. Colouring it kept the
frame rate but doubled main-thread work while a trace streamed, and
the thinking box should cost as little as possible. Code in answers
is still coloured.
- Thinking box: code rows in long traces are plain text, and fences
in short traces and in the trace's prose rows use the plain code
block. No grammar work and no worker requests. The copy button and
language label stay. A 60K-character thinking code stream in
Chromium now takes 7.2 s of main-thread work, against 16.3 s when
coloured and 26.6 s on main.
- --unsloth-fence-height and --unsloth-chunk-estimate are registered
as non-inherited. Each write restyled every element in the code
block or thinking chunk, so a long streamed block paid 20 to 45 ms
per line. Streaming 200 lines onto a 3,000-line block: style recalc
6.2 s before, 0.08 s now (main 0.07 s).
- Removed with the colouring: the thinking highlight hook and its
helpers, reasoning-line-tokens, the worker's base and exact
requests, and FenceLine's inline option. The worker still colours
long answer fences.
- The highlight worker fails only the listeners that were waiting
when it stalled.
- general-settings-token-sync.test.ts now matches upstream's fix.
Tests for the removed code are dropped. New cases pin the plain
thinking code and the two registrations.
tests/studio/reasoning-transcript-checks.js now fails its check that
less than 20,000 characters are mounted 600 ms after opening a saved
trace. The first render is unchanged (3,058 characters). Plain rows
only mount faster, about 40K by 600 ms, and the previous commit also
passes 40K by 800 ms.
* Chat: fix thinking code selection, equation numbers and streaming pauses
Another review of this branch found more regressions it introduced.
Each is fixed here and compared against main and against the branch
before this commit.
- Selecting thinking code while it streams: a code block in a short
trace and each code row in a long one were a single text node, so
every update rewrote it and cleared the selection. 16 characters
selected dropped to 0 on the first update in Chromium, Firefox and
WebKit, while main kept them. Each line and each line break is now
its own text node, so only the growing line changes. This also
fixes a 40 px jump when a trace passes 16,384 characters with the
first visible line at the end of a code row. The saved reading
position could span a line break that the transcript does not join,
and now stays inside one line (0.3 to 0.5 px).
- Numbered equations: dropping the size container from the thread
root also dropped its style containment, which kept KaTeX's
equation counter from running across messages. A fourth message
with one equation showed (4). The root now has contain: style and
every numbered equation reads as it does on main, in all three
engines. A WebKit width change stays at 1 ms (83 ms with the old
container).
- Streaming pauses: the render cadence timed everything from the frame
to React's commit, so an unrelated long task counted as render cost.
After a 400 ms task the text paused another 817 ms (main 20 ms). The
render now runs in a task posted after the frame and is timed on its
own, and the text resumes after 18 ms. On a 200K character answer,
main-thread time goes from 75.3% to 77.0%, since other work no
longer holds renders back.
- Background tabs: the pin to the bottom waited for a frame, which a
hidden tab never draws, so a reply that ended there showed 8,376 px
above the bottom for one frame on return. While the document is
hidden, a change now pins at once, as it does on main.
- Long answer code: a block over 20,000 characters waited for the
worker when it finished, leaving its last lines plain for up to
300 ms in Chromium and 1 s in WebKit. When 512 characters or fewer
are left uncoloured, the main thread colours them at once, in 1 to
2 ms in WebKit. Longer tails still go to the worker.
- Run settings: a slider that unmounted mid-drag in the same update
that changed the model committed from its last render and switched
the model back. Commits now read the current settings from the
store.
- Chat split: a window blur ended our side of the drag while the panel
library kept dragging, so the final width was not saved and the
browser panel could close. The drag now ends when the library's
does.
- Cleanup: removed the transcript's print upgrade call and its export,
which had nothing left to upgrade, the unread data-reasoning-row
attribute and the deferred marker on plain thinking blocks.
child-selector-order.test.ts no longer adds three unused rules to
the production CSS. An upstream comment about Streamdown's
scheduling is back above the constant it describes.
Tests pin each change, and all 11,148 frontend tests pass.
* Chat: fix thinking box streaming cost, slider commits and the split press
Another review of this branch found regressions it introduced. Each is
fixed here. The performance changes are measured on production builds
against main and against the previous commit.
- Thinking code while streaming: the previous commit made each line of
a code row its own text node, and every update re-rendered every
mounted row. Code rows are now memoised, so only the growing row
renders. A 1M character code trace in Chromium: 18.2 s of main
thread before, 6.6 s now (main 32.6 s). Firefox's slowest 5% of
frames: 83 ms before, 17 ms now (main 17 ms).
- Long mixed traces: every update estimated the height of every row
again and re-rendered every mounted chunk. Estimates are now kept per
row, and a closed chunk renders again only when one of its rows, its
estimate or its slices change. A slice that is still being written
says so, so the copy button of a fence that ends mid-stream is
enabled with the whole source. A 500K character trace in Chromium:
13.1 s before, 8.7 s now (main 9.1 s), and the stream ends 0.8 s
sooner. Firefox's slowest 5% of frames: 83 ms before, 17 ms now
(main 17 ms). The rendered DOM is identical to the previous commit,
and a selection in streaming code is still kept.
- Sliders that other text reads: commits wait for release on this
branch, so the music Variations reload notice and the Edit page's
Generate hint and "How edits apply" text showed the old value during
a drag. These three sliders commit on every move again, as on main.
None has more than 16 positions.
- Sliders and outside changes: a release wrote the dragged value over a
change that arrived after the last move, such as a model load while
the thumb was held still. The release now commits only when the value
is still the one the last move saw, so the newer change wins, as on
main.
- Chat split: a press added the drag overlay, which a native browser
page counts as covering it, so a plain click hid the page behind its
snapshot and showed it again. The press now only marks the drag,
which keeps the thread's pointer events while the panel library
blanks both panels, and the overlay comes once the pointer has moved
4 px.
- Streaming code blocks windowed their lines whatever the fence mode,
so "off" no longer restored main's rendering. They follow the mode
again, as on main.
- The blocking screen, find bar and browser overlay flags are set in a
layout effect, so a startup screen raised by a background update no
longer paints for a frame under the find bar.
New cases in reasoning-mount-controller, slider-draft,
panel-drag-overlay, code-fence-mode and interface-zoom cover these. All
11,153 frontend tests pass.
* Fix frontend interaction and cache regressions
Preserve slider commits after input edits and capture loss. Read the latest reasoning code for copy and download actions.
Scope scrollbar gutter updates, bound find refresh delays, and invalidate shared thread reads after settings updates. Skip fence measurements while content is hidden and clarify print behavior.
* Fix reading position after thinking segment rewrites
Detect rewrites across all thinking segments and preserve the reader's position. Add regression tests for rewrites, appends, and segment removal.
Restore the upstream print comment with the budget limit and fix the rollback test stub indentation.
* Fix viewport media gating and desktop wheel handling
Keep breakpoint gates current during resize and reload. Handle comments
in selector lists and resolve the boot script against Vite's base path.
Keep desktop zoom wheel events cancellable when Ctrl keydown is missed.
* Fix transcript resize anchoring and panel subscriptions
Keep the answer in place while thinking rows are remeasured after a width change, accounting for native scroll anchoring and fractional rounding.
Share panel width listeners until the last subscriber unmounts. Remove redundant wheel listener cleanup and update the related tests.
* Parse viewport media gates with PostCSS
Replace the hand-written CSS scanner in the viewport media plugin with
postcss and postcss-selector-parser. The generated CSS and boot script
are unchanged.
Leave a media block as written when one of its selector lists does not
round-trip through the parser, so invalid selectors stay invalid. Leave
a stylesheet that cannot be parsed ungated with a warning instead of
failing the build. Return a source map when build source maps are on.
Add postcss and postcss-selector-parser as dev dependencies at the
versions already in the lockfile.
* Keep desktop shell work off the chat and its scrollbar
Watch modal changes for menu shortcut availability only where the
native app menus exist, on macOS desktop. Other desktop builds no
longer rerun every shortcut claim on each body mutation.
Read the sidebar width from its own store instead of the sidebar
context, so a width change no longer re-renders every context
consumer.
Start the chat scroller below the custom titlebar so the titlebar no
longer paints over its scrollbar, and reset the offset in the docked
chat.
* Keep desktop wheel scrolling on the compositor thread
On Windows and Linux desktop every wheel scroll in the chat waited on
the main thread, so painting and styling maths during a scroll dropped
frames. Two things caused it.
The interface zoom kept a blocking wheel listener on the window at all
times. Use the same gating as the browser build: arm the blocking
listener only while Ctrl or Meta is held or the pointer is over a zoom
scope. A passive listener arms it when a Ctrl+wheel arrives after a
missed keydown, so only that first notch scrolls, and a plain wheel
disarms a listener left armed by a missed keyup. macOS keeps the
listener armed because a pinch reaches its zoom scopes without a
keydown.
The pinned sidebar edge decoration in the custom titlebar was a box
from the sidebar edge to the window edge at full height, laid over the
chat, so the compositor could not resolve the scroll target. Draw the
edge below the corner as a border on a zero-width element instead. The
screenshot matches in both themes.
In a long maths chat with both thinking boxes expanded, scrolling up
from the bottom dropped 40% of frames before and 0 to 1% after.
* Pin the desktop titlebar contract to the zero-width sidebar edge
17806ce539 drew the pinned sidebar edge below the corner as a border on
its own zero-width element instead of a full-height box over the chat,
but the desktop reliability contract still pinned the old box, so
test_expanded_titlebar_button_and_corner_match_sidebar_edge failed.
Pin the corner border and the separate edge element instead.
* Fit upstream's dark menu glow, continuation and compaction changes
Adaptations of this branch to the code the origin/main merge brought in.
- Dark menu glow (#13013): the dialog and picker context rules used
`body > dialog ~ * :is(menus)`. Evaluating that `~` flags <body>, and
with KaTeX's MathML on the page every later insert at the start of
<body> (Radix focus guards on each modal or menu open and close)
restyled the whole page, even after the menu closed. Card dialogs and
the model picker now hand their surface to the menus opened inside
them through a context, the menu primitives stamp it as
data-dropdown-glow, and the CSS keys on that attribute. With the built
stylesheet, a focus guard insert in dark mode with maths now restyles
1 element instead of the whole page (7,514), and the menu's glow,
accent, background and shadow compute identically in the card,
picker and plain contexts.
- child-selector-order guard: normalise whitespace before splitting
combinators, and flag a `+` or `~` whose right side names no element
in any position, including inside :is()/:where()/:not()/:has(). The
old check only caught two of the three glow rules, by accident of
their line breaks. upstream's modal-open-restyle test now pins the
attribute form instead of `~ *`.
- useContinuation: upstream's Gemini replay rewrite read message.content
on every token of a streaming reply; read it only once the reply is
no longer running, as the reasoning selector already does.
- Remove compaction-notice-owners.ts and its test: upstream's
compactionNoticeMessageIds in message-derived.ts is the same walk and
is what AssistantMessage uses after the merge.
- titlebar-modal-layering: ignore CSS comments when checking for a
:has() on the document root; upstream's comment names body:has().
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Escape viewport boot script data for HTML safety
Escape HTML delimiters and Unicode line separators after JSON serialization. Preserve the runtime values while keeping the generated external script safe if it is later inlined.
Add regression coverage for script-closing tags, quote and backslash payloads, control characters, Unicode separators, and viewport range queries.
* Render code block line windows and streaming highlights in smaller pieces
Scrolling past a finished code block moved its line window with a plain
state update, so React rendered the new lines and removed the old ones
in one blocking task. That update now runs in a transition when the
viewport kept its size, which lets React yield between pieces. Streaming
fences, the first measure, print, find and resize keep the synchronous
update. On a 4x slower CPU, scrolling the long chat with thinking
collapsed went from 8 to 12 frames over 50 ms down to 4 to 6.
The throttled highlight refresh tokenized every newly completed line of
a streaming fence in one call. When a reply opened its first script
block, the embedded gramm…
## Summary Removes 22 image files that nothing in the repo loads, on any surface: the Studio web UI, the Desktop app (macOS, Windows, Linux), the installers, Docker and the wheel. No user-visible change. All but `react.svg` ship today: Vite copies `public/` into `frontend/dist/`, which goes into the wheel, the Desktop bundles and the Docker images. Against the published `unsloth-2026.10.7` wheel (30.95 MB) this takes 2.40 MB off the download. Removed: - `studio/frontend/public/Sloth emojis/`: 16 stickers that are not in the profile avatar list (`sloth-avatars.ts`), the chat greeting, the login or 404 screens, or the JupyterLab sticker list in `docker/jupyter/install_sloth_stickers.py`: `241024 Sloth Drink Jus.png`, `251008 Sloth Pin.png`, `FO2C6766BA42 Sloth Gift.png`, `FO71A40FA5581 Sloth and Llama.png`, `Sloth w Gameboy Confetti no Logo.png`, `Sloth w PC Confetti no Logo.png`, `Sloth w PC no Logo.png`, `UnSloth Eat GPU Mouth.png`, `UnSloth Eat GPU.png`, `UnSloth Laptop.png`, `large sloth laugh.png`, `sloth huglove large33.png`, `sloth pc emoji.png`, `sloth rounded.png`, `sloth w pc transparent.png`, `sloth with gameboy.png` - `studio/frontend/public/hub/profile/logo/Qwen.svg`: the Hub uses `qwen.png` for Qwen - `studio/frontend/public/provider-logos/misc/perplexity.png` - `studio/frontend/public/logotext.png` - `studio/frontend/public/vite.svg` and `studio/frontend/src/assets/react.svg`: Vite template leftovers; the favicon is `favicon.png` - `studio/src-tauri/icons/tray-icon.png`: the 18 px tray icon. The tray embeds `[email protected]` on macOS, `tray-icon-color.png` on Windows and Linux, and `tray-icon-dark.png` / `tray-icon-light.png` for the macOS appearance switch; `include_image!` takes an exact path, so the 1x file was never picked up ## How unused was established - Every tracked file was searched for each asset's file name, raw and URL-encoded, with word boundaries so `Hellix-SemiBold.woff` does not count as a hit for `.woff2`. That covers the frontend, backend, `tauri*.conf.json` (base, macOS, Linux, Windows), NSIS / AppImage / dmg packaging, `install.sh`, `install.ps1`, Dockerfiles, workflows, `pyproject.toml` and `MANIFEST.in`. - Checked for paths built at runtime (template literals over `public/` folders, `import.meta.glob`, directory listings): none reach these files. - Saved profile avatars: the avatar picker list has never offered any of the removed stickers (full `git log -p` of `sloth-avatars.ts`), so no stored `avatarDataUrl` can point at one. - Open PRs: grepped the heads of all open same-repo PRs. The only hits (`sloth w pc transparent.png` in #10346, `sloth rounded.png` in #5108) are old main code those branches inherited from their merge base; neither PR touches `studio/frontend`, and main already dropped both usages (#12804 removed the Canvas surface). - Other unslothai repos: GitHub code search for each name returns nothing. ## Deliberately kept - `images/`: about 20 of its files are not referenced in this repo, but the folder is hotlinked from outside it. The notebooks repo links `Merge.png`, `Assistant.png`, `Terminal_Type.png`, `Where_Terminal.png`, `start free finetune button.png` and `Documentation Button.png`; Hugging Face model cards link `buy me a coffee button.png` (88 of 737 sampled unsloth cards), among others; older READMEs still shown on PyPI release pages link the rest. Removing any of them would break those pages. ## Verification - `studio/frontend`: `npm run typecheck` clean, `npm test` 13730 passed / 0 failed, `npm run build` clean; the built `dist/` references none of the removed names. `npm run biome:check` errors are the existing ones on main (non-blocking in CI) and biome does not read image files. - `tests/studio/test_pwa_manifest.py`, `tests/test_installer_shortcut_icons.py`, `tests/studio/install/test_package_discovery.py`: 19 passed, 2 skipped. - Staging CI across macOS / Windows / Linux with the Playwright leg (link below once green). Not run from this host: a Desktop build. The Tauri bundle config and the tray `include_image!` paths do not reference the removed files.
Summary
Removes the Canvas panel. Everything that used to open in Canvas now opens in the Browser, and the Browser keeps all of the Canvas tools.
HTML and code open in the Browser
htmlblocks) open as a Browser tab. Reopening a card focuses its existing tab.New HTML card
<title>with an "HTML preview" subtitle and an accent colored globe.Default browser
POST /api/inference/artifact-preview-pagestages the HTML and returns a one-off path (1 hour, 8 MB per page). Limits are per account (32 pages, 64 MB) so one account cannot evict another's pages, with a total bound of 512 pages and 512 MB.GETserves it with the in-app preview CSP plussandbox, so the page runs in an opaque origin and cannot reach Studio cookies, storage or the API. The network access setting carries over.crypto.randomUUIDfallbacks are injected, as in the preview frame shell. They go right after a leading doctype, or first when there is none, never after a later<head>that could be text inside a script or comment.Canvas removal
render_htmltool request. Old chats saved with Canvas on restore without it.Smaller fixes
Testing
npx tsc -bpasses.npm test: all pass exceptcolor-themesandfind-in-page, which also fail on main.pytest tests/test_artifact_preview_page.py tests/test_artifact_preview_frame_csp.pypasses.Before / after
Same seeded chat (a fenced
htmlblock with<title>Solar System Orbits</title>) on the merge base and on this branch. Clicking the card: Canvas panel before, a Browser tab after.The card now shows the page title and an "Open in" menu.
Default browser, measured in Chromium:
POST /api/inference/artifact-preview-pagereturns 405 on the merge base and 200 here; the served page runs its script withself.origin == "null"and cannot read Studio's stored tokens.