Skip to content

studio: show the train run preview as a column on a laptop window - #9762

Merged
mahiatlinux merged 4 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-train-preview-column
Aug 26, 2026
Merged

mahiatlinux merged 4 commits into
unslothai:mainfrom
mahiatlinux:fix/studio-train-preview-column

Conversation

@mahiatlinux

@mahiatlinux mahiatlinux commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

The Run preview card on Train > Configure, and the Start training button inside it, only become a second column when the train-configure container query matches. That container is the page wrapper in studio/frontend/src/features/studio/studio-page.tsx:

mx-auto flex w-full max-w-[1180px] ... px-5 ... sm:px-9

so its width is min(1180, window - sidebar) - 72, and SIDEBAR_WIDTH_DEFAULT in studio/frontend/src/hooks/use-sidebar-width.ts is 280. The @5xl tier added in #7633 is 64rem, which turns into a 1376px window requirement. Below that the card dropped out of the grid and rendered as a full-width row under the wizard, which is what happens on every laptop-sized window: MINIMUM_APP_WINDOW_SIZE is 900px wide and a first run opens at 75% of the work area, so a 1440px display gets a 1080px window and never showed the column at all.

What changed

studio-page.tsx moves the two-column grid and the preview card's sticky positioning down to @4xl/train-configure (56rem) from @5xl (64rem). @5xl/train-configure:gap-10 stays where it is, so the gap is 32px in the new band and widens to 40px once there is room for it.

56rem is the narrowest tier that still leaves the wizard column above its own @md/train-section threshold. At 896px of container the wizard track is 544px, and after the training card's p-5 and 1px border its @container/train-section is 502px against the 448px that tier needs, so the model/method/token row stays two across rather than collapsing to buy the preview its 320px.

Measured in Chromium against CSS compiled from the edited class strings by the repo's own Tailwind 4.2.4:

sidebar before after
280px, expanded two columns from a 1376px window from 1248px
3rem rail, collapsed from 1144px from 1016px

Screenshots

Two isolated Studio installs, one at 55213845e and one at this branch, driven through Train > Configure at 1280x900. Both sides report the same 280px sidebar and the same 928px container, so the only variable is the tier.

Top of the tab. The wizard gives up its full width for the preview column:

before and after, top of Configure

Scrolled to the Run preview card. Before, it sits below Configuration as a full-width row; after, it is pinned beside the wizard:

before and after, the Run preview card

Geometry read from the same servers that were photographed, data-tour="studio-dataset" against data-tour="studio-start":

before after
wizard card 928px wide, x 316-1244 576px wide, x 316-892
Start training 878px wide, x 341-1219 270px wide, x 949-1219
Start top minus wizard bottom +919px -215px
layout stacked two-column

Regression test

studio/frontend/tests/train-configure-preview-column.test.ts reads the tier, the 320px preview track, the gaps, the page padding and SIDEBAR_WIDTH_DEFAULT out of the source, and the --container-* and --spacing scales out of the resolved tailwindcss/theme.css, then holds both ends of the corridor:

  • the tier must be reachable inside the page's own max width
  • two columns must need no more than a 1280px window with the sidebar expanded
  • the wizard column must still clear @md/train-section, the narrowest tier the wizard's own sections use

It also pins the sticky offset to the same tier as the column split, so the preview cannot scroll away inside its own track, and checks that @container/train-configure and @container/train-section are still declared, since every tier it reads is inert without them.

Mutation-checked, restoring the source afterwards:

mutation failure
tier back to @5xl two columns need a 1376px window, budget is 1280px
tier down to @2xl wizard section gets 278px, below the 448px train-section tier
sticky tier desynced preview sticks at a different tier than the 4xl column split
named container deleted or renamed expected one className with @container/train-configure, got 0
preview track to 480px wizard section gets 342px, below the 448px train-section tier
a section tier rewritten as @min-[40rem] unresolvable tier @min-[40rem]/train-section in params-section.tsx

Checks

  • npm test in studio/frontend: 5138 pass, 0 fail
  • npx tsc -b and npx tsc -p tsconfig.test.json: clean
  • npx biome check: studio-page.tsx reports the same two diagnostics as its parent commit; the new test file reports only the noNodejsModules warnings every test in that directory produces
  • two Studio installs built from the two trees, driven at 1280x900, screenshots and geometry above
  • no Python touched, so ruff and pytest do not apply; no training was run, so no GPU checks apply

The Run preview card and its Start training button only split into a second
column when the train-configure container query matches. That container is the
page wrapper, so its width is min(1180, window - sidebar) - 72, and the sidebar
is 280px by default. The 64rem tier from unslothai#7633 needed a 1376px window, and
below that the card stacked under the wizard as a full-width row.

