Skip to content

feat(webui): split Settings into scoped tabs with typed live controls - #1928

Merged
inureyes merged 9 commits into
mainfrom
feature/issue-1917-settings-sections
Sep 19, 2026
Merged

inureyes merged 9 commits into
mainfrom
feature/issue-1917-settings-sections

Conversation

@inureyes

@inureyes inureyes commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Closes #1917. Part of #1910.

Settings was one 5,700 px scroll with every live value as a raw text field (f32 noise, the literal null, free-text enums and booleans). It is now four tabs under one PageHeader, each addressed by a hash: #settings/appearance, #settings/requests, #settings/model, #settings/server. A bare or unknown section opens Appearance; tab changes use replaceState, so Back leaves Settings. Links open the tab they mean (Models pending profile to Model, Chat sampling note to Requests).

What changed

  • Typed live controls (setting-control.tsx): bool Toggle, enum Select (an out-of-list current value stays as a disabled option), text, int and float number inputs, JSON textarea checked on blur, and a "Leave unset" toggle for _or_null kinds that stages null. The draft stays text and parseSettingInput is still the only validator, so apply, reject retention, fingerprint and reset flows are unchanged. Groups: Sampling, DRY, Diffusion, Template, Other, by name prefix.
  • Unapplied live drafts survive a tab switch (only the active tab is mounted). A restored draft keeps the fingerprint it was written against; if the settings moved meanwhile, the existing conflict notice appears and Apply must be pressed again.
  • formatSettingValue: shortest decimal that round-trips through Math.fround, capped at 7 significant digits.
  • Resolved request values: resolveEffectiveParameter (override, session, server, unknown) and one shared wording drive the Requests tab and the Chat "Inherited" hint. Chat sends no new request; it reads the server defaults Settings last read, keyed by server instance, model id and revision.
  • Server tab: startup values as text in a dense list, server reason strings behind a disclosure, context as a definition list, a /props-unavailable banner.
  • Copy: labels and help for the 23 known live settings are catalog-owned in both locales (unknown names fall back to the raw key and server help). Contract prose moved to docs/webui/settings.md, reachable from help tooltips. Korean Settings copy says 대화 where the screen does. Toggle is now a shared primitive, named by its label alone.

Measured on the bundled binary

Server built from 619eed33 with the embedded bundle, qwen3-0.6b-4bit loaded and Ready, --settings --props --metrics --slots (110 schema entries, 23 mutable). Before is main 835a5527's UI against the same server and data. Height is scrollHeight; inputs count input, select, textarea in main; words count main's text.

1440x900 height 390x844 height Inputs Words
Before (one page) 5,681 px 7,407 px 128 745
Appearance 900 px 939 px 3 38
Requests 900 px 1,263 px 7 105
Model 1,699 px 4,088 px 29 397
Server 1,638 px 3,605 px 1 370

Every tab is under two viewport heights at 1440x900, with no horizontal overflow and a clean axe run on each tab at both widths. The before page shows the literal null; no tab does.

  • default_temperature reads 0.8 in a number input; every float shows at most 7 significant digits (0.8, 0.95, 0.05, 1, 0, 0, 0, 1.75, 0.9).
  • diffusion_sampler is a Select with exactly entropy-bound and confidence-threshold. All 23 controls match their kind: floats step=any, ints step=1, arrays and objects a JSON textarea, the three _or_null entries with "Leave unset". The live schema has no mutable bool.
  • Applying default_temperature 0.7 read back 0.7; restoring it read back 0.8 in the UI and 0.800000011920929 from /settings.
  • With a session temperature of 0.5, all seven Requests hints equal the Chat hints (40960, 0.5 (session default), 0.95, 40, 0.05, 1, not set; the rest are server defaults).
  • #settings/server opens the Server tab; after switching tabs, Back returns to the route before Settings.

Mock runs with the same schema shape also hold at 195 px without horizontal overflow and are axe clean in glass-dark and dark Korean.

Changes during review

  • A non-nullable field no longer locks when null is typed into it.
  • The restored-draft fingerprint recheck above, and a 32-entry cap on retained drafts.
  • Server-default records include the server instance, since a restart can reuse model id and revision.
  • Live-setting name lookups use Object.hasOwn, so a schema name such as constructor cannot reach the error slot.

Notes for review

  • live-settings.test.tsx changed beyond selectors in one assertion: it checked a read-only reason string that now renders on the Server tab, so it checks the staged reset values instead.
  • chat.params.server_default is no longer referenced; it is left in chat/strings.ts to keep the concurrent Chat redesign's merge mechanical.

