Skip to content

Studio: keep Images, Video and Hub search typing responsive - #15306

Merged
danielhanchen merged 7 commits into
mainfrom
studio-images-typing-webkitgtk
Oct 26, 2026
Merged

danielhanchen merged 7 commits into
mainfrom
studio-images-typing-webkitgtk

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes #15221

On the Linux desktop app, typing in the Images prompt / Instruction box echoed at a few characters per second, and scrolling the Edit pane lagged, whether or not a generation was running. Chat and the browser build were fine.

Cause

The Linux desktop app renders through WebKitGTK, which repaints the whole view for every keystroke or scroll step. Two things made each of those repaints expensive on the Images page:

  1. The full-size image in the viewer (and the live preview) carries shadow-sm, a blurred box shadow. In WebKitGTK that blur over a ~780 px image costs about 150 ms per repaint. Removing only that shadow took typing from 5.5 to about 23 chars/s; disabling backdrop blur, animations, field-sizing or the checkerboard background did not move it.
  2. Every keystroke re-rendered the whole Images page (thousands of controls) before the character was painted.

Changes

  • index.css: html.tauri.render-linux .media-stage-shadow { box-shadow: none; }. The full-size image and live preview on Images, and the clip and live preview on Video, carry media-stage-shadow. Only the Linux desktop app matches, so macOS, Windows and every browser keep the shadow exactly as today.
  • DeferredTextarea: the Images and Video prompt boxes echo keystrokes themselves and hand them to the page in a startTransition, so a slow page render yields to the next key instead of sitting in front of it. Values the page sets itself (recall, Enhance caption, transparency button, embedding triggers, workflow switch) still replace the box's text, and leaving the box commits any pending text, so a Generate click right after typing reads the full prompt.
  • smoke-deferred-prompt.html + tests/studio/playwright_composer_deferred_prompt.py (wired into the Composer compatibility matrix): a deliberately slow owner; asserts every key lands, the owner never renders inside a keystroke's input event, Generate right after typing gets the full text, and owner-set values replace the draft. tests/media-stage-shadow.test.ts pins the CSS scope and the class on every shadowed full-size media element; tests/hub-search-keeps-auto-preview.test.ts pins the Hub guard.
  • Model Hub search: in the split view the first row is opened automatically as a preview. Each keystroke in the search box cleared that preview from the URL and the next render picked it again, so every key cost two router navigations and a README pane remount. Typing now leaves the auto-picked preview alone; a model the user opened is still closed on the first key as before, and the URL ends in the same state.

No UI or flow changes: same controls, same behaviour, same look everywhere except the faint shadow under the big image in the Linux desktop app.

Results

WebKitGTK 2.50.4 (the engine the Linux desktop app embeds), real GDK key events at 30 keys/s (an autorepeat rate), tauri + render-linux classes as in the app, Edit page with a 1328 px image selected, 40 characters per run, 3 runs each:

Page state Before (chars/s) After (chars/s)
Chat composer (control) 29.1 to 29.4 28.6 to 29.1
Edit, no source image 6.1 to 6.7 22.4 to 28.5
Edit, source image loaded 6.0 to 7.0 28.5 to 29.1
Edit, generation running 5.6 to 6.7 26.0 to 29.0
Edit, after generation stopped 5.7 to 6.3 29.2 to 29.4

Frame interval p90 while typing went from 126 to 154 ms to 18 to 33 ms.

Chromium (Playwright, same page), per-key time to the next frame, median: 33 ms to 23 ms unthrottled, 139 ms to 84 ms with 6x CPU throttling. Every run typed the exact text.

