Skip to content

feat(webui): restructure Chat as a workspace with scoped controls - #3552

Merged
inureyes merged 2 commits into
mainfrom
feature/issue-3522-chat-workspace
Nov 29, 2026
Merged

inureyes merged 2 commits into
mainfrom
feature/issue-3522-chat-workspace

Conversation

@inureyes

@inureyes inureyes commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Chat (webui/src/features/chat/) becomes a workspace screen with every control placed by the scope it acts on. Part of #3526.

  • Layout. The conversation list and the conversation are two panes that scroll on their own; the page never scrolls. At 960 px and below one pane shows at a time: Show conversations in the conversation header switches to the list, and Back to conversation, selecting a row or New conversation switches back, moving focus into the pane that is now shown. The compact list Drawer is gone. The flow fallback below 320 px wide or 560 px tall (the 195 px floor and 200% zoom) is kept.
  • Conversation-scoped tools. Conversation parameters (system prompt and next-turn overrides) and Local history and privacy are icon-only buttons in the page header. Each opens a sized dialog on the shared Dialog primitive and shows a dot while its value differs from the default; the dot's meaning is the button's accessible description, so the name never changes. settings-drawer.tsx became parameters-dialog.tsx; the privacy dialog stays mounted while closed, so local-history persistence keeps running.
  • Composer. The message field, then one bar with a + menu (Attach images, present only when the provider confirms vision input), the model for the next turn and Send or Stop.
  • Per-message action bar. Copy, the message's own action and an overflow menu on every message: Edit and regenerate plus Reuse prompt on prompts, Regenerate response plus response details on answers.
  • Regenerate (new). Re-sends an assistant turn's stored prompt and images through the existing send path with the same history before it, in place, without touching the draft. No server endpoint is added. Regenerating an earlier answer asks before discarding the turns after it; a failed or unfinished last turn keeps the Retry response name.
  • Draft guard. Discarding a non-empty draft (text or images) asks first: New conversation from the list, the palette or Cmd/Ctrl+N, switching conversations and Reuse prompt. The edit confirmation says the draft is replaced.
  • Navigation. New conversation and switching live in the conversation list.
  • Rendering. Markdown, code and reasoning stay on markdown.tsx and code-highlight.tsx, restyled to the type scale and the code surface; Copy code reports through the shared button feedback, and the code block strings are now localized. No rendering package is added.
  • Copy. Chat-owned strings move to Run / Stop and Conversation (chat.model.*, chat.load.*, the error title, the parameters title). The Run button itself still renders the shared models.load key, which the Models unit owns.

Shared files outside the Chat feature

  • webui/src/design-system/common-menu.tsx (new) and one export line in primitives.tsx: ActionMenu, a seam adapter over ui-common's DropdownMenu (anchored popover, icon-only trigger with its tooltip). There was no menu primitive in the seam.
  • webui/src/design-system/icons.tsx and icons.test.tsx: three icons, add (Plus), parameters (SlidersHorizontal) and privacy (ShieldCheck).
  • webui/tests/router-real.harness.ts and src/server/router_webui_playwright_harness_tests.rs, changed together: the harness now regenerates the first answer through the production router and checks the repeated request carries the same messages, and the scripted feeder completes the first two generations per model (send and regenerate) and streams the third until Stop. The coupled selector .chat-turn .chat-status and the names "Message", "Send", "Stop", "New conversation" and "Model for next turn" are unchanged.
  • Docs: docs/webui/chat.md rewritten for the new layout; one sentence each in ux-contract.md, design-system.md, ui-common.md and both user guides.

Test ids

All existing data-testid values are kept on their equivalent surfaces: chat-settings-drawer is the Parameters dialog, chat-settings-open its header button, chat-overrides the description of what differs, chat-list-open the pane switch. chat-list-drawer is gone with the Drawer. New ids: chat-privacy-dialog, chat-privacy-open, chat-privacy-changed, chat-list-back, chat-composer-add, chat-regenerate-dialog, chat-discard-draft-dialog.

Strings

20 keys added, one removed (chat.settings.name; renaming lives in the list), English and Korean plus the fixture. The string catalog fixture is now at 1024 entries, exactly the maxItems cap of StringCatalog in docs/webui/api.yaml, so the next unit that adds a string has to raise that cap.

Bundle

Initial JavaScript 317,969 B gzip (+2,498 B), total 479,089 B gzip (+8,276 B), against 393,216 B and 716,800 B budgets.

Changes during review

  • At 960 px and below, switching panes while a request runs now focuses an enabled control (Back to conversation, or Stop) instead of a disabled row or composer, and narrowing the window always shows the pane that holds focus.
  • The privacy dot follows saving alone; including images without saving stores nothing.
  • Reuse prompt no longer shares the Edit glyph; the Korean draft confirmation says 초안 throughout.