CI note (GB10 Activity gate)

The WebUI installed artifact job on 619eed33 failed three attempts (run 35451205090) at the same point: the "Run Activity performance gate" step's precheck reported GPU compute processes are already present before Activity gate, so the gate never measured anything. Every other step of the job passed on each attempt, including the real-router browser harness, "Verify the installed Rust artifact serves the bundled WebUI", the loopback reverse-proxy check and both installed artifact builds. The precheck has failed for every PR since run 35449824150 was cancelled at 14:59:53Z while inside the Activity gate step, which points at a GPU process left behind on the runner by that cancelled step rather than at this change. This PR changes the Settings screen only and does not touch decode or the Activity page, so per the maintainer's decision for this epic it merges with this evidence recorded; the gate noise itself is tracked in #1925.

Settings was one scroll holding appearance, request defaults, the next-load profile, observed context and every live and startup value, with live values shown as raw text fields (f32 noise such as 0.800000011920929, the literal null, free-text enums and booleans).

Settings now renders Appearance, Requests, Model and Server tabs under one PageHeader, addressed by #settings/<section>. A bare or unknown section opens Appearance, and tab changes replace the hash so Back leaves Settings. Live values are grouped by name prefix and typed from their schema kind by a new SettingControl (Toggle, enum Select, number inputs, JSON textarea, and a "Leave unset" toggle for _or_null kinds); the draft stays text and parseSettingInput remains the only validator. formatSettingValue shows floats as the shortest f32 round trip, at most 7 significant digits. Each request field shows its resolved next-request value and source through resolveEffectiveParameter, and the Chat hint uses the same helper against the server defaults Settings last read. Startup values are listed as text, with server reasons behind a disclosure. Contract prose moved to docs/webui/settings.md behind help tooltips; labels and help for the known live settings are catalog-owned in both locales.

Validated with typecheck, lint, the unit suite, the theme-selector gate, the Chromium Playwright specs, the bundle verify, the WebUI contract and binary-asset checks.

Closes #1917, refs #1910.
Measured against a synthetic 110-entry schema shaped like the server's (23 live, 87 startup values), the Model tab reached 2,050 px at 1440x900. The "Leave unset" toggle now sits in the label row of number and JSON fields, the live-value actions share the heading row, groups of one or two settings share a row, and the two profile disclosures sit side by side, bringing the tab to 1,699 px. Only the disabled control dims, so its label and hint keep AA contrast and the toggle keeps a 24 px target.

The Settings Playwright spec now also runs axe on the Korean dark variant.
@inureyes inureyes added type:enhancement New features, capabilities, or significant additions priority:high High priority area:architecture Architecture and code structure changes status:review Under review labels Sep 19, 2026
The cross-engine smoke navigated to #settings and expected the request-defaults heading, which now lives on the Requests tab. browser:all therefore failed at engines.spec.ts:79 on Chromium, Firefox and WebKit for all three variants in CI run 35448824638. The spec now selects the Requests tab and checks the replaced hash before the heading and reset-dialog steps.

Not run locally: the private Playwright config used for this branch excludes engines.spec.ts, so CI browser:all is its check.

Refs #1917
SettingControl treated a draft of the text null as the null state for every schema kind. Typing null into a non-nullable field such as chat_template_kwargs or default_dry_sequence_breakers cleared and disabled the control, and since those kinds have no "Leave unset" toggle the draft could only be escaped by resetting the whole live draft or leaving the tab. The null state is now limited to _or_null kinds; elsewhere null is ordinary draft text that parseSettingInput validates on Apply.

A new test covers str, array and object and fails with the change reverted. The bundle under src/webui/assets/ is regenerated. typecheck, lint, unit (569 tests), check:theme-selectors, settings.spec.ts on Chromium and build_bundle.py --verify pass.

Refs #1917
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

