Repository navigation
feat(webui): split Settings into scoped tabs with typed live controls - #1928
Conversation
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.
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
Implementation Review SummaryIntent
Findings Addressed
Remaining Items
Verification
|
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.
|
Security and performance review of 60c72c7. Fixed in 823955e
Open, LOW
Checked, no finding: no HTML sinks, Gates: typecheck, lint, theme selectors, unit (574), bundle verify, |
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.
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
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.
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).
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 onePageHeader, each addressed by a hash:#settings/appearance,#settings/requests,#settings/model,#settings/server. A bare or unknown section opens Appearance; tab changes usereplaceState, so Back leaves Settings. Links open the tab they mean (Models pending profile to Model, Chat sampling note to Requests).What changed
setting-control.tsx):boolToggle, enum Select (an out-of-list current value stays as a disabled option), text,intandfloatnumber inputs, JSON textarea checked on blur, and a "Leave unset" toggle for_or_nullkinds that stagesnull. The draft stays text andparseSettingInputis still the only validator, so apply, reject retention, fingerprint and reset flows are unchanged. Groups: Sampling, DRY, Diffusion, Template, Other, by name prefix.formatSettingValue: shortest decimal that round-trips throughMath.fround, capped at 7 significant digits.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./props-unavailable banner.docs/webui/settings.md, reachable from help tooltips. Korean Settings copy says 대화 where the screen does.Toggleis now a shared primitive, named by its label alone.Measured on the bundled binary
Server built from
619eed33with the embedded bundle,qwen3-0.6b-4bitloaded and Ready,--settings --props --metrics --slots(110 schema entries, 23 mutable). Before is main835a5527's UI against the same server and data. Height isscrollHeight; inputs countinput, select, textareainmain; words countmain's text.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_temperaturereads0.8in 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_sampleris a Select with exactlyentropy-boundandconfidence-threshold. All 23 controls match their kind: floatsstep=any, intsstep=1, arrays and objects a JSON textarea, the three_or_nullentries with "Leave unset". The live schema has no mutablebool.default_temperature0.7read back0.7; restoring it read back0.8in the UI and0.800000011920929from/settings.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/serveropens 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
nullis typed into it.Object.hasOwn, so a schema name such asconstructorcannot reach the error slot.Notes for review
live-settings.test.tsxchanged 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_defaultis no longer referenced; it is left inchat/strings.tsto keep the concurrent Chat redesign's merge mechanical.CI note (GB10 Activity gate)
The
WebUI installed artifactjob on619eed33failed three attempts (run 35451205090) at the same point: the "Run Activity performance gate" step's precheck reportedGPU 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.