Repository navigation
Studio: turn navigator at the chat's left edge, building on #11668 - #16300
Conversation
… T3 Code's minimap design
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Breezy! 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". |
|
The That fits the turn navigator being rendered at the thread's left edge. The run had |
… popup surface for the card
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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: Didn't find any major issues. 🚀 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". |
# Conflicts: # studio/frontend/src/features/settings/tabs/chat-tab.tsx
# Conflicts: # studio/frontend/src/features/settings/tabs/chat-tab.tsx
- Only the hover fisheye animates, on the scale property the dashes actually use; the in-view tint switches without a colour transition, which restyled the rail every scrolled frame. - The edge fades set the rail's mask directly instead of inherited custom properties that restyled every marker. - The rail mounts from a local settled flag; the published turn map was never read. - Bookmarks use bookmark-01, as everywhere else since #16409.
Hovering a message mounts its action bar, and Chromium then rechecked every :has() anchor above it. With any :has() rule over a broad subject, that restyled the whole chat and sidebar (about 10k elements, roughly 30 ms per hover on a 200-turn chat). - A Vite plugin rewrites Tailwind's group-has-* and peer-has-* output from X:is(:where(.group):has(A) *) to :where(.group):has(A) X: the same match and specificity, which Chromium invalidates precisely. - The composer pills' hover swap sets a variable on the glyph instead of styling > :not(.composer-pill-x) behind a :has(). - The glass sidebar rule matches a focused or open button itself instead of asking the row with :has(). - The glass page-route wallpaper rules use the root flag background.tsx already sets. - The avatar group count sizes its icon through a variable.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 191850c3ff
ℹ️ 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".
| } | ||
| } | ||
| return () => observer.disconnect(); | ||
| }, [viewportRef, signature, turnCount]); |
There was a problem hiding this comment.
Refresh visibility observers when prompt rows are replaced
When a user edits a prompt and then cancels, ThreadMessage switches from UserMessage to EditComposer and back, replacing the observed MessagePrimitive.Root. The opener signature and turn count remain unchanged, so this effect never reruns and the observer keeps watching the detached element. That turn's marker consequently stops updating its on-screen tint until the turn list changes or the navigator remounts. Reattach observation when message elements are replaced, or observe a stable row wrapper.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Reproducible but cosmetic: after an edit is cancelled, only that turn's on-screen tint can go stale until the next turn arrives. Jumping, the preview card and bookmarks look messages up fresh by id, so nothing is lost or misrouted. Re-observing on every replaced row would mean a MutationObserver over the thread, which is the cost this PR removes.
|
Codex Review: Didn't find any major issues. Hooray! 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: Didn't find any major issues. What shall we delve into next? 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". |
…#16464) ## Summary `Parity verdict, scored against the null` fails on unrelated PRs whose base includes #16300 (`d56738f404`, the turn navigator at the chat's left edge). In the last two hours it failed on #16458 (a backend-only change) and on staging for #16463 and #16435, each time the same way: ``` matched: 0 unstable actions differing: 32 (expected to vary; not a verdict) NOTHING WAS COMPARED. ... This is not a pass. ``` In the null control (the same build on both arms), every action's thread scaffold digest differs, even between two repetitions on the same arm, while its length stays equal (`thread scaffolding outside any message (24167->24167c)`). That is an instance id leaking into the structural signature. #16300 renders the navigator inside the thread root, outside every message, as one button per turn with `data-turn-id={openerId}`. `openerId` is the turn's opening message id (`thread-turns.ts` pushes `message.id`). `scene/parity.js` already drops the values of `data-message-id`, `data-thread-id` and the other id attributes it knew about, but not this new one. Studio's message ids are short and random, so `ID_RE` does not catch them in the value either. The product is fine; the instrument fell behind the DOM. ## Change - **`tests/studio/studiobench/scene/parity.js`:** an attribute is volatile if it is in `VOLATILE_ATTRS`, or if its name matches `data-*-id`. A volatile attribute keeps its presence in the signature and loses only its value, as before. - Every `data-*-id` in the frontend names an instance, e.g. `data-turn-id`, `data-queue-item-id`, `data-bookmark-id`, `data-entry-id`. - So the next one added inside the thread cannot silently empty the verdict the way this one did. - Non-id data attributes (`data-turn`, `data-role`, `data-state`, ...) still compare by value. - **`tests/studio/studiobench/fixture/selftest/test_studiobench_parity_digest.py`** (these run the shipped `parity.js` under node): - `test_every_data_id_attribute_is_volatile`: two different `data-turn-id` values sign the same, a button with the attribute still differs from one without it, and the same holds for `data-queue-item-id`. - `test_a_data_attribute_that_is_not_an_id_still_moves_the_signature`: `data-turn="1"` against `"2"` still differs. ## Testing - `tests/studio/studiobench/fixture/selftest`, `sweep/selftest` and `analysis/selftest`: 606 passed. - Sabotage: with main's `parity.js`, `test_every_data_id_attribute_is_volatile` fails; the other new test passes on both. - Not proven here: I did not rerun the full parity sweep locally. The PR's own parity job is the end-to-end check. On main's harness it should report a non-zero `matched` count on this PR, as the runs before #16300 did (28 or 29).
…the chat grows (unslothai#16801) Adds a browser CI gate that fails when typing in a long chat costs more as the chat grows, the shape of unslothai#16603. **Stacked on unslothai#16656. Please merge unslothai#16656 first**: this branch contains its commits, and the gate fails on current `main` by design (that is the regression it catches). ## Why unslothai#16603 came back because nothing in CI measured per-keystroke cost against chat length. Bisecting the Studio frontend from `v0.1.913` to `main`: | Build (200-turn agent chat, about 427K tokens) | Style work per keystroke | | --- | --- | | before unslothai#16333 | 15.6 ms | | unslothai#16333 (wallpaper fade `:has()`) | 619 ms | | `v0.1.914-beta` | 144 ms | | `main` | 136.5 ms | | `main` + unslothai#16656 | 4.6 ms | unslothai#16333 added a descendant `:has()` on elements that hold the whole thread (`[data-wallpaper-workspace]`, `[data-chat-content-root]`), so Chromium (Desktop, Chrome, Edge) walks every message on each keystroke. Firefox is not affected, which matches the "browser is fine" reports. unslothai#16751 (Reduce Motion default off) then made scroll pay that walk more often (61 ms to 188 ms per wheel step), which is why turning Reduce Motion back on did not help typing. unslothai#16300 (`d56738f40`) already removed two other unslothai#16333 rules that restyled the whole page on every key (real-app bisect: 563.8 to 91.2 ms per key), which is why 0.1.914 was slow but not as slow as unslothai#16333. The fade rule stayed. unslothai#16656 removes every such rule and adds a static guard test; this PR adds the runtime gate so a new rule of that shape, or anything else that scales with chat length, cannot ship again. ## What the gate does `tests/studio/playwright_long_thread_gate.py` runs **first** in every frontend lane, right after `npm ci`: Frontend CI (Linux, Windows), Composer compatibility (Ubuntu, macOS, Windows, Safari) and Inline images (Ubuntu, macOS, Windows). 1. Builds `smoke-thread-weight.html` for production (`vite.long-thread.config.ts`) and seeds an agent-style history inside the real app ancestors (`?shell=1`: sidebar workspace, wallpaper, chat content root) with open reasoning, tool cards, web sources, compaction markers, code, KaTeX and tables. The fixture shape is checked, so a fixture that stops rendering something fails. 2. Measures the 200-turn chat first. Two untraced keys decide how much to trace: a healthy page traces 10 keys, a slow one 2, and a page hundreds of times slower than healthy fails on the untraced number alone. 3. Fails if `:has()` matching costs more than 5 ms per key at 200 turns, or if total selector matching per key grows more than 2x from 40 to 200 turns. A second repeat runs only when the ratio is near the limit. Both checks are ratios or tiny budgets on selector matching, so a slow runner cannot fail them. ## What a failure says A failure prints ms per key at each size, how far over budget it is and the top selectors with their match attempts. Selectors tried on most of the DOM are marked as likely victims of a whole-page restyle. It then pins down the trigger: it removes `:has()` rules from the stylesheet text before fresh page loads (rules switched off in a page that already rendered leave Chromium's `:has()` state behind and blame the wrong rule) and bisects for the rule whose removal makes typing cheap, trying rules that search an element holding the thread first. Each rule found is mapped to its likely source with a text match, worded as a possibility. On current `main`: ``` FAIL: :has() matching costs 63.6 ms per keystroke at 200 turns, budget 5.0 ms (12.7x over); total selector matching 358.9 ms/key pin-down at 60 turns, untraced style recalc per keystroke: 48.5 ms with all 262 :has() rules, 1.1 ms with none of them Measured: removing only this rule takes the keystroke from 48.5 to 1.8 ms (no :has() rules: 1.1 ms); this rule on its own costs 4.9 ms: :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready] .chat-wallpaper-image[data-fade="false"]) .thread-bottom-fade It is possible this section caused the issue, but we cannot be sure (a text match): studio/frontend/src/index.css:6210 (exact text match) Pattern: `:has(> .chat-wallpaper[data-ready] .chat-wallpaper-image[data-fade="false"])` on `:is([data-wallpaper-workspace], [data-chat-content-root])` searches all descendants (no leading `>`, or a space inside), so Chromium re-walks everything under that element after each DOM change, whether or not anything matches. `[data-wallpaper-workspace]` (first found in studio/frontend/src/app/routes/__root.tsx:720) holds the whole thread, so every keystroke walks every message. ``` `tests/studio/test_css_culprit.py` covers the source mapping and the `:has()` shape check. ## Replay against past stylesheets The gate on this branch, with only `index.css` swapped in from each commit (CPU runner): | `index.css` from | Verdict | Time | Pin-down | | --- | --- | --- | --- | | before unslothai#16333 (`4ce36bc3b5`) | PASS | 25 s | | | unslothai#16333 (`65e868dcf5`) | FAIL | 104 s | fade rule: 276.0 to 1.5 ms without it | | unslothai#16442 (`6401ceda29`) | FAIL | 105 s | fade rule | | `v0.1.914-beta` | FAIL | 101 s | fade rule | | `main` | FAIL | 104 s | fade rule: 48.5 to 1.8 ms without it | | this branch | PASS | 28 s | | On GitHub runners a passing gate takes 30 to 77 s per lane plus 12 to 24 s for Chromium (staging run of every lane on Linux, Windows and macOS). ## Other changes - The smoke fixture gains `rich` agent content (markdown, table, list) and the `?shell=1` app shell. - The gate's Chromium step installs missing Linux libraries only when Chromium cannot launch, through `retry-with-apt-lock.sh` with `APT_ACQUIRE_RETRIES=0` and a 10 minute step timeout, like the other browser steps. --------- Co-authored-by: imagineer99 <[email protected]>
Summary
Long chats get a turn navigator at the chat's left edge: one short line per prompt. Hovering shows the prompt and the start of its reply; clicking jumps to that turn.
This builds on #11668 by @mahiatlinux, with a new look:
thread-turns.ts).Changes from #11668:
#11668 conflicts with
maintoday; this PR carries its code forward. With it, #11668 would be superseded.Hover lag in long chats
Also fixes a lag that is on
maintoday, independent of the rail. Hovering a message mounts its action bar, and Chromium then restyled the whole chat and sidebar (about 10k elements) whenever any:has()rule in the app had a broad subject. On a 200-turn chat that was about 30 ms per hover, and at 4x CPU throttle scrolling with the pointer over the thread stalled for 37 to 44 s of long tasks in some runs.vite-plugin-has-anchor.tsrewrites Tailwind'sgroup-has-*andpeer-has-*output fromX:is(:where(.group):has(A) *)to:where(.group):has(A) X: the same match and specificity, which Chromium invalidates precisely..composer-pill-glyphinstead of styling> :not(.composer-pill-x)behind a:has().:has().data-chat-wallpaper-workspace-readyroot flag thatbackground.tsxalready sets.:has()rule removed)Verification
npm run typecheck,npm run i18n:check:strict,npm test,npm run buildtests/thread-turns.test.ts,tests/bookmarked-turns-store.test.ts(from Unsloth Studio / Desktop: number chat turns and add a pinned turn navigator #11668, updated for the left-side card) andtests/turn-navigation-layout.test.tstests/has-anchor-order.test.ts: the rewrite on Tailwind's real output, equivalence cases, and selectors it must leave alone.