Skip to content

Context control in one row with a reset to Auto, context window wording - #17840

Merged
shimmyshimmer merged 4 commits into
mainfrom
studio-context-control
Nov 16, 2026
Merged

shimmyshimmer merged 4 commits into
mainfrom
studio-context-control

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What changed

  • One row. The GGUF context control is now one row, labelled "Context": slider plus number field, like the other settings rows. Spacing is measured from the label text (48px before the slider, 28px after it); the info and reset icons float in that gap.
  • Auto and the maximum. Auto shows as a full bar. Once a number is set, dragging to the far right gives the real maximum, not Auto. A reset icon after the label's info icon (shown only when a number is set) returns to Auto.
  • Reset all. Same text color as Save.
  • "Context window" wording. The tooltip and helper text say "context window", and the remaining "Context Length" labels across the UI (chat settings, training, hub filters, tour, sharing fields, CLI help) now read "Context" or "context window", depending on what fits.
  • Translations. All locales are updated to match.

Verification

  • npm run typecheck, npm test (context-mode, slider and toast advice tests updated), npm run i18n:check:strict, npm run build.
  • Checked in a local build with a GGUF model: dragging from Auto to a number and back to the end gives the maximum (32768), reset returns to Auto, and typing a value leaves Auto.

@shimmyshimmer shimmyshimmer changed the title Context control in one row, Auto at the end, context window wording Context control in one row with a reset to Auto, context window wording Nov 15, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:01:02.590200Z 2675ee4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6494fcfe88

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

Comment on lines +603 to +606
const isMaxPosition = (v: number) => v > max - CONTEXT_SLIDER_STEP;
const toSlider = (v: number) => (v === 0 ? max : v);
const fromSlider = (v: number) =>
isMaxPosition(v) ? (value === 0 ? 0 : max) : v;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow keyboard decrements from an off-grid context maximum

When the maximum is not aligned to the 128-token step, this threshold can map an ArrowLeft decrement straight back to the maximum. For example, entering a custom context of 40000 for a model with a native context of 32768 makes max equal 40000; Radix rounds the next decrement to 39936, but isMaxPosition(39936) is true, so fromSlider commits 40000 again. Repeated ArrowLeft presses therefore cannot reduce the context. Distinguish the actual rightmost position from an ordinary keyboard decrement rather than treating every value within one step as the maximum.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 2675ee4: a keyed move that lands within a step of an off-grid max now counts as a real decrement; pointer drags to the far right still give the max.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 2675ee4102