Validation

  • pnpm run typecheck, lint, check:theme-selectors, check:themes, check:agents, unit (all vitest files, Chat 161 tests): pass.
  • browser (Chromium, 137 tests, including chat.spec.ts at 1440 and 390 px, the 195 and 320 px floor specs and the 200% text variants): pass.
  • browser:all (engines and performance, Chromium, Firefox, WebKit): 20 of 21 passed on the first run; the headed WebKit Activity navigation latency sample read 312 ms against 150 ms on a machine running three parallel builds and passed on a rerun. It is outside Chat. The IME composition guard (engines.spec.ts) passed in all three engines.
  • python3 scripts/webui/build_bundle.py --verify, make verify-webui-contract, make verify-webui-rust (87 tests): pass.
  • make verify-webui-integration-fake: pass, including the new regenerate step through the production router.
  • Served CSP spec (playwright.csp.config.ts) against the release mlxcel-server --webui: pass, light and dark.
  • Real binary (mlxcel-server --webui, release build, router mode, Meta-Llama-3.1-8B-Instruct-4bit running), chat-real.spec.ts: pass. A streamed reply rendered bold text and a fenced Python code block on the code surface; Regenerate re-ran the answer with the same messages on the wire; the 256-token parameter set before the first turn reached only that request; Stop mid-stream showed Stopped and the request lease rose and returned to 0; zero CSP violations and no external requests; axe clean in completed and cancelled states.
  • Screens were checked at 390, 1024 and 1440 px, light and dark, both families, English and Korean, with the fixture server. Screenshots are not attached because images are not committed for this epic.

Not covered: in single-model mode (-m) the catalog does not report active_requests while a stream runs, so the Stop lease check in chat-real.spec.ts needs router mode (--models-dir or the managed store). That is existing server behavior, not part of this change. Safari with VoiceOver was not run.

Closes #3522

Chat becomes a workspace screen: the conversation list and the conversation are two panes that scroll on their own while the page never scrolls, and at 960 px and below one pane shows at a time, switched from the conversation header and back on selection. The compact list Drawer is gone.

Every control now sits with the scope it acts on. Conversation parameters (system prompt and next-turn overrides) and local history and privacy are icon-only header tools that open sized dialogs on the shared Dialog primitive, each with a dot and an accessible description while its value differs from the default. The composer holds the message, the model for the next turn and a + menu for image attachment. Each message has one action bar with copy, its own action and an overflow menu. New conversation and switching live in the conversation list.

Regenerate is new on every finished assistant turn. It re-sends the stored prompt and images through the existing send path with the same history before that turn, so no server endpoint is added; an earlier turn asks before discarding the turns after it, and a failed last turn keeps the Retry name. Discarding a non-empty draft now asks first.

ActionMenu is a new seam adapter over ui-common's DropdownMenu, and the icon family gains add, parameters and privacy. Markdown, code and reasoning stay on the WebUI's own components, restyled to the type scale and the code surface, with localized code-block copy. Chat-owned copy moves to Run / Stop and Conversation. The router harness regenerates through the production router, with the scripted feeder completing the regenerate request, and the real-binary spec covers markdown and code, regenerate and a parameter change reaching only the next turn.

Closes #3522
@inureyes inureyes added type:enhancement New features, capabilities, or significant additions priority:medium Medium priority status:review Under review labels Nov 28, 2026
At 960 px and below, switching panes during a running request now focuses an enabled control (Back to conversation in the list, Stop in the conversation) instead of a disabled row or composer, and narrowing the window always shows the pane that holds focus rather than a pane left over from an earlier narrow window. The privacy tool's dot follows saving alone, since including images without saving stores nothing. Reuse prompt drops the Edit glyph it shared with the button beside it, and the Korean draft confirmation says 초안 throughout.
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 29, 2026
@inureyes
inureyes marked this pull request as ready for review November 29, 2026 00:30
@inureyes
inureyes merged commit d6185cd into main Nov 29, 2026
34 of 36 checks passed
@inureyes
inureyes deleted the feature/issue-3522-chat-workspace branch November 29, 2026 00:30
inureyes added a commit that referenced this pull request Nov 29, 2026
Bring in the Chat workspace restructure (#3552) and the Helm chart publishing work (#3554) so the Settings rebuild for #3524 stays mergeable.

- Icons: the union of both sides, `forward` and `back` from Settings plus `add`, `parameters` and `privacy` from Chat; the icon count test now expects 30.
- Docs: design-system.md lists all 30 glyphs and keeps the Settings note on the re-exported `Icon`; both user guides keep the Settings rows and search paragraph and take Chat's wording that the history and privacy dialog opens from the shield button in Chat's header.
- Strings: the fixture merged cleanly to 1040 entries with no key edited on both sides, so `StringCatalog.strings.maxItems` in docs/webui/api.yaml rises from 1024 to 2048; the generated DTO has no drift.
- Bundled assets were regenerated with scripts/webui/build_bundle.py rather than hand-merged.

Validated with typecheck, lint, the unit suite (843 tests), the theme and agents checks, the bundle verify, the WebUI contract check, and the Chromium settings, chat and shell Playwright specs (39 passed).
inureyes added a commit that referenced this pull request Nov 29, 2026
Closes #3524. Part of #3526.

Settings moves to the new grammar. Each tab is now a set of sections made of one-setting rows. Advanced settings sit one drill-down level in, and a search filters rows across every tab.

- **Rows.** The label and an optional description sit on the start side, with the control on the inline end.
  - Below a 38 rem panel width the row stacks. This is a container query on `.settings-screen`, not a viewport breakpoint. Playwright checks both sides of it at 390, 1024 and 1440.
  - Read-only facts are also one per row: the context values and the startup values.
  - `SettingsSection` puts a section's own on/off switch in its header (`toggle`). No section has a real on/off today, so the slot is unit-tested but unused. I did not invent a synthetic switch over shared server state.
- **Levels.** These open in place of the tab's top level: Glass material, Advanced sampling (`min_p`, `repetition_penalty`, `seed`), the DRY, Diffusion, Template and Other live groups, and Server details (geometry, values under internal names, read-only reasons).
  - Focus moves to the level's heading, and Back returns it to the drill row.
  - A level is not in the hash. It closes whenever the tab changes, whether by the tab strip, a link or the hash.
  - The live draft, its pending count, Apply and the result notice stay above the level, so Apply sends the edits from every group. A drill row counts its unapplied edits and the values that need fixing.
- **Search.** The static tabs render from the same row lists that the index holds. Live and startup entries come from the selected model's `/settings` schema; if no read exists yet, the screen makes one non-loading read while a query is typed.
  - Matching covers English and Korean labels and descriptions at once, plus the internal name.
  - Choosing a result, or pressing Enter for the first one, opens its tab and level and focuses the row's control.
  - Up and Down step through the results, Escape clears the field, and IME composition is respected. When nothing matches, an empty state offers Clear.
- **Saving.** Appearance, request defaults and the next-run profile save on choice, with no Save button.
  - An out-of-range value stays on screen marked "Not saved".
  - Live server values keep draft, Apply and the conflict refresh.
  - Startup values stay read-only under the restart note.
  - `ux-contract.md` records both exceptions. `settings.md` and both user guides describe the new layout.
- **Dialogs and copy.** The profile CLI view and import/export open in `Dialog`, and the three resets use `useConfirm`. Settings strings move to Run and Stop terms (decision 5), for example "Next run · browser profile" and "다음 실행 · 브라우저 프로필".

Shared edits outside `features/settings/`:
- `icons.tsx` adds the `forward` and `back` chevrons, and `primitives.tsx` re-exports `Icon`. The design-system icon list is updated to match.
- The strings fixture changes in one block. It now holds 1,021 entries, under the 1,024 `maxItems` cap, so `api.yaml` is unchanged.
- `shell.spec.ts`: I removed the two-frame wait in `shellGeometry`.
  - The 4 px overflow at 195 px did not reproduce on the untouched `main` baseline or on this branch. I measured every frame after the hash change, across 16 runs and with 8x CPU throttling.
  - The shell spec passed 126/126 over six runs without the wait.
  - The wait was masking nothing, and measuring the first visible frame keeps any future regression visible.

Bundle: initial JS gzip is 316,231 B (+760, from the two glyphs) and total is 476,094 B (+5,281).

Validation:
- From `webui/`: `typecheck`, `lint`, `check:theme-selectors`, `check:themes` and `check:agents` pass. `unit` passes 836/836 and the Chromium `browser` suite 140/140.
- `build_bundle.py --verify` and `make verify-webui-contract` pass.
- I did not run `browser:all`, `make verify-webui-rust`, `make verify-webui-integration-fake` or the served-CSP spec. They are left for the central gate.
- Real binary: `mlxcel-server -m qwen3-0.6b-4bit --webui --settings --props`, with two Chromium contexts. Results:
  - Choosing Dark applies immediately and survives a reload.
  - A temperature edit stays a draft (no PATCH) until Apply, then reads back as 0.55.
  - In the two-client case, A drafts 0.33, B applies 0.77, then A presses Apply. A shows the conflict notice, sends no PATCH and keeps its 0.33 draft, and B's 0.77 stands. A's second Apply lands, and B reads 0.33 after Refresh.
  - Searching "dry" lists the live DRY rows. Screenshots are not attached because images are not committed.

## Changes during review

The review found four HIGH issues, all fixed:
- Search started on Appearance found no live rows.
- Apply failed silently when the invalid value was on a closed level.
- The search focus fallback could steal focus late.
- A valid profile edit erased another field's "Not saved" text.

From the security pass, Apply now collects values in null-prototype records, and search text is normalized once per entry.


## Merge with main

Merged main (Chat workspace #3552) into this branch. The icon set is the union of both sides (30 glyphs), the generated assets were regenerated, and `StringCatalog.strings.maxItems` in `docs/webui/api.yaml` was raised from 1024 to 2048 because the combined string fixture holds 1040 entries.
inureyes added a commit that referenced this pull request Nov 29, 2026
Brings in the Chat workspace (#3552), Settings rows and search (#3553), the Helm chart and GHCR publishing work, and the other main commits since the branch point.

All source files merged without conflicts. The string fixture ends at 1050 entries: the union of both sides, minus six Settings and Chat keys that main deleted and Activity never touched; every key whose copy differs was changed on one side only, and that side's copy is kept. Only the generated src/webui/assets bundle conflicted, so it was regenerated from the merged sources with scripts/webui/build_bundle.py rather than hand-merged.

Validated with webui typecheck, lint, unit (859 tests), the theme and agents checks, build_bundle.py --verify, and make verify-webui-contract.
inureyes added a commit that referenced this pull request Nov 29, 2026
The router WebUI Playwright harness from #3552 indexed `completed_by_handle[index][generation]` inside `for generation in 0..COMPLETING_GENERATIONS`, which `clippy::needless_range_loop` rejects under `-D warnings`. Main's clippy job did not run for that WebUI-only change, so the lint first failed on this PR. The loop now walks the row with `iter_mut().enumerate().take(COMPLETING_GENERATIONS)`; behaviour is unchanged.

`cargo clippy --lib --tests --features cuda -- -D warnings` and the module's tests pass.
inureyes added a commit that referenced this pull request Nov 29, 2026
Advance the reproducible MLX pin from fc344c98 to 5a48f9cc, the head of upstream main on 2026-11-28 (87 commits, past v0.32.5). Review record: docs/mlxcelverse/mlx-pin-2026-11-28.md.

- The CPU quantized-matmul overlay (#2248) is retired: upstream now accumulates the fp qmm loops in float (ml-explore/mlx#4879), and cpu_qmm_accum_tests guard the upstream loops.
- 24 Metal and CUDA overlays are rebased onto the pin. SDPA threads upstream's window_size through the deterministic and bucketed plan paths. The CUDA grouped_gemm.h overlay includes <cstdint>, and device/unary_ops.cuh (added on main by #3540 at the old pin) carries upstream's new SignBit functor.
- The #637 sm_120/121 qmm tile cap is dropped for upstream's #4851 rule (large_tiles ? 128 : 64). A GB10 A/B on llama-3.1-8b-4bit and qwen2.5-7b-4bit showed no prefill gain from the cap at 2048 or 8192 tokens and byte-identical greedy output; the 512-token qwen gain (about 10%) is recorded in the pin doc. TILE_M_CAP_BLACKWELL is 64.
- ROCm overlay retargeted: the fork's fusion limits move to mlx/compile/fuse.cpp, the new allocator hooks are inert, GroupedMM and SignBit get NO_GPU stubs, and HIP sources compile as C++20 because the pin's scheduler.h uses std::atomic::notify_all (LOCAL_FIXES 77 to 80, after main's 76).
- The MiniCPM5 and Qwen3 DSpark exactness gates require MLXCEL_SDPA_DETERMINISTIC=1 on CUDA, where decode attention otherwise takes cuDNN stream-K and its engine choice depends on what ran earlier in the process.
- A clippy needless_range_loop in the router WebUI harness test from #3552 is fixed; main's clippy job had not run on that change.

Validation: on M3 Ultra, make verify-test (17374 passed). On GB10 (spark-102), make verify-test-cuda-qmm-determinism (5 passed) and make verify-test-cuda (17741 passed, 3 failed, none from this change: a DeepSeek-OCR CLIP parity failure identical on main, and two port or timing flakes that pass alone), check_nvrtc_headers.py with NVRTC against the new-pin build tree, make verify-rocm-overlay, and both real-checkpoint DSpark gates. CI passes except binary assets, which fails on main for the undeclared tests/fixtures/audio/speech.flac from #3533. No ROCm host was available: the HIP C++20 change is covered by the Windows compile-only job only.
@inureyes inureyes added this to the 0.9 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium 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 Chat as a workspace with scoped controls

1 participant