Also checked on gfx1151 (Strix Halo, the reporter's hardware) CI machines with real Z-Image-Turbo generations: GPU-composited Chromium on Linux and Edge on Windows kept up at about 60 chars/s, so the GPU work itself does not starve the window; the slowdown is specific to WebKitGTK painting this page.

Video prompt (same pattern, the page re-rendered on every keystroke), loaded model mocked:

Engine Before After
WebKitGTK, chars/s at 30 keys/s 19.9 to 21.0 28.4 to 28.6
Chromium, per key median 30 to 32 ms 18 to 19 ms
Chromium, 6x CPU throttle 162 to 182 ms 66 to 74 ms

Model Hub search, split view (Chromium, typing qwen, 3 runs each):

Before After
Router navigations while typing 4 keys 5 to 8 0
README pane remounts 2 to 4 0
Per key time to next frame 29 to 486 ms 16 to 48 ms
URL and preview after typing auto-picked first row same

With a model opened by the user, typing still closes it on the first key as before (navigations 8 to 2, same end URL).

Other surfaces checked the same way in WebKitGTK and already responsive (28 to 29 chars/s, like Chat): every Audio workflow with a text box (Text to Speech, Clone, Edit, Music), the Data Recipe editor, and the Library, Projects, Scheduled tasks, Export and API monitor search boxes.

Tests

  • npm test (13957 pass), npm run typecheck, tsc -p tsconfig.app.json
  • tests/studio/playwright_composer_deferred_prompt.py passes on Chromium, Firefox and WebKit; with a plain controlled textarea in its place it fails with the owner rendered inside 37 of 37 keystrokes
  • tests/studio/test_playwright_suites_run_in_ci.py

Screenshots

Edit page in WebKitGTK 2.50.4 with the desktop app's tauri and render-linux classes, image selected and text typed. The layout is the same on both sides; only the faint shadow under the large image is gone, and that shadow was what made every keystroke repaint slow (typing went from about 6 to about 29 chars/s at a 30 keys/s autorepeat).

Edit page in the Linux desktop webview, before and after

@danielhanchen danielhanchen self-assigned this Oct 26, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T06:05:19.943789Z de6c6f9 Manual request
🔒 Security Review ✅ Completed 2026-10-26T02:33:23.135297Z e3bd455 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex security review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: e3bd4552db

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: e3bd4552db

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 26, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

workflow-trigger lint fails on this PR for a reason specific to it (job 121370070664):

tests/studio/test_browser_simulations_retry_once.py::test_a_second_failure_still_fails_the_leg
E   AssertionError: expected each of the 3 drivers to set status=1 on a failed retry; found 4

The guard keeps the list of browser drivers that run under the one-retry wrapper in studio-composer-compatibility.yml (the tuple at tests/studio/test_browser_simulations_retry_once.py:20). This PR adds a fourth driver, playwright_composer_deferred_prompt.py, to that leg with its own || status=1, so the guard counts 4. Adding the new driver to that tuple should turn it green, and keeps the guard checking that the new driver also gets exactly one retry.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 61973845ad

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

@tredondo

tredondo commented Oct 26, 2026 •

Copy link
Copy Markdown

Thank you for the quick fix! I must wonder though, how come nobody has reported this before? No one ever edits their image editing instruction as they see the preview? Or as a new idea comes up?

I was going to request as a feature queuing edits, but I'm afraid there'll be no audience 😅

danielhanchen added a commit that referenced this pull request Oct 26, 2026
…ugh its aliases (#15319)

## Problem

`Repo tests (CPU, studio)` is red on main since #15233, so every PR
based on it fails the same check (for example #15306 and #15307):

```
tests/studio/test_model_picker_contracts.py::test_a_multi_quant_parent_row_still_has_no_gear
E   AssertionError: the multi-quant parent row lost the spacer that stands in for a gear
```

#15233 replaced the empty gutter spacer on an On Device multi-quant
parent row with a chevron in the same column, wrapped in
`ROW_ACTIONS_PINNED_CLASS`, which is `cn(ROW_ACTIONS_CLASS,
"opacity-100")`. The guard only accepted the literal name
`ROW_ACTIONS_CLASS`, so it read the renamed reference as a missing
gutter. Bisected locally: the test passes at 61cfbaa and fails from
2563513 (#15233) onwards.

## Product or test

The product is fine. What the guard protects is that the parent row has
no gear, because `playwright_model_config.py` finds gears by their
accessible name (`Inference settings for ...`) and reads "no gear" as
"this row expands". The new chevron is an `aria-hidden` button with no
label, so the driver still sees no gear. The test was too literal.

## Fix

- The gutter is matched through `ROW_ACTIONS_CLASS` and every constant
whose definition is built from it, read from `pickers.tsx` itself, so a
future alias does not reopen this. A new test checks that reader (it
finds at least one alias on main, and ignores a `ROW_ACTIONS_*` constant
that does not build on the gutter class).
- The check now reads the expandable branch of the parent row. Before,
the partial-repo branch's row-menu gutter also satisfied it, so removing
the gutter from the branch that expands still passed.
- New: that branch must not contain an `aria-label`, since a labelled
control there is what would break the driver's inference.

## Verification

- `tests/studio/test_model_picker_contracts.py`: 202 passed on main's
source (1 failed before this change).
- Sabotage, each run against main's `pickers.tsx` with one edit:
- gutter class removed from the expandable branch: fails (passed with
the old guard)
  - `<ModelLoadSettingsAction />` added to that gutter: fails
- the chevron button given `aria-label="Inference settings for x"`:
fails
- The guard also passes against the pre-#15233 `pickers.tsx`
(61cfbaa).
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 36d2f3201b

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

@codex review

2 similar comments
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: de6c6f985b

ℹ️ 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 danielhanchen changed the title Studio: keep Images typing responsive in the Linux desktop app Studio: keep Images, Video and Hub search typing responsive Oct 26, 2026
@danielhanchen
danielhanchen merged commit 9e1ddce into main Oct 26, 2026
58 of 61 checks passed
@danielhanchen
danielhanchen deleted the studio-images-typing-webkitgtk branch October 26, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Edit image: typing in the Instructions box is extremely slow during image generation

2 participants