ℹ️ 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 added a commit that referenced this pull request Nov 16, 2026
…uce order noise (#17896)

## Summary


`tests/test_tp_eval_gloo.py::test_trainer_evaluates_a_tensor_parallel_model_like_one_process[2-2]`
fails intermittently in the `Repo tests (CPU, gloo)` shard on unrelated
PRs (seen on #17701 and #17840):

```
Mismatched elements: 1 / 2016000 (0.0%)
Greatest absolute difference: 1.07e-05 at index ... (up to 1e-05 allowed)
```

The predictions are logits after three training steps. Under tensor
parallelism the row-parallel all-reduce sums partial products in a
different order than the single-process reference, so an element close
to zero can land just past `atol = 1e-5` depending on the CPU and thread
layout. The test was added in #15722 and the check itself is right, the
absolute tolerance is just at the edge of float32 reduction noise.

## Change

- Predictions `atol` goes from `1e-5` to `5e-5` (`rtol` unchanged at
`1e-4`), with a comment saying why.
- The training and eval losses are still compared at `rel = 1e-5`, and
`label_ids` still has to match exactly, so a real sharding or gather bug
(which moves logits and losses by orders of magnitude more) still fails
the test.

## Testing

- `pytest tests/test_tp_eval_gloo.py` on CPU (torch 2.10, transformers
5.17): 3 passed.
@shimmyshimmer
shimmyshimmer merged commit 247029e into main Nov 16, 2026
@shimmyshimmer
shimmyshimmer deleted the studio-context-control branch November 16, 2026 04:10
shimmyshimmer added a commit that referenced this pull request Nov 16, 2026
… PRs (#17900)

## What changed

Comment-only cleanup for the recently merged Studio UI PRs (#17839,
#17840, #17841, #17842, #17846). Restating comments are deleted and
multi-line explanations are cut to one line; comments that record an
invariant or a non-obvious reason stay (for example, why the sticky run
settings row must not be wrapped, and why `modelLoading` alone cannot
mark a fresh load).

- 14 files, 25 lines added, 60 removed.
- No code changes: every changed line is a comment line (checked line by
line over the diff).

## Verification

- `npm run typecheck`, `npm run build`, `npm run i18n:check:strict`.
- `npm test`: passes except two failures that also fail on `main`
without this change:
- `every settings tab sits in exactly one rail group`: the
`computer-use` tab added in #17666 is not in a sidebar group; fixed in
#17901.
- the KaTeX stylesheet import test, which fails only in this local setup
(shared `node_modules` outside the project root).
danielhanchen added a commit that referenced this pull request Nov 16, 2026
…ed Context field (#17902)

## Summary

Two intended Studio UI changes merged without their Playwright drivers
and contract tests being updated, so these gates are red on main and on
every PR:

1. **#17839 collapses the model picker on load.** With a model loaded,
opening the picker shows only that model's row (aria-label `<model>:
show all models`); the source tabs, the search field and the rows render
only after that row is clicked.
- `Chat UI` / `Chat UI, API, Update and GGUF inference`
(`playwright_chat_ui.py`): `model picker search input not found` (seen
on #17839, #17900 and the staging run of #17899).
- On the Windows lane the chat driver instead found an attached but
hidden `Search ... models` field and timed out after 60 s in
`Locator.fill` (staging run of #17899).
- Model config gate (`playwright_model_config.py`): `picker shows no
rows at all, so the hidden-model check below proves nothing`, then
`could not open run-settings`.
2. **#17840 renames the run settings "Context Length" field to
"Context".**
- `Repo tests (CPU, studio)`:
`test_model_picker_contracts.py::test_an_mlx_target_is_offered_a_context_length_not_a_sequence_length`
and `::test_run_settings_page_keeps_its_identifying_controls` still
assert the old label.
- Model config gate: `Context Length input has no numeric default`.
`playwright_memory_estimate.py` finds the field the same way.

Both product changes are deliberate, so the fix is on the test side. No
product code changes.

## Change

- `tests/studio/_playwright_robust.py`: new
`expand_collapsed_model_picker(scope)` waits for either the expanded
picker (the `Model sources` tablist) or the collapsed row, and clicks
the row only when the picker opened collapsed. It is a no-op on an
already expanded picker, and it only counts controls that are on screen,
so a hidden mounted copy is neither clicked nor taken as proof that the
picker expanded. The collapsed row suffix, the tablist selector and the
run settings context field name (`RUN_SETTINGS_CONTEXT_LABEL =
"Context"`) live here once.
- `playwright_chat_ui.py`: the search step expands the picker before
waiting for the search field, and waits for a visible one. The rest of
the step (two queries must show different picker text) is unchanged.
- `playwright_model_config.py`, `playwright_memory_estimate.py`:
`open_picker()` expands after clicking the trigger; `context_input()`
looks the field up by `RUN_SETTINGS_CONTEXT_LABEL` with an exact match,
since `Context` is a prefix of other run settings names.
- `test_model_picker_contracts.py`: the two run settings assertions read
`Context`.
- New `tests/studio/test_chat_ui_picker_collapsed_row.py` (CPU) pins the
coupling between the drivers and the frontend:
- the collapsed row suffix and the `Model sources` tablist are still
what `composer-model-picker.tsx` renders,
- a settled load still collapses the picker (so the expand click is not
dead code),
- all three drivers use the helper, the chat search step expands before
it waits, and `open_picker()` expands after the trigger click,
- `model-config-page.tsx` still names the context field
`RUN_SETTINGS_CONTEXT_LABEL`, and both drivers look it up by that name.

## Testing

- New test plus `test_model_picker_contracts.py`: 213 passed.
- Sabotage: with the three drivers reverted to main, 4 of the new checks
fail; without the on-screen filter in the helper, 1 fails; with the
field renamed back to `Context Length`, 2 fail.
- Every test that reads these drivers or `_playwright_robust.py` (17
files): 345 passed. `tests/studio/test_*.py` on CPU: the only failures
are 5 host-specific tests (AMD DRM detection, credential homes, version
compat sweep) that do not touch these files.
- The helper against a scripted page in real Chromium (Playwright 1.64):
a collapsed picker with hidden copies of the tablist and search is
expanded and its visible search filled; an expanded picker and a page
with neither are left alone; the old attached-only lookup on the
collapsed page times out in `fill()`, as on the Windows lane.
- The Chat UI and model config Playwright jobs on this PR exercise the
drivers end to end.
danielhanchen pushed a commit to LeoBorcherding/unsloth that referenced this pull request Nov 18, 2026
…ebar (unslothai#18235)

## Problem

Since unslothai#17840, the Context control in the Run settings sidebar is
squeezed into one row with its label and value. The sidebar is too
narrow for that, so the slider shrinks to its thumb (16 px wide at a
1440 px window). When a number is set, the reset icon and the thumb
share the same small gap.

## Cause

The model picker's Run settings and the chat sidebar both render
`GgufContextLengthSetting` in `model-config-page.tsx`. unslothai#17840 changed
that component to one row: label, slider with fixed `ml-12 mr-7`
margins, then the value field. The layout was made for the wider model
picker, and the component did not know which surface it was in.

## Fix

- `GgufContextLengthSetting` takes a `stacked` prop. `ModelConfigPage`
passes `stacked={variant === "sidebar"}`.
- When stacked, the label, info icon, reset icon and value stay on one
row, and the slider gets its own full-width row below, like Max Seq
Length.
- The model picker keeps the one-row layout from unslothai#17840.
- The slider's behavior is unchanged: Auto as a full bar, the far right
as the real maximum once a number is set, and reset to Auto.
- `context-mode-ux.test.ts` is updated for the new structure, with a
test that the sidebar uses the stacked layout.

## Before and after

At Auto, the sidebar slider goes from 16 px to the full panel width (225
px):

<img width="592" height="515" alt="Run settings sidebar at Auto, before
and after"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-sidebar-context-row/01_auto-e9a751f659c5.png"
/>

With a number set (16,384), the reset icon stays next to the label and
the thumb shows where the value sits:

<img width="592" height="515" alt="Run settings sidebar with a custom
context, before and after"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-sidebar-context-row/02_custom-2ddee2407b93.png"
/>

The model picker's Run settings are unchanged (same row and slider
position on both sides):

<img width="692" height="370" alt="Model picker Run settings, before and
after"
src="https://raw.githubusercontent.com/oobabooga/unsloth/pr-media/pr/studio-sidebar-context-row/03_picker_unchanged-8085b3568dce.png"
/>

## Verification

- `npm run typecheck` and `npm run build` pass.
- `tests/context-mode-ux.test.ts` passes (8/8). The new sidebar test
fails against main's source.
- Live check in a local build with Qwen3-0.6B GGUF loaded, main's
frontend against this branch's frontend on the same backend:
- sidebar slider width 16 px on main, 225 px on this branch, at Auto and
at 16,384;
- model picker Context row and slider boxes identical on both sides
(slider 175 px).


## Independent before/after check

Two isolated Studio installs (merge base 7c40c0a vs head 4d0a994),
Qwen3-0.6B Q4_K_M GGUF loaded on CPU, 1440x900 window. The Context
slider measures 16 px wide on the merge base and 225 px on this branch,
both at Auto and at a custom value (40,576 tokens).

At Auto:

<img alt="Run settings sidebar at Auto, before and after"
src="https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/18235/pr18235_pair_00_q-28330471968c.png"
/>

With a custom context set, reset icon beside the label:

<img alt="Run settings sidebar with a custom context, before and after"
src="https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/18235/pr18235_pair_01_q-178c1b4f5c59.png"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants