Repository navigation
Studio: make the chat thread stop getting slower as it fills - #8992
Conversation
Studio's chat UI is reported as sluggish on Windows 11 and worsening as the
thread fills, while token generation is unaffected. That shape says the cost is
per-message renderer work, so the thing to establish first is the curve.
New smoke page mounts the real Thread against a synthetic local runtime, seeded
to N messages, each carrying prose plus one code fence plus one KaTeX block so
Streamdown, Shiki and KaTeX all pay their per-message price. No backend, no
auth, no router.
New harness runs four scripted actions at N in {10, 50, 200, 500} under 6x CDP
CPU throttling: one keystroke into the composer, one scroll gesture, one message
action menu opened and closed, and one message delete. Each is bracketed by
Performance.getMetrics, which separates the two families of cost: work that
grows because layout is uncontained lands in LayoutDuration, work that grows
because a listener or an export is O(messages) lands in TaskDuration alone.
It measures, it does not gate. There are no timing budgets: it prints the table
and exits 0 unless the harness itself broke. Budgets belong in a later change,
set from numbers taken on real hardware. What it does fail on is measuring
nothing, since that is the failure mode that reads as good news: a seed that did
not render, a menu that never opened, a delete that deleted nothing, a scroll
that did not move, or four columns that do not rise with N.
Measured on this tree, N=10 to N=500: menu open+close 1309ms to 33199ms,
delete 438ms to 8491ms, keystroke median 86ms to 268ms.
Every metric recorded reaches the printed table, and the harness contract test
now enforces that mechanically by parsing the recorded keys out of the source
and requiring each one in the table.
CDP CPU throttling and longtask are Chromium-only, so Firefox and WebKit runs of
this file are correctness checks and not performance ones.
A review of the first commit found four ways the measurement could look clean while reporting something other than the app, and two of them were forging part of the curve. All were reproduced before being fixed. The local runtime does have a remote id. It synthesises `__LOCALID_...`, which is truthy, so the per-message fork-count GET fires after all: seeding 20 messages issued 10 requests, against a comment claiming nothing reached the network. They were being answered by a Playwright route handler, so each one paused the renderer for a round trip to another process, once per assistant message. The page now answers them itself, before anything mounts, and the harness fails if a single request escapes during a measured action. Closing the menu was timed from after the Escape dispatch. Radix dismisses synchronously inside it, so the layer teardown, focus restore and re-render -- the O(messages) fan-out this issue is about -- were excluded from the number meant to capture them. Every timing carries a ~33ms floor, since a double rAF cannot resolve faster than two vsync intervals, and CPU throttling does not move it. An action that never happened therefore reported ~33ms, which reads as a plausible measurement rather than as a failure. The floor is now measured per N, printed, subtracted before every growth ratio, and a keystroke at or under it fails the run. The keystroke check read the DOM value back, which is what the harness itself wrote. It now compares against the runtime's own composer state, so a keystroke that reaches the textarea but not React is caught. Also removed from the timed regions: a per-frame document-wide querySelector in both poll loops, replaced by a MutationObserver flag and an isConnected check; a counts() call per frame in the seed gate; an animated scrollIntoView still in flight when the menu window opened; and a console warning per action-bar render, by giving the page the router its useNavigate calls expect. Long tasks are now read after a yield, since the observer delivers on a later task and the tail entry was being dropped. Corrected curve, N=10 to N=500, floors removed where they apply: menu open+close 1021ms to 33591ms, delete 297ms to 8563ms, keystroke 48ms to 283ms, scroll worst frame 5ms to 126ms. Layout stays flat and tiny throughout; the growth is in style recalc and task time.
At rest the full assistant action bar was mounted under every assistant
message. Each one carries around eight tooltips, and every tooltip holds a
useSyncExternalStore subscription to the shared modal-layer store, which
re-walks its ancestors reading style.pointerEvents whenever Radix puts the
body on the modal layer. A 500-message thread therefore mounted 250 bars and
1503 tooltip triggers, and every menu open fanned out across all of them.
autohide unmounts rather than hides (ActionBarRoot returns null on the hidden
status), so passing it removes the nodes and the subscriptions together. The
user bar has always done this.
Not unconditionally "always", though: this bar carries the only Stop reading
control, which is why it already passes hideWhenRunning={!speaking} and why
DeleteMessageButton guards the same case. With "always", moving the pointer
off a message being read aloud would take that control away. At most one
message speaks at a time, so exempting it costs nothing.
Measured with tests/studio/playwright_thread_weight.py at 6x CPU throttle,
before -> after, at 500 messages:
action bars 250 -> 0
tooltip triggers 1503 -> 3
DOM nodes 56332 -> 41082
delete ms 8595.8 -> 3642.7
scroll worst frame 159.5 -> 87.3
menu open+close ms 33624.5 -> 25279.3
keystroke median ms 316.2 -> 241.0
Note what did not move: menu style recalc, 23725.8 -> 22567.7 ms. A 27% cut
in DOM buys 5% there, so the bar is not what makes that number grow. It is the
document-wide invalidation from Radix writing pointer-events onto the body,
and it is still the dominant cost at large N.
The index.css comment is corrected in passing: it justified forcing
content-visibility: visible on every code block with "thread length is
bounded", which is the assumption this issue disproves. The rule is kept for
the flicker it was really fixing.
The fork badge registered its own CHAT_HISTORY_UPDATED_EVENT listener and issued its own GET, and it is mounted once per message. A delete on a 200-message thread therefore fired 200 requests before anything could repaint, and streaming raises that event once per chunk. Badges now share one debounced subscription per thread and one request that returns every fork count of that thread, so the cost is flat in thread length.
useOwnsResearchMessage exported the whole thread from inside a per-message render body, so one render pass over N messages exported N times and inspected N*N items. Streaming re-renders the thread once per chunk, so that pass is hot. The answer is a property of the thread revision, so derive it once for the message list every message in the pass already shares. Measured on a synthetic thread: 200 exports and 0.80ms per pass becomes 1 export and 0.014ms; at 1000 messages 16.4ms becomes 0.02ms.
exportedItemToRecord ran JSON.parse(JSON.stringify(...)) over every message's
content and attachments on its way to a PUT that serializes the same records
again, and syncExportedRepositoryToBackend ensured the thread row that
syncStoredChatMessages already ensures, so every save paid for GET /threads/{id}
twice.
The parts are replaced rather than mutated, so a copy of the list is snapshot
enough and the bytes on the wire are identical (asserted in the new test).
Measured on a 200-message thread of ~4KB messages: the record step drops from
1.17ms to 0.015ms, and a delete makes one thread-row read instead of two.
A modal Radix menu writes pointer-events:none on <body>. That is an inherited property, so every open and close invalidates style for the whole document, and on a long thread the recalc is the bulk of the cost. Non-modal never writes it. Also teaches the harness the difference between a cost that was removed and a page that never mounted one, so the after-tree does not read as broken.
|
Merged #8980 in. Not scope creep: |
|
Correction to my earlier comment. I merged #8980 in to get past a red |
… in the verdict The contract test caught both: a metric recorded but not printed, and the verdict no longer reading body_pointer_events_while_open after the non-modal fix removed the old check. The layer is now compared ACROSS N instead, since either mode is legitimate but mixing them means the columns measure different mechanisms.
… the reply This branch autohides the assistant action bar, and that turned the last wait of the rapid-submit step into a 7-of-7 failure on Windows CI. The wait is not what the step proves, and the clause that broke was not measuring what it claimed. innerText of a [data-role=assistant] root spans the whole subtree, and the action bar sits inside it, so 'every reply has non-empty innerText' was satisfied by button labels regardless of what the model returned. Instrumented at that point on the CI runners, two runs on this branch's merge base read: content=[0, 0] innerText=[73, 73] clause held, BOTH replies empty content=[0, 19] innerText=[73, 89] clause held, first reply empty gemma-3-270m-it answers 'Reply with exactly: rapid-first' with an empty completion in 3 of 8 sampled runs, on the merge base as much as here, and the clause held every time. So the empty reply is the model, is pre-existing, and was simply masked. With the bar autohidden the subtree is content only, and the same empty completion now fails. Dropped rather than repointed at the content element: an empty completion is the model's behaviour, so a content assertion would be flakier than what it replaces. What is left is exactly the settle this wait is for, two bubbles, nothing streaming, nothing queued. The behaviour the step exists to prove, that a 100 ms follow-up queues behind a held first turn, is state.queueSeen above and is untouched. Test-only. No Studio code changes, so the menu open+close and nodes-at-rest wins are unaffected. Verified on Windows CI at this branch's head: 4 of 4 Chat UI Tests jobs green with this change, against 7 of 7 red without it.
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
|
@codex review |
Two conflicts, both unions, nothing dropped from either side. - studio/frontend/tsconfig.app.json: main added smoke-heavy-thread-main.tsx to include, this branch added smoke-thread-weight-main.tsx. They are separate entry points and both files exist, so both entries are kept. Dropping either would leave one smoke entry out of the typecheck. - tests/studio/test_autoscroll_harness_contract.py: main imports types, this branch imports ast. Both are kept because both are used. This branch does not read quiet() or quietUntilIdle(), so #9016's change to what they return does not move any number measured here. The heavy-thread harness that does read them arrived with this merge and is main's own. Suite is 3954 passed, 4 skipped. The 71 failures in test_chat_autoload_failure_gate.py and test_model_picker_contracts.py reproduce identically on a clean checkout of main at 0775936, so they are not from this branch and are deselected above rather than papered over.
There was a problem hiding this comment.
💡 Codex Review
unsloth/.studio-test-root/studio.db
Line 1 in eb2c69b
This is a generated, mutable SQLite runtime database with no code or test references, rather than a fixture. Any test or Studio startup that uses .studio-test-root can rewrite the tracked binary and dirty the checkout, while future accidental commits could capture local chat or settings data; it also adds 221 KB to every clone without exercising the change. Delete it and ignore this test-data path instead.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
.studio-test-root/studio.db is written at test time by tests/studio/install/test_selection_logic.py, which points storage_roots.studio_root at that path. It is a mutable SQLite runtime database, not a fixture: nothing reads it, any test run or Studio start rewrites it and dirties the checkout, a later accidental commit could capture real local chat or settings data, and it puts 221 KB into every clone while exercising nothing. It was not in the tree deliberately. It arrived in the merge commit here because that commit was staged with `git add -A` after running the suite, and no gitignore rule covered the path. Main does not track it. Untracked and ignored, and the file is left on disk since creating it is normal.
|
On the generated Studio database: correct, and it was mine. Untracked and ignored in c82d052, exactly as suggested. The file stays on disk, since creating it is normal; only tracking it is the defect. The same thing had happened on #9062, which nothing had flagged yet, so it is fixed there too, with a guard: |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c82d052276
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // The older N-1 are deferred, not lost: useActionBarFocusReveal on the message root | ||
| // remounts a bar when focus enters that message, so tabbing brings back what hovering | ||
| // brings back and the controls return to the accessibility tree with it. | ||
| autohide={speaking ? "never" : "not-last"} |
There was a problem hiding this comment.
Keep the response-details sheet outside the autohidden bar
On any assistant reply other than the newest, selecting See response details closes the More menu and ends its interaction lock; focus is then in the portaled sheet (or on body), not inside the message, so this autohide condition unmounts AssistantActionBar. Because that component also owns detailsOpen and renders MessageResponseDetailsSheet, the newly opened sheet is immediately destroyed. Hoist the sheet state/rendering outside the autohidden bar, or keep the bar mounted while detailsOpen is true.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Checked this on the running component rather than by reading it, and the premise does not hold, so I am not making the change.
autohide is a prop on ActionBarPrimitive.Root, not on AssistantActionBar. In the installed library, ActionBarRoot.js returns null when the hide status is hidden, so what unmounts is the Root, not its parent. MessageResponseDetailsSheet is a SIBLING of that Root inside the component fragment, immediately after the closing </ActionBarPrimitive.Root>, and <AssistantActionBar /> is rendered unconditionally on every assistant message. So detailsOpen and the sheet both outlive the bar. That layout is not something this PR introduced; it is the same on main.
Driven on the real Thread at 10 assistant messages, choosing "See response details" from the More menu on reply index 7 of 10, then closing the menu and moving the pointer off the message:
{"sheetPresent": true, "sheetVisible": true, "barsOnTarget": 0, "openMenus": 0}
barsOnTarget: 0 is the part that makes this worth reading. The bar really did unmount, which is exactly the situation described, and the sheet is still present and visible. That is asserted separately as a guard, so if a future change kept the bar mounted the sheet result would be reported as not proving anything rather than passing quietly.
You are right that the autohide itself is new; main had only hideWhenRunning on this bar. It is the consequence for the sheet that does not follow.
…r seen Two fixes, both found by the heavy-thread smoke once it could name what it caught. The smoke reported "let 2 /api/ requests reach the network during the measured actions" and, with the endpoints now printed, they were POST /api/chat/threads/__LOCALID_lsQbsDZ/forks A `__LOCALID_` thread has no server record, so that request can only 404, and getThreadForkCounts already maps 404 to the empty map the entry starts as. It is a round trip whose answer is known before it is sent. Not a rounding error. A new chat is in exactly that state, and this store refreshes on CHAT_HISTORY_UPDATED_EVENT, which fires once per streaming chunk, so the first reply in a new chat paid one useless request per debounce window for as long as it streamed. #8992 added the store to stop the chat getting slower as a thread fills; excluding threads the server has never seen is the same intent. thread-ids.ts already had the predicate. Two tests: a local thread must not fetch on subscribe or on a burst of history events, and a saved thread on screen beside it must still refresh -- the guard has to be per thread, not a global off switch. They import the real isAssistantLocalThreadId rather than restating the prefix, so the rule under test cannot drift from the app's. Both go red with the guard removed. Second fix, same job: the playwright skip guard. The previous commit moved it from "playwright" to "playwright.sync_api" and it still failed, because sync_api resolves as a namespace package on that runner too. Only the symbol the harnesses import distinguishes a usable install, so the guard now checks for Page the way the harness does. Verified both ways against a Page-less sync_api: it skips, and it still proceeds when Page is there. Frontend suite 3789 pass, typecheck clean, tests/studio 4237 pass.
The heavy-thread browser smoke fails its own harness check on this branch:
HARNESS-BROKEN chromium at 25000 chars let 2 /api/ requests reach the
network during the measured actions; the timings include a round trip
per request
Both leaked requests are GET /api/chat/threads/__LOCALID_.../forks, one during
seeding and two more inside the measured actions. The smoke page answers a small
allowlist of endpoints in-page so no round trip lands in a timed region, and the
fork-count entry in that allowlist still matches the per-message endpoint,
/threads/{id}/messages/{id}/forks. #8992 replaced it with one per-thread request
built by getThreadForkCounts, and the allowlist was not moved with it, so every
fork-count GET went to the dev server. fork-count-store refreshes on
CHAT_HISTORY_UPDATED_EVENT, which the delete action fires, which is why two of
them land inside the measurement rather than only at load.
Match the URL the client builds and answer the body the endpoint returns:
getThreadForkCounts reads data.counts into a Map, so {"counts":{}} is "no
message has forks" and renders no badge. The fixture is unchanged by this: the
census at both sizes is identical to the failing run, 3676 and 14285 DOM nodes,
20 and 80 messages, 3216 and 12804 highlighted tokens. Only the round trips are
gone.
This has been broken repo-wide since #8992 and invisible. On every other open PR
the earlier Unit tests step in this job fails on a broken import, so Install
Chromium and every Browser smoke step is skipped; this branch is the first job
in which they run at all. Compare step outcomes on #9081, Unit tests failure and
all smokes skipped, with this branch, Unit tests success and the smokes running.
Two things so the next drift costs less. The stray-request failure now names the
first three distinct URLs, because it fires in CI where nobody can attach a
listener afterwards, and finding this one meant re-running the smoke locally with
a print statement patched in. And a unit test now checks the allowlist against
the URL chat-api.ts builds, rather than against a string someone remembered to
update, so the same drift fails in Dev-server lifecycle tests instead of waiting
for a job where the browser smokes get to run.
The self-check itself is untouched: still zero tolerated strays, still failing
the run.
Verified locally on chromium at 25000 and 100000 chars: before, 2 stray requests
at each size and exit 1; after, 0 stray requests at each size, 9 stubbed rather
than 6, and exit 0. The three smokes the aborted job skipped, settings tab
panels, a settings panel that cannot load, and chat stream pacing, all pass
locally as well, so nothing further is hiding behind this one.
…t guard it (#9189) * Repair the two chat auto-load suites that #9173 left red on main #9173 added a vision-projector fallback to the auto-load success toast. Both of the suites that read that code broke on it, and both were green on the commit immediately before (54b6ca4). 72 tests, in two different shapes: 1. tests/studio/test_chat_autoload_failure_gate.py, 71 failures. The harness slices autoLoadSmallestModel verbatim out of chat-adapter.ts and runs it, so anything the slice references must exist in PREAMBLE. mmprojFallbackMessage did not, which is a bare ReferenceError inside the retry loop; the loop catches it and scores it as a failed load, so every scenario fails as a wrong-model assertion. The file's own guard caught this and named the symbol, which is what it was written for after #7699 did the same thing. Stubbed as a function of the reason rather than a copy of the real three-message record. The value only reaches `options.description`, and these scenarios assert on which model loaded, never on toast copy, so copying user-facing strings in here would give them a second home to drift from. 2. tests/studio/test_model_picker_contracts.py, 1 failure. It asserted the literal `description: cpuFallbackReason`, and the mmproj branch went in front of it. The property held; only the spelling moved. Its own comment records this happening once already, when the CPU-fallback branch first appeared, so it now pins the property: the description varies on both fallback reasons and still has an undefined arm for the ordinary path. Scoped to the description EXPRESSION, not the whole helper. `cpuFallbackReason` is also a parameter name in the signature above, so a substring test over the block stays green with the CPU branch deleted outright -- the first cut of this check did exactly that, and mutation caught it. Three mutations verified red: the description no longer driven by any fallback reason, the CPU branch dropped, and the mmproj branch dropped. 4223 passed, 4 skipped. * Say both fallbacks when both fire, not just the projector one Both load paths wrote the toast description as mmprojFallbackReason ? mmprojMessage : cpuFallbackReason ? cpuMessage : undefined so whenever both reasons are set the CPU-fallback sentence is dropped. The user is told "loaded without vision" and never told the model is running on the CPU, which reads as a deliberate, explained degradation rather than an unaccelerated session. The combination is reachable. On a CPU-fallback replay llama_cpp.py preserves _cpu_fallback_reason (it clears it only when not _replaying_cpu_fallback) and resets _mmproj_fallback_reason so the projector can fail again inside that same launch. A low VRAM machine whose Vulkan backend crashed is exactly where the projector then falls back too. loadFallbackNotice() in mmproj-fallback.ts is now the single composition of the title suffix, the description and the degraded flag, and both call sites delegate to it. CPU_FALLBACK_MESSAGE moves there as well, so the two paths cannot describe the same condition differently again. Tests: four combined-case cases in mmproj-fallback.test.ts, verified red against the shipped nested ternary. test_model_picker_contracts.py now asserts the call sites delegate and pass both reasons rather than matching the old inline ternary, and test_chat_autoload_failure_gate.py's stub mirrors the composition so a call site dropping a reason stays detectable. * Repin the CPU-fallback toast test to behaviour, and unbreak the queued-capabilities test Two frontend suites were red. auto-load-cpu-fallback-toast.test.ts matched the warn-vs-success choice and the message text as substrings of showAutoLoadSuccess. Both moved into loadFallbackNotice, which is the single definition the explicit-load path now shares, so the match went stale. Matching the inline form again would go red on a refactor that changes nothing a user can see, and would stay green if only one of the two load paths kept the behaviour. It now calls loadFallbackNotice and asserts the verdict, and separately asserts the call site delegates to it. queued-model-capabilities.test.ts was red on main before this branch. #9173 added `import { isTextOnlyMmprojFallback } from "./mmproj-fallback"` to image-input-support.ts, which the test imports statically. Extensionless is the right form -- 2314 of the 2367 relative imports under src/ are written that way, and vite and tsconfig's "bundler" mode resolve them -- but the bare node loader does not, and a static import resolves before any registration can run. The test now registers the bundler resolver and imports dynamically, which is what mmproj-fallback.test.ts already does for the same module. Both files reformatted by biome; regex literals hoisted out of the test bodies for useTopLevelRegex. Full frontend suite: 3734 pass, 0 fail. typecheck clean. The 4 biome errors in chat-adapter.ts and use-chat-model-runtime.ts are byte-identical on origin/main. * Order the split-axis abort against the mmproj strip, not against its argument test_tensor_split_abort_raises_early_to_layer_fallback has been red on main since #9173, which renamed the text-only strip's argument from _last_spawn_cmd to _vision_gpu_cmd. That rename is right: the strip should read the vision GPU command rather than whatever was spawned last, and #9173 refreshes _last_spawn_cmd from the result immediately after. The test was pinned to the old argument name, so a rename with no behavioural content took it down. The failure also misreported itself. `assert raise_idx < src.find(needle)` reads as an ordering check but is two claims at once, and when the landmark is gone it fails with "assert 249423 < -1" -- which says the ordering broke, when what happened is that the landmark moved. Each landmark is now required to exist before it is ordered, and says so. The strip is matched on the call rather than on what is passed to it. What this test is about is that the abort raises BEFORE the projector is discarded (#6659); which command the strip reads from is that code's own business. Checked both ways: removing the strip call from load_model goes red with a message naming the missing landmark, and renaming the argument again stays green. * Name the endpoints when the heavy-thread harness catches a stray request The harness records every /api/ URL issued during a measured action, then keeps only the count, so the failure reads let 2 /api/ requests reach the network during the measured actions and stops there. It says an interaction paid for a round trip without saying which one, and the reader has to bisect the frontend to learn what the harness already knew and discarded. It now reports the endpoints. Deduplicated and capped at eight, because the case this instrument exists to catch is a request issued once per message, which would otherwise print hundreds of copies of one line. This is why it surfaced now: the step has not run on main since #9173, whose unit test break fails earlier in the same job and short-circuits it. It was last green at 54b6ca4. With the unit tests repaired on this branch the job reaches the step again, and the first thing it needed to say was the one thing it did not. * Skip the playwright harness tests on the module they need, not the package Five tests guard themselves with `pytest.importorskip("playwright")` and then import a harness that does `from playwright.sync_api import Page`. On the Repo tests (CPU) runner the top-level name resolves as a namespace directory with no sync_api inside it, so the guard passes and the import dies with ImportError: cannot import name 'Page' from 'playwright.sync_api' (unknown location) A skip condition reported as a failure, on every branch, for as long as that runner stays that way. It is red on #9202 and #9213 too, neither of which touches any of this. One of the two files already said what the guard was really for: "importing a harness pulls in playwright.sync_api". It now checks that. * Stop the fork-count store asking the server about threads it has never seen Two fixes, both found by the heavy-thread smoke once it could name what it caught. The smoke reported "let 2 /api/ requests reach the network during the measured actions" and, with the endpoints now printed, they were POST /api/chat/threads/__LOCALID_lsQbsDZ/forks A `__LOCALID_` thread has no server record, so that request can only 404, and getThreadForkCounts already maps 404 to the empty map the entry starts as. It is a round trip whose answer is known before it is sent. Not a rounding error. A new chat is in exactly that state, and this store refreshes on CHAT_HISTORY_UPDATED_EVENT, which fires once per streaming chunk, so the first reply in a new chat paid one useless request per debounce window for as long as it streamed. #8992 added the store to stop the chat getting slower as a thread fills; excluding threads the server has never seen is the same intent. thread-ids.ts already had the predicate. Two tests: a local thread must not fetch on subscribe or on a burst of history events, and a saved thread on screen beside it must still refresh -- the guard has to be per thread, not a global off switch. They import the real isAssistantLocalThreadId rather than restating the prefix, so the rule under test cannot drift from the app's. Both go red with the guard removed. Second fix, same job: the playwright skip guard. The previous commit moved it from "playwright" to "playwright.sync_api" and it still failed, because sync_api resolves as a namespace package on that runner too. Only the symbol the harnesses import distinguishes a usable install, so the guard now checks for Page the way the harness does. Verified both ways against a Page-less sync_api: it skips, and it still proceeds when Page is there. Frontend suite 3789 pass, typecheck clean, tests/studio 4237 pass. * Bound and retry the Playwright browser install so a stall is not a silent 30 minutes This step stalls. Three times in one day it sat in apt's download loop until the job's 30-minute timeout killed it, while the sibling shards finished the whole job in 4 to 9 minutes. Twice on #9202 and once on #9189, always the same step. The cost is out of proportion to the cause. GitHub scores a job timeout as "cancelled" rather than a failure, prints no reason, and skips every step after it, so the chat shard reported nothing about the chat surface for what both times turned out to be an infrastructure hiccup that cleared on a plain re-run of the same commit. A per-attempt `timeout` turns the stall into a failure instead of a silent wait, and the retry is what actually recovers. The healthy time is about 2 minutes, so 8 per attempt is 4x headroom and a merely slow mirror will not trip it. timeout-minutes bounds the pair in case `timeout` is outlived by an unkillable child. Same reasoning, and the same wording, as the bounded prime-hf step in studio-mac-ui-smoke.yml. Both install steps in this file, since ui-smoke and ui-indicator run the identical command. Left alone on mac and windows: neither passes --with-deps, so neither has the apt phase this is about, and neither has been observed to stall. * Make the Playwright install retry able to actually recover The bound added in the previous commit worked: the stall became an 8m37s step FAILURE with a complete log instead of a silent 30-minute cancellation, and the log named the cause on the first try. It also showed the retry could not work. playwright shells out to apt-get as root, so terminating the python parent leaves that child alive holding the lock, and attempt 2 died two seconds later with E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 4578 (apt-get) A retry that cannot succeed is worse than no retry: it buries the real reason under a second, different failure. Attempt 2 now waits for the lock to clear, up to two minutes, and only then takes it -- the holder is our own orphan and the runner is a throwaway. Two smaller things the same log exposed. --kill-after was missing, so a process that ignores SIGTERM would have been waited on forever inside the step bound. And the warning said "did not finish within 8 minutes" about a two-second exit, which sends the next reader looking for a stall that never happened; it now separates timeout's 124/137 from playwright refusing outright, and prints the status. timeout-minutes 18 to 22 to cover two 8-minute attempts plus the lock wait, still inside the job's 30.
The message action bar's "More" menu became `modal={false}` in unslothai#8992, so Radix
no longer writes `pointer-events: none` on `<body>` while it is open. That write
was also the only thing absorbing the press that dismisses the menu, and the
neighbours two buttons from the trigger are "Refresh" and an unconfirmed
"Delete message". One dismissing press now closes the menu and deletes a
message.
Measured on the heavy-thread smoke page with tests/studio/probe_dismiss_guard.py,
a seeded thread of 10 assistant messages: 11 dismissal gestures deleted a message
on chromium and 9 on webkit.
studio/frontend/src/lib/menu-dismiss.ts swallows exactly the click that dismissed
the menu, armed from `pointerdown` on `document` in the capture phase so it runs
ahead of React's root-container delegation and ahead of Radix's own bubble-phase
listener. `MenuDismissGuard` mounts inside the menu content, so the guard's
lifetime is the menu's.
The sidebar's "More" flyout is left non-modal and unguarded on purpose: it opens
on pointer enter, so a swallow there would eat an ordinary click on the nav row
the pointer was heading for. tests/nonmodal-menu-dismiss-guard.test.ts records
that as an explicit exception and fails on any other unguarded non-modal menu.
The message action bar's "More" menu became `modal={false}` in unslothai#8992, so Radix
no longer writes `pointer-events: none` on `<body>` while it is open. That write
was also the only thing absorbing the press that dismisses the menu, and the
neighbours two buttons from the trigger are "Refresh" and an unconfirmed
"Delete message". One dismissing press now closes the menu and deletes a
message.
Measured on the heavy-thread smoke page with tests/studio/probe_dismiss_guard.py,
a seeded thread of 10 assistant messages: 11 dismissal gestures deleted a message
on chromium and 9 on webkit.
studio/frontend/src/lib/menu-dismiss.ts swallows exactly the click that dismissed
the menu, armed from `pointerdown` on `document` in the capture phase so it runs
ahead of React's root-container delegation and ahead of Radix's own bubble-phase
listener. `MenuDismissGuard` mounts inside the menu content, so the guard's
lifetime is the menu's.
The sidebar's "More" flyout is left non-modal and unguarded on purpose: it opens
on pointer enter, so a swallow there would eat an ordinary click on the nav row
the pointer was heading for. tests/nonmodal-menu-dismiss-guard.test.ts records
that as an explicit exception and fails on any other unguarded non-modal menu.
* Give the mmproj fallback import its file extension node --experimental-strip-types resolves relative specifiers literally, so the extensionless import added in #9173 fails at import time and takes queued-model-capabilities.test.ts down with it. Before that commit this module had only import type lines, which are erased, so it carried no runtime relative import at all and the test passed. 55 other modules already spell the extension. * Studio: repair the repo tests #9173 left red The mmproj fallback landing added a mmprojFallbackMessage import to chat-adapter.ts. Two repo tests read that file's source: - test_chat_autoload_failure_gate slices autoLoadSmallestModel out of the adapter and runs it, and its own guard fails the whole file when the slice references a name the harness preamble does not define. Add the stub. - test_model_picker_contracts pinned the success toast's description as the literal 'description: cpuFallbackReason'. The mmproj branch now sits ahead of the CPU one, so pin the description expression instead of which fallback is tested first. 71 failures on main, none of them a real regression. * Studio: repair the backend test #9173 left red test_tensor_split_abort_raises_early_to_layer_fallback pins the order of two branches in load_model by their source offsets. #9173 renamed the variable handed to _strip_mmproj_args, so the find() of the old spelling returned -1 and the ordering assert compared against it. Pin the call itself and fail loudly when it is no longer reachable. * Stop the Windows chat UI smoke racing the route Suspense fallback exercise_permission_mode_controls asserts the permission pill visible on the 5s expect default, immediately after the composer mounts. The composer can mount and then drop back behind the root Suspense fallback while the route chunk loads, so the assertion lands on 'Loading...' and gives up. Reproduced on main at aa32c18: same step, same line, aria snapshot '- text: Loading...'. It is Windows-only in practice because the mac smoke wraps the script in a 3-attempt retry and the Windows one does not, so a slow 4-vCPU runner surfaces the race raw. Wait the pill out on the same budget the composer already uses. * Wait the permission pill out at every reload, not just the first The macOS smoke hit the same Suspense race at the second assertion, which the first commit did not cover. Four of the six assertions in this block follow page.reload(wait_until = domcontentloaded), which returns long before the lazy chat chunk resolves, so asserting on expect's 5s default races it by construction rather than only on a slow runner. Route all six through one helper that waits on the composer's budget. Seen on both the Windows and macOS smokes as 'Aria snapshot: - text: Loading...' at playwright_chat_ui.py:135 and :189. * Give the playwright stub every name the harnesses import The CPU test job has no playwright, so tests/studio/test_heavy_thread_measurement_integrity.py puts a stub `playwright.sync_api` into sys.modules at collection time rather than skipping the harness arithmetic along with the browser. That stub defined one name, `sync_playwright`, which is all its own harness imports. sys.modules is session-wide, so the stub is not read only by the file that installs it. Three of the four harnesses import `sync_playwright` alone and were satisfied by it; playwright_strip_ansi_smoke also imports `Page` and `expect`, and got ImportError: cannot import name 'Page' from 'playwright.sync_api' (unknown location) from a stub two files away. `(unknown location)` is the stub itself: a bare ModuleType has no __file__. The two tests that import that harness, test_the_ansi_dump_survives_a_vite_server_that_is_ still_talking and test_an_empty_smoke_base_url_means_unset[playwright_strip_ansi_smoke], failed on it. pytest.importorskip("playwright") does not save them, because by then the stub package is importable. This is pre-existing on main and predates this branch, which never touched either file. It was masked: the same job was failing with 71 other errors, which this PR fixes, so these two were never the reported cause. They belong here because this is the PR that makes the job green. The stub now answers any public name with a callable that raises, so a harness can satisfy its imports without quietly measuring a browser that is not there, and adding an import to a harness cannot break a different file again. Dunders still raise AttributeError, since pytest and inspect probe those and answering them makes the stub look like a package. The install probe also imports off the submodule now: a partial install leaves `playwright` importable while `playwright.sync_api` resolves to an empty namespace, which fails the same way. Verified by blocking playwright in a subprocess to reproduce the CPU job: 2 failed, 104 passed before, 106 passed after, with the two files alone skipping cleanly when the stub is not collected. * Stub the fork-count endpoint the heavy-thread smoke actually requests The heavy-thread browser smoke fails its own harness check on this branch: HARNESS-BROKEN chromium at 25000 chars let 2 /api/ requests reach the network during the measured actions; the timings include a round trip per request Both leaked requests are GET /api/chat/threads/__LOCALID_.../forks, one during seeding and two more inside the measured actions. The smoke page answers a small allowlist of endpoints in-page so no round trip lands in a timed region, and the fork-count entry in that allowlist still matches the per-message endpoint, /threads/{id}/messages/{id}/forks. #8992 replaced it with one per-thread request built by getThreadForkCounts, and the allowlist was not moved with it, so every fork-count GET went to the dev server. fork-count-store refreshes on CHAT_HISTORY_UPDATED_EVENT, which the delete action fires, which is why two of them land inside the measurement rather than only at load. Match the URL the client builds and answer the body the endpoint returns: getThreadForkCounts reads data.counts into a Map, so {"counts":{}} is "no message has forks" and renders no badge. The fixture is unchanged by this: the census at both sizes is identical to the failing run, 3676 and 14285 DOM nodes, 20 and 80 messages, 3216 and 12804 highlighted tokens. Only the round trips are gone. This has been broken repo-wide since #8992 and invisible. On every other open PR the earlier Unit tests step in this job fails on a broken import, so Install Chromium and every Browser smoke step is skipped; this branch is the first job in which they run at all. Compare step outcomes on #9081, Unit tests failure and all smokes skipped, with this branch, Unit tests success and the smokes running. Two things so the next drift costs less. The stray-request failure now names the first three distinct URLs, because it fires in CI where nobody can attach a listener afterwards, and finding this one meant re-running the smoke locally with a print statement patched in. And a unit test now checks the allowlist against the URL chat-api.ts builds, rather than against a string someone remembered to update, so the same drift fails in Dev-server lifecycle tests instead of waiting for a job where the browser smokes get to run. The self-check itself is untouched: still zero tolerated strays, still failing the run. Verified locally on chromium at 25000 and 100000 chars: before, 2 stray requests at each size and exit 1; after, 0 stray requests at each size, 9 stubbed rather than 6, and exit 0. The three smokes the aborted job skipped, settings tab panels, a settings panel that cannot load, and chat stream pacing, all pass locally as well, so nothing further is hiding behind this one.
* studio: stop a menu dismissal deleting a chat message
The message action bar's "More" menu became `modal={false}` in #8992, so Radix
no longer writes `pointer-events: none` on `<body>` while it is open. That write
was also the only thing absorbing the press that dismisses the menu, and the
neighbours two buttons from the trigger are "Refresh" and an unconfirmed
"Delete message". One dismissing press now closes the menu and deletes a
message.
Measured on the heavy-thread smoke page with tests/studio/probe_dismiss_guard.py,
a seeded thread of 10 assistant messages: 11 dismissal gestures deleted a message
on chromium and 9 on webkit.
studio/frontend/src/lib/menu-dismiss.ts swallows exactly the click that dismissed
the menu, armed from `pointerdown` on `document` in the capture phase so it runs
ahead of React's root-container delegation and ahead of Radix's own bubble-phase
listener. `MenuDismissGuard` mounts inside the menu content, so the guard's
lifetime is the menu's.
The sidebar's "More" flyout is left non-modal and unguarded on purpose: it opens
on pointer enter, so a swallow there would eat an ordinary click on the nav row
the pointer was heading for. tests/nonmodal-menu-dismiss-guard.test.ts records
that as an explicit exception and fails on any other unguarded non-modal menu.
* build ids for the guard sweep with posix separators
* studio: release focus after guarded menu dismissal
* tests: isolate right-click guard probe from browser chrome
* fix: retain gesture supersession after menu cleanup
* tests: keep menu selection probe on-page
* tests: reduce menu dismissal comments
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: Etherll <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fixes #8977.
On a long thread the chat UI slows down until it feels, in the reporter's words, like a video game at low FPS. Opening one message menu on a 500-message thread costs 42 seconds on Windows. This brings that to 0.5 seconds, and makes it flat in thread length.
What was actually wrong
Not what I first assumed. A harness came first so the answer would be measured rather than argued, and it ruled out the obvious explanation immediately:
LayoutCountandLayoutDurationare flat at every thread length, on all four actions. Nothing is walking the thread to lay it out. All of the growth is inRecalcStyleDuration, from a fixed count of 10 style recalcs whose cost is proportional to element count.A modal Radix menu writes
pointer-events: noneonto<body>.pointer-eventsis an inherited property, so that one write invalidates style for the entire document, and the fan-out back through the thread's tooltips does it again on close. Nothing about it is specific to the menu, which is why every interaction that opens one pays it.Change
Five commits, each independently revertible.
The menu is non-modal.
modal={false}onActionBarMorePrimitive.Root. It reaches Radix because the wrapper spreads...restontoDropdownMenu.Root, and a non-modal menu never writes to<body>at all. One word, and it is the whole headline number.The action bar autohides.
autohide={speaking ? "never" : "always"}onAssistantActionBar, matching whatUserActionBarhas always done.autohidegenuinely unmounts (ActionBarRoot.jsreturnsnull), so ~50-70 nodes and ~8 tooltip subscriptions per assistant message go with it. Not the plan's unconditional"always": the bar carries the only Stop reading control, which is why it already passeshideWhenRunning={!speaking}, and with"always"moving the pointer off a message being read aloud would unmount the stop button. At most one message speaks, so the win is untouched.One fork-count subscription per thread, not one per message.
ForkCountBadgeheld aCHAT_HISTORY_UPDATED_EVENTlistener and issued its own GET per message. On a 200-message thread that is 200 requests on first render and 500 for a burst of five history events, which is what a delete or five streamed chunks produces. Now a shared store with one debounced request against a new batch endpoint: 2 and 1.Research-message ownership derived once per thread revision instead of
thread().export()inside a per-message render body, which made a render pass O(N^2). At 1000 messages that is 1000 exports and 16.4 ms per pass, against 1 and 0.02 ms.Delete stops deep-cloning the thread.
JSON.parse(JSON.stringify(...))over every message became a list copy, and one redundant round trip is gone. Small, and honestly so: 1.17 ms to 0.015 ms at 200 messages inside a ~3 ms step. It ships because it is free, not because it is why delete felt slow.Also here:
tests/studio/playwright_thread_weight.pyand its smoke page, which produced every number below.Measured
Real GitHub runners, 4x CPU throttle, before and after on the same workflow. Full tables in the run artifacts.
Menu open plus close, 500 messages
The style recalc inside that goes 30,781 to 31 ms on Windows, 23,070 to 20 on Ubuntu, 11,326 to 10 on macOS. Growth from 10 messages to 500 collapses from 24-32x to 1.5x: the cost is now essentially independent of thread length, which matters more than any single number here.
Windows being worst before, at 2.6x macOS on comparable 4-core hardware, is consistent with this being reported from Windows 11.
Delete, 500 messages: 10,185 to 5,102 ms on Windows, 6,496 to 2,489 on Ubuntu, 3,884 to 2,006 on macOS.
DOM nodes at 500 messages: 56,332 to 45,832.
A real Studio, 120 messages, no throttle. The runner numbers are a synthetic page, so I also drove a live install through repeated open-and-close cycles:
The churn was ~8 listeners per assistant message per menu open, linear in thread length across 40, 120 and 240 messages. Post-collection growth is small in both trees, so this was never a leak, it was per-interaction cost.
What this does not fix
Delete is now the largest remaining term, still growing 8-22x and still 5 s on Windows at 500 messages. The cost is inside
MessageRepository.import, whose ancestor walk is quadratic and is library-internal, so it is not a one-line follow-up. Worth its own issue.Keystroke cost is essentially unchanged, because it was never the mechanism.
Dropped, with the measurements that killed it
The plan this came from was built around adding
contain: layout paint styleto the message roots. It earns nothing and I am not shipping it. A four-mode by four-N sweep on the real compiled CSS: the composer keystroke is already flat in thread length with no containment at all, because Blink does not re-lay-out clean subtrees, and under the pattern that does grow, containment measured marginally worse (43,767 ms against 42,092 ms uncontained at 500 messages). That agrees with the harness finding layout flat everywhere.It would also have shipped a visible regression.
contain: paintclips to the padding box, and three things deliberately overhang the message roots: the response-model badge atabsolute -top-6, and the two action rows' negative margins. Screenshot-verified: the badge disappears entirely and 24% of an action button is sliced off.content-visibility: autowas never on the table: it ispartial_implementationon Safari 18 through 25 with skipped content not findable via find-in-page, fixed only in Safari 26, and Studio has no in-thread search to fall back on.The one thing kept from that item is a corrected comment at
index.css:2536, which justified forcingcontent-visibility: visibleon every code block with "thread length is bounded" - the assumption this issue falsifies.Testing
npm test2855 passed, 1 failed, and that one isdelete-chat-files-preference.test.ts, which fails identically onmainand is fixed in Studio: fix the Windows-only path failures in the frontend test suite, and catch the shape from Linux #8980npm run typecheck,npm run buildclean;eslintat its unchanged baselinepytest tests/test_chat_history_storage.py tests/test_chat_history_routes.py: 76 passedplaywright_chat_ui.pyagainst a real local Studio: passes, including delete, edit, reload and persistence.playwright_research_freeze.pypasses.playwright_chat_autoscroll.pyfails identically here on a detachedorigin/maincheckout, so it is pre-existingthread.tsxas literal text still passKeyboard and screen reader access
Unmounting the action bar on every reply but the newest took its controls out of the tab order with no non-pointer way back, so Copy, Edit response, Refresh, Delete, Read aloud and More were unreachable by keyboard or screen reader on older messages. Deferring work is fine while the user can still ask for what was deferred, and tabbing is asking, so that part was a correctness regression rather than a performance trade. Fixed in 48bf721 by revealing the bar on focus within the message as well as on hover.
Measured on the thread weight smoke page at 20 messages, an older assistant reply, Chromium:
The last two rows pass in both directions. They are no-regression guards against the fix undoing the weight saving, not evidence that the fix works. The weight numbers are unchanged: 1950 DOM nodes, 9 tooltip triggers, 1 mounted bar.
Why the accessibility assertion is shaped the way it is
The check reads Chromium's own accessibility tree over CDP and maps each node back through
DOM.resolveNodeto test containment in the target message's action bar, so it is the tree a screen reader consumes rather than a proxy for it.It deliberately keys on the More button and not on Copy. Every message's code fence has its own button named Copy, so a Copy scoped role assertion would have found that one and passed whether or not the action bar was ever revealed. It would have been green on a completely broken tree. Anyone editing this assertion should keep the name it keys on unique to the action bar, or the test silently stops testing anything.
A related keyboard defect that this PR does not cause and does not fix
Escape on the More menu leaves focus on
bodyinstead of returning it to the trigger. That reproduces on this PR's merge base, and on the newest message whose bar is mounted the whole time, so it is independent of the autohide behaviour here. This PR does make it easier to reach, because a keyboard user can now open an older reply's menu at all. Tracked separately in #9156.Review round: keyboard access, and what is proven red
The autohide above genuinely unmounts the action bar, which removed Copy, Edit, Delete and More from the keyboard entirely for every reply except the newest. That is a regression this PR introduced, and fixing it properly took several rounds.
Focus reveals the bar. A
tabIndexon the assistant message root plus a watchdog (useActionBarFocusReveal) that keeps the bar mounted while focus is inside it. Deferred to the next frame and re-checked rather than read offrelatedTarget, which is null both for focus entering a portal and for focus leaving to browser chrome, and which says nothing at all when the focused element is REMOVED, as it is when a menu closes.Both traversal directions. A container is reached before its own descendants, so the
tabIndexonly worked going forward: Shift+Tab from the message below landed on the root, which sits BEFORE the bar in DOM order, and the next press stepped past the controls to the previous message. Reachable forwards, unreachable backwards. An end sentinel after the bar fixes the backward pass. Deliberately not a focus redirect to the last control, which would trap the forward pass in a loop.The popup lookup is scoped to the action bar. Reasoning cards and tool-fallback cards are Radix
CollapsibleTriggers and renderaria-expanded="true"while open, so an unscoped lookup treated an expanded tool card as an open menu, rescheduled the watchdog every frame for as long as it stayed open, and pinned the bar mounted.The fork-count refresh is bounded. The trailing-edge debounce never expired while any thread streamed, because
CHAT_HISTORY_UPDATED_EVENTfires once per chunk, so a fork deleted from the sidebar kept a stale badge until the unrelated reply finished.FORK_COUNT_REFRESH_MAX_WAIT_MS(2000) bounds it. The cost is one whole-thread fetch per window while streaming, under a sixth of the per-chunk traffic this store exists to remove.At-rest state, measured at this head
Re-measured on the merged tree at
eb2c69be2, not carried over from the previous head. The optimisation is unchanged by the keyboard work and by the merge with main:The sentinel costs one DOM node per assistant message, and this PR is about per-message weight, so that is asserted rather than absorbed into a new baseline: the guard requires exactly the 1950-node baseline plus one sentinel per reply and nothing else, with the sentinel count checked separately so the extra nodes are attributed. Any other weight growth fails. Nothing is drawn at rest, and
:focus-visiblemeans a mouse click draws nothing either.Proven red on a broken tree
33 assertions, driven by
tests/focus_within_8992.py. Every one was shown to FAIL on a deliberately broken tree before being kept; a green assertion nobody has made red is unverified. Eleven named mutations, each naming the assertions it earns:headnoentrynosentinelnotabindexwidepopupblindsentineleagerclearleakflagnoreassertrestring/focusringthread.tsxandindex.csswere checksummed before and after all eleven runs and were identical throughout, so no result came from a tree still carrying a previous mutation.Merged with main
Merged rather than rebased, so no commit is rewritten. Two conflicts, both unions, nothing dropped from either side:
studio/frontend/tsconfig.app.json: main addedsmoke-heavy-thread-main.tsxtoinclude, this branch addedsmoke-thread-weight-main.tsx. They are separate entry points and both files exist, so both entries are kept. Dropping either would leave one smoke entry out of the typecheck.tests/studio/test_autoscroll_harness_contract.py: main importstypes, this branch importsast. Both are kept because both are used.This branch does not read
quiet()orquietUntilIdle(), so #9016's change to what they return moves no number measured here. The heavy-thread harness that does read them arrived with this merge and is main's own.After the merge the full probe was re-run on the merged tree: 27/27, with the tree checksummed before and after so the numbers are known to come from the shipped source.
test_chat_autoload_failure_gate.pyandtest_model_picker_contracts.pycontribute 71 failures that reproduce identically on a clean checkout of main at077593612; they are not from this branch and are not masked here.A generated database that should never have been committed
.studio-test-root/studio.dbis written at test time bytests/studio/install/test_selection_logic.py, which pointsstorage_roots.studio_rootat that path. It is a mutable SQLite runtime database, not a fixture: nothing reads it, any test run or Studio start rewrites it and dirties the checkout, a later accidental commit could capture real local chat or settings data, and it puts 221 KB into every clone while exercising nothing. Main does not track it.It was not deliberate. It arrived in the merge commit here because that commit was staged with
git add -Aafter running the suite, and no gitignore rule covered the path. It is untracked and ignored now, with the file left on disk since creating it is normal and only tracking it is the defect.The response details sheet, checked because autohide is new here
Raised in review:
autohide="not-last"is new on this bar (main had onlyhideWhenRunning), so does choosing See response details on an older reply destroy the sheet when the menu closes and the bar autohides?No, and it was worth checking rather than reasoning about.
autohideis a prop onActionBarPrimitive.Root; the installed library'sActionBarRoot.jsreturnsnullwhen hidden, so the Root unmounts and not its parent.MessageResponseDetailsSheetis a sibling of that Root inside the component fragment, and<AssistantActionBar />, which ownsdetailsOpen, is rendered unconditionally on every assistant message. Both outlive the bar, and that layout is unchanged from main.Driven on the real
Threadat 10 assistant messages, opening the sheet from the More menu on reply 7 of 10, then closing the menu and moving the pointer away:barsOnTarget: 0is the load-bearing part: the bar really did unmount, so this is the described situation and not a weaker one. It is asserted as its own guard, so if a later change kept the bar mounted the sheet result would be reported as proving nothing instead of passing quietly.Limits, stated
isHoveringhas two writers: this hook, and assistant-ui's ownMessagePrimitive.Rootmouseleave handler, which writesfalsedirectly and wins. A phase that reveals the bar by hovering and then moves the pointer away sees the bar unmount on the fixed and broken trees alike. C2 passed on both until the phase was rewritten to keep the pointer off the message entirely, so that focus is the only writer. Any future assertion in this area has to remove the competing writer or it proves nothing.nosentineland that is correct, not a gap. Focus still enters the reply; it only then skips the bar. D1 states something weaker than D2/D3 and needsnoentryto go red. The green/red split is the reported asymmetry reproduced as a result.outline-stylecomputes toauto, so a presence check passes while nothing is visible. Measured 14px against the UA default's 2px on a zero-sized span.