Split Settings into four hash-addressed tabs with schema-typed live controls, resolved request values shared with the Chat hint, and contract prose moved to docs/webui/settings.md (#1917, part of #1910).

Findings Addressed

  • browser:all failed at engines.spec.ts:79 on Chromium, Firefox and WebKit for every variant (run 35448824638): the cross-engine smoke opened bare #settings and expected the request-defaults heading, which now lives on the Requests tab. Fixed in a9d2e20 (HIGH)
  • Typing null into a non-nullable live setting (chat_template_kwargs, default_dry_sequence_breakers) cleared and disabled the control, and those kinds have no "Leave unset" toggle to undo it. The null state is now limited to _or_null kinds; the new test fails with the fix reverted. Fixed in 8be9965 (HIGH)

Remaining Items

  • server-defaults.ts keys records by model id and revision only. After a server restart that reuses both (single-model mode is always revision 1), the Chat hint can show the previous server's defaults until Settings reads again; adding serverInstanceId to the key closes it (MEDIUM), not auto-fixed by scope
  • Toggle puts its hint and error inside the <label> with no aria-labelledby, so they become part of the checkbox's accessible name, contrary to its doc comment. Field avoids this by labelling from the label span. No current mutable setting is a bool, so only future schema entries are affected (MEDIUM), not auto-fixed by scope
  • Only the active tab is mounted, so unsaved Requests, profile and live drafts are dropped on a tab switch without notice (LOW)
  • The integer request fields (max_tokens, top_k, seed) are listed three times across generation-defaults.ts and generation-settings.tsx (LOW)
  • Live check against the bundled binary with a loaded checkpoint at 1440x900 and 390x844 is still pending, as the PR body states

Verification

  • All stated requirements implemented (code complete; the bundled-binary acceptance check is pending)
  • No placeholder/mock code remaining
  • Integrated into project code flow
  • Project conventions followed
  • Existing modules reused where applicable
  • No unintended structural changes
  • Tests pass (typecheck, lint, unit 569, check:theme-selectors, settings.spec.ts on Chromium, build_bundle.py --verify locally; CI run 35449331319 on 8be9965 passes WebUI bundle including browser:all, WebUI contract and binary assets; WebUI installed artifact was still running)

Review follow-ups for #1917. Recorded server defaults were keyed by model id and revision only; a server restart can reuse both (single-model mode is always revision 1), so Chat's "Inherited" hint could show the previous server's values. The key now includes the server instance id, carried as one ServerDefaultsScope from the Settings target.

An unapplied live draft now survives a Settings tab switch, kept per worker in memory, since only the active tab is mounted. The shared Toggle is named by its label span alone, so its hint and error describe it instead of joining its accessible name. The integer request fields are listed once, in generation-defaults.ts.

New tests cover the restart case, draft retention and the Toggle name; the first and last fail with their fix reverted. Unit (571), settings.spec.ts, typecheck, lint and the bundle verify pass.
An unapplied live draft is retained in memory across Settings tab switches, but it was retained without the fingerprint it was written against. When the tab returned after another client had changed the settings, the remount read the new values as the baseline, so Apply passed the fingerprint check and silently overwrote the other client's change. Before retention, a remount dropped the draft, so the conflict guard in the PR's acceptance criteria covered this case.

The retained entry now carries its fingerprint. The first successful read after a remount, whether the initial load or a Refresh after that load failed, compares it; when it moved, the existing conflict notice appears and Apply must be pressed again, exactly as for a stale Apply. The retained map is also capped at 32 workers, the same bound as the server-defaults record, instead of growing by one entry per reloaded worker.

Three new tests cover the reconfirmation on load, the reconfirmation on Refresh and the bound; each fails with its part of the fix reverted. Unit (574), typecheck, lint, theme selectors, settings.spec.ts and the bundle verify pass.
@inureyes

Copy link
Copy Markdown
Member Author

Security and performance review of 60c72c7.

Fixed in 823955e

  • HIGH: a live draft retained across tab switches kept no fingerprint. After another client changed the settings, the remount read the new values as the baseline, so Apply passed the fingerprint check and silently overwrote that change. The retained entry now carries its fingerprint; the first successful read after a restore (load, or Refresh after a failed load) shows the existing conflict notice when it moved. Three tests, each failing with its part reverted.
  • LOW, same code: the retained-draft map is capped at 32 workers like the server-defaults record.

Open, LOW

  • Server-default records and retained drafts survive sign-out, unlike conversations (app.tsx:74). Same-server data, not secrets.
  • 256-entry schema, jsdom dev build: mount about 90 ms, keystroke median 14 ms, p90 33 ms, since every control re-renders per keystroke. Memoize SettingControl if schemas grow.
  • .5 and 01 are valid number-input values but parseSettingInput rejects them through JSON.parse. The old text field did the same.
  • errors[spec.name] (live-settings.tsx:132) indexes a plain object, so a schema name of __proto__ would crash the render. This predates the PR, and the input comes from the server.

Checked, no finding: no HTML sinks, eval, or window.confirm/alert/prompt; server strings and values render as React text only. The hash parser only resolves to fixed route and section enums. Every /settings and /props read uses autoload=false and waits for a Ready selection; Chat only reads memory. PATCH fires only from Apply. The CLI copy text is allow-listed. No inline script was added.

Gates: typecheck, lint, theme selectors, unit (574), bundle verify, settings.spec.ts (5/5).

The server schema names a live setting arbitrarily, so `errors[spec.name]` and `current.current[spec.name]` in live-settings.tsx resolved through the prototype chain of their plain object state for a name like `constructor`, handing the inherited `Object` constructor to the error slot instead of `undefined`. React then throws when that function reaches `<small>{error}</small>` as a child. Both lookups now go through `Object.hasOwn` first. server-settings.tsx already guarded its equivalent read.

Validation: new live-settings.test.tsx case renders a mutable `constructor`-named setting and fails with the prototype-chain crash when the guard is reverted; typecheck, lint, unit (579), check:theme-selectors and build_bundle.py --verify pass.
The Model tab's "Show as CLI flags" copy button and the Server tab's /props-unavailable banner had no test exercising their success and failure paths. Add profile-settings.test.tsx covering the Clipboard API resolving, rejecting and being absent, and extend server-settings-selection.test.tsx with a case where getModelProps rejects, checking the banner and the "Unknown" context fallback.

Validation: pnpm run unit (582 tests) passes; the new assertions fail if the corresponding status text or banner is removed.
docs/webui/settings.md described the Chat hint's server-defaults record as keyed by model revision alone, but server-defaults.ts also keys it by server instance so a restart that reuses a model id and revision does not resolve to the previous server's values. Add that detail to the Requests section so the doc matches the current code.
@inureyes inureyes added status:done Completed and removed status:review Under review labels Sep 19, 2026
@inureyes
inureyes merged commit 7cc49fc into main Sep 19, 2026
49 of 52 checks passed
@inureyes
inureyes deleted the feature/issue-1917-settings-sections branch September 19, 2026 15:54
inureyes added a commit that referenced this pull request Sep 19, 2026
Brings in #1928 (Settings tabs). The two doc conflicts keep both sides: the ui-common matrix keeps this branch's Badge row and main's Field/Toggle row, and design-system.md keeps main's Toggle export with this branch's Drawer sentence. The embedded bundle was regenerated from the merged sources rather than hand-merged, and the suite counts were recounted (35 node + 602 Vitest, 116 Chromium Playwright), all passing.

Refs #1918
inureyes added a commit that referenced this pull request Sep 19, 2026
Brings in #1928 (Settings tabs). This branch rebuilds Chat and #1928 edits the same two chat files, so both are resolved here. The Chat settings drawer's sampling link now opens `#settings/requests`. The next-turn parameter hints keep #1928's server-default resolution inside this branch's drawer section, which has no `<details>` wrapper. `chat.params.server_default` has no remaining caller, so it is dropped from the catalog and the string fixture. The bundle is regenerated, not hand-merged.

Validated on the merged tree: typecheck, lint, check:theme-selectors, unit (62 files, 641 tests), build_bundle --verify, the WebUI contract and binary-asset checks, and the Playwright Chromium chat, shell, settings and browser specs.
inureyes added a commit that referenced this pull request Sep 19, 2026
Rebuilds the Chat route as a conversation view: a conversation list (a pane from 961 px, a Drawer below), user and assistant messages you can tell apart without reading them (alignment, a "You" label and a model badge, timestamps, elapsed seconds while streaming, keyed status labels), a pinned composer that grows from 1 to 8 rows, one settings drawer for conversation settings, next-turn parameters and local history, and Load from Chat. The page itself no longer scrolls; only the message list does. Send, Stop, edit, history and privacy behave as before. Retry re-sends a failed last turn through the same guards.

## Design notes

- There is one "New conversation" button, in the page header. A second button with the same name breaks strict role locators in four specs.
- The model picker sits in the conversation header, because the ui-common Select always opens its dropdown downward. Its groups are expressed as ordered options (Ready chat models first) with a state description on each, because the Select has no option groups.
- Load goes through a confirmation, then `models/load-action.ts`, which sends the same request the Models screen sends. A `conflict` response opens the Models capacity dialog. Selecting a model never loads it. `screen.tsx` changes only at its `load()` call site.
- History payloads are now version 2 and add `startedAt`. Version-1 turns import with `startedAt` 0, and the IndexedDB version stays at 1.
- Status labels are Generating, Done, Stopped, Did not finish and Failed, so the raw status words never appear.

## Changes during review

- The Drawer adapter wraps Tab at the controls that are usable when the key is pressed. Before, Tab escaped both Chat drawers while a response streamed.
- An imported time outside the range a `Date` can hold renders as unknown instead of crashing the WebUI. `startedAt` is bounded on import.
- Retry is disabled whenever Send would be refused. When clearing the overrides removes the badge that opened the settings drawer, focus falls back to the settings button on close. The model picker now sorts its options only when the catalog or selection changes.

## Validation

- Passing at b9fab1b: typecheck, lint, check:theme-selectors, `unit` (58 files, 600 tests), `build_bundle.py --verify`, `check_webui_contract.py` and `check_binary_assets.py`.
- Playwright Chromium at b9fab1b, one spec per run: chat 5, shell 14, browser 29, models 8, settings 3, activity 3, theme 23, ui-common-components 14, ui-common-shell 12, all passing.
- Passing after merging main with #1928 (e2a5af2): typecheck, lint, theme selectors, unit (62 files, 641 tests), `--verify`, the contract and binary-asset checks, and the chat, shell, settings and browser specs. The Chat drawer's sampling link now opens `#settings/requests`, and the parameter hints use #1928's server-default resolution.
- A test for the Clear All focus race failed 3/3 before the fix. `confirmations.test.tsx` then passed 10 consecutive runs.
- Not runnable locally: `router-real` and `performance` (selectors updated).

## Measurements (before/after)

Mock fixture, 30-turn conversation, page scrolled to the top. Before is main 835a552, after is b9fab1b. The real-binary figures are in the next section.

| Viewport | Page height, empty | Page height, 30 turns | Composer visible without scrolling | Scrolling elements | Words, empty |
|---|---|---|---|---|---|
| 1440x900 before | 967 | 1405 | no (bottom 1113) | transcript box + page | 93 |
| 1440x900 after | 900 | 900 | yes (bottom 803) | `.chat-messages` only | 59 |
| 390x844 before | 1268 | 1600 | no (bottom 1280) | transcript box + page | 93 |
| 390x844 after | 844 | 844 | yes (bottom 743) | `.chat-messages` only | 46 |

## Real-binary acceptance

Ran against an isolated bundled `mlxcel-server` built from b9fab1b, with `qwen3-0.6b-4bit` loaded. Every check passed.

- `chat-real.spec.ts` (with `MLXCEL_CHAT_REAL_ISOLATED=1`): the reply was "Hello! 🌍" and the status label reads Done. Stop worked: the request lease rose above 0, returned to 0, and the status label reads Stopped. There were no CSP violations and no external requests, and axe found no violations. The harness now reads the model's own catalog entry, because a large catalog puts the model past the first page. The short turn is capped at 64 tokens.
- Load from Chat: with the model unloaded, selecting it and opening the confirmation sent no request. Confirming sent exactly one `POST /ui-api/v1/model-actions` with the Models body (`action: load`, `model_id`, `expected_revision`, `idempotency_key`). Once the model reached Ready, the header's Load button was gone and a 32-token turn answered. Stop mid-stream took the lease back to 0 and the status label reads Stopped.
- At 1440 and 390: one click in the list switches conversations. At 390 the list opens as a Drawer from the header and closes when you pick a conversation. Setting `max_tokens` shows "Overrides: max_tokens". The badge reopens the drawer on the parameters section, and focus returns to the badge.
- At 1440x900 with 30 real turns, the page stays 900 px tall, the composer is visible, only `.chat-messages` scrolls, and the page has 797 words (45 when empty).

The live run found one defect, now fixed in 5f50a89: on the current conversation row, the hover tint stacked on the current-row tint and dropped the muted metadata to 4.42:1 contrast. The Chat browser spec runs axe in that state; it failed before the fix and passes after.

Merge note: #1930 adds the same end-anchored Drawer variant, as `placement`. This PR adds it as `side` plus `width`. Whichever PR merges second reconciles the Drawer signature and the `ds-drawer--end` CSS.

Part of #1910

Closes #1915


## CI note (GB10 Activity gate)

The `WebUI installed artifact` job on `e2a5af2a` (run 35453693578) failed only at the "Run Activity performance gate" step's precheck, `GPU compute processes are already present before Activity gate`, so the gate never measured anything; every other step passed, including the real-router browser harness, the installed-artifact WebUI check and the reverse-proxy check. The precheck has failed for every PR since run 35449824150 was cancelled at 14:59:53Z inside that step, which points at a GPU process left on the runner. This PR changes the Chat screen and does not touch decode or the Activity page, so per the maintainer's decision for this epic it merges with this evidence recorded (gate noise: #1925).
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:architecture Architecture and code structure changes priority:high High priority status:done Completed type:enhancement New features, capabilities, or significant additions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(webui): restructure Settings into scoped sections with schema-typed inputs

1 participant