56rem is the narrowest tier that still leaves the wizard column past its own
28rem @md/train-section threshold once the 320px preview track, the 32px gap
and the card's 40px padding come out, so the model/method/token row stays two
across. The second column now appears from a 1248px window with the sidebar
expanded, and from 1016px with it collapsed to the rail.
The threshold is a class name on the design scale, so nothing in the source
says it is really a window-width requirement. The test reads the tier, the
preview track, the gaps, the page padding, the training card's inset and
SIDEBAR_WIDTH_DEFAULT out of the source and out of Tailwind's own scales, then
holds both ends: two columns must be reachable in a 1280px window, and the
wizard column must still clear @md/train-section, the narrowest tier the
wizard's own sections use.

It also pins the sticky offset to the same tier as the column split, so the
preview cannot scroll away inside its own track, and checks that both named
containers are still declared, since every tier it reads is inert without them.
A tier it cannot resolve throws rather than dropping out of the budget.
@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 1e213b55ff

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

@LeoBorcherding

LeoBorcherding commented Aug 26, 2026 •

Copy link
Copy Markdown
Collaborator

Review

Logic and tests both check out. Ran the suite on this branch: 5138 pass, 0 fail. Checked the tier arithmetic against source rather than the body:

@5xl  1024 + 72 + 280 = 1376px window
@4xl   896 + 72 + 280 = 1248px window
wizard track 896 - 32 - 320 = 544, its train-section 544 - 42 = 502 vs @md 448
tier fits the page cap: 896 <= 1180 - 72 = 1108

56rem is the right pick and the argument for it being the narrowest safe tier holds. Leaving @5xl:gap-10 where it is so the gap widens later is a nice touch. Pinning the sticky offset to the split tier, and testing that the two cannot desync, is the part I most wanted to see.

Two small things, neither blocking.

The two numbers in the collapsed-rail row cannot both be right. Only the tier moved, 1024 to 896, and the container stays in the linear regime the whole way (1024 is under the 1108 cap, so nothing clamps), so the window requirement has to differ by exactly 128px in both rows whatever the sidebar is doing. The expanded row is 1376 - 1248 = 128. The collapsed row reads 1176 - 1016 = 160.

Reading the class strings rather than measuring: AppSidebar passes variant="sidebar" and collapsible="icon", so the sidebar-gap element that actually pushes content resolves to a plain w-(--sidebar-width-icon) at 3rem, with nothing else between the rail and the content. That makes 1016 the consistent one and 1144 the correction (1024 + 72 + 48). For what it is worth, 1176 is exactly what inset would give, where the rail is calc(3rem + spacing(4)) and SidebarInset adds m-2 each side.

Worth re-measuring rather than taking my word for it, since I did not render this: collapseToZero={isTauri} collapses that gap to 0 in the desktop app, which would give a different pair again.

#7633 in a source comment, train-configure-preview-column.test.ts:11. The 1376px it carries is the useful half; the reference rots for anyone reading the file without GitHub open.

One thing worth a comment rather than a change: smallestTrainSectionTier reads wizard/ and sections/ without recursing, so it never sees sections/charts/. That is the safe direction and should stay. I injected an @xs/train-section tier into a chart card to check which way it cuts: non-recursive holds the floor at @md 448, recursive drops it to 320 and loosens the assertion. The docstring says "the narrowest tier the wizard actually uses", which reads like an invitation to make it recursive, and that would quietly weaken the test.

Codex is clean on the current head and the logic and tests look good from here, so this is just waiting on CI now.

@mahiatlinux

Copy link
Copy Markdown
Contributor Author

Addressed Leo’s notes in a139849: corrected the collapsed rail table to 1144px, removed the stale issue reference, and clarified that the train-section tier scan is intentionally limited to top-level wizard and section files. The focused test passes.

@mahiatlinux

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: e86bea5bc5

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

Confirmed the tier in studio-page.tsx:245 needs a 1376px window, so a default-sized laptop window never gets the preview column, and the 4xl move plus the sticky-tier pin looks right. Will get this reviewed once CI settles.

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

staged ci passing, codex converged, logic review looks clean. LGTM, will approve

image

@LeoBorcherding LeoBorcherding left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staged ci passing, codex converged, logic review looks clean. LGTM

@mahiatlinux
mahiatlinux merged commit 4bf2b54 into unslothai:main Aug 26, 2026
35 checks passed
@mahiatlinux
mahiatlinux deleted the fix/studio-train-preview-column branch September 25, 2026 05:32
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