Repository navigation
Split Chat UI Tests into four shards on the Studio boundaries - #9132
Conversation
Chat UI Tests was the largest job in the repo: 2,514 minutes over a week, 22.1 minutes on average, 11 Playwright scripts run one after another against four Studios booted one after another. Timed on a real run, 17.6 minutes of which the setup every shard has to repeat is about 2.6 (checkout, Linux deps, Install Unsloth, Playwright browsers). The rest is the scripts, and the two banner engines alone are 7.25 of it, which is why they are a shard of their own rather than sitting with their neighbours. The boundaries are the Studio instances, not an even division of scripts: a boot, its health wait, its bootstrap password and the scripts that drive it have to stay on one machine. chat takes 18892 plus the cross-browser permission pass, extra and banner each boot their own 18894, picker takes 18898 and 18896. In-machine parallelism is deliberately not used. These are separate runners, so each shard still boots one Studio at a time and nothing competes for RAM, which is the constraint that rules out simply running the scripts concurrently on one box. Runner minutes go up and wall-clock comes down, which is the trade being made on purpose. The risk worth guarding is not a broken shard, which is loud. It is a step whose if: names no shard, or names one not in the matrix, or a shard left with nothing to do: the step runs nowhere, all four shards are green, and a regression suite has quietly stopped existing. The new test asserts coverage from the workflow itself rather than from a list, checks that a script and the Studio it talks to land on the same shard, and pins the count of driving steps at 11. All three mutations fail it: renaming a shard in one if:, dropping a gate, and moving a script away from its Studio.
Three engines, downloaded on every job, on every run, uncached. It was 0.75 minutes when one job needed them; with four shards it is four times that, and it sits on the critical path of each. Keyed on the RESOLVED Playwright version rather than on the '>=1.45' spec, because that is what decides which browser builds are wanted: a floating spec that resolves higher must not hit a cache holding the older engines. --with-deps stays unconditional on a miss and becomes install-deps on a hit. The apt half installs system libraries outside the cached directory, so restoring the cache without it would give browsers that cannot start, which is the failure this kind of change usually ships with. Only the download is skipped.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0ae35a6d3
ℹ️ 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".
| matrix: | ||
| shard: [chat, extra, banner, picker] |
There was a problem hiding this comment.
Give each shard a unique artifact name
The new matrix creates four concurrent jobs, but the Upload Playwright artifacts step at lines 471–477 still uses the same studio-ui-smoke-artifacts name in every cell. actions/upload-artifact artifacts are immutable within a workflow run, so after one shard creates this artifact, the other three uploads fail with a name conflict; because this final step uses if: always() without continue-on-error, otherwise successful UI runs become red. Include matrix.shard in the artifact name.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and this would have made the change worse than what it replaced: three of four cells failing on a name conflict, on a step with if: always() and no continue-on-error, so a UI run where every test passed reports red for a reason that has nothing to do with the UI.
Fixed in f2f075e. The new assertion is written for any matrix job in this workflow rather than for this one by name, since the next job to be sharded inherits the same trap; dropping matrix.shard from the name fails it.
| ] | ||
|
|
||
|
|
||
| def test_the_job_still_drives_every_script_it_used_to(): |
There was a problem hiding this comment.
Run the shard guard on workflow-only changes
This guard is not invoked by any workflow that will run it for a future edit confined to .github/workflows/studio-ui-smoke.yml: Backend CI collects tests/ but its PR path filter excludes this workflow, the UI smoke workflow runs only the existing locator-contract pytest, and workflow-trigger-lint.yml invokes three other guard files but not this one. Thus the exact regression described here—a workflow edit that leaves a script on no shard—can still pass every PR check; add this file to the always-triggered workflow guard or to the UI smoke static pytest step.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is the same gap this repo keeps producing: the guard reads studio-ui-smoke.yml, so the edit it exists to catch is by definition a workflow-only edit. Backend CI's paths filter does not match one, and the UI smoke job it protects is precisely the thing that would silently stop running, so it cannot be the one to notice.
Fixed in f2f075e: it joins the four guards already running in workflow-trigger-lint.yml, which carries no paths filter and sees every pull request.
… edits Two from review, both real, and the first would have made the change worse than what it replaced. Artifacts are immutable within a workflow run, so four cells uploading studio-ui-smoke-artifacts means the first to finish creates it and the other three fail on the conflict. The upload step carries if: always() and no continue-on-error, so a UI run where every test passed reports red on three cells out of four. The name now carries the shard, and the new assertion is written for any matrix job in this workflow rather than for this one by name, since the next job to be sharded inherits the same trap. Removing the shard from the name fails it. The second is the same gap this repo keeps finding: the guard reads studio-ui-smoke.yml, so the edit it exists to catch is by definition a workflow-only edit. Backend CI's paths filter does not match one, and the UI smoke job it protects is precisely the thing that would silently stop running, so it cannot be the one to notice. It joins the four guards already running in workflow-trigger-lint.yml, which carries no paths filter and sees every pull request.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2f075e0c8
ℹ️ 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".
|
|
||
| - name: Stop third Unsloth | ||
| if: always() | ||
| if: (always()) && (matrix.shard == 'picker') |
There was a problem hiding this comment.
Capture server logs on every shard
When the chat, extra, or banner shard encounters a backend or llama-server failure, this condition skips the only step that copies ~/.unsloth/studio/logs into the uploaded artifact. Because each matrix cell runs on a separate runner, the picker cell can capture only its own logs, leaving the other three artifacts without the server-side tracebacks this block was intended to preserve; perform the copy in an always() step for every shard while keeping only the IME process cleanup picker-specific.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and the comment on that block gives away why it happened: it said all three Studios share the directory, which was true when they shared a runner and is false now that each cell is its own machine. Three artifacts would have uploaded with no server-side traceback, which is the first thing anyone debugging a failed shard opens.
Fixed in 01b20ab. The copy is its own always() step on every cell, and the IME process cleanup stays picker-specific since that PID only exists there. Re-gating the copy to one shard fails the new assertion.
I cut this to 20 on the reasoning that a quarter of the job needs a quarter of the budget. Staging then cancelled three of the four shards at exactly 20m0s, all of them inside "Linux deps", an apt step that takes 13 SECONDS in the org repo. The work was not slow, the runner was. A timeout is there to catch a hang, not to police the mean. Sizing it to the expected duration converts an infrastructure stall into a red build on a shard where every test would have passed, which is a worse failure than the one the tighter number was meant to prevent, because it looks like the change broke something.
The copy of ~/.unsloth/studio/logs lived inside the step that stops the third Studio, under a comment saying all three Studios share the directory. That was true when they shared a RUNNER. Each cell now has its own machine and its own logs directory, so gating it to picker uploaded three artifacts with no server-side traceback in them, which is the first thing anyone debugging a failed shard opens. The copy is now its own always() step on every cell; the IME process cleanup stays picker-specific, since that PID only exists there. Re-gating the copy to one shard fails the new assertion.
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…ng (#9150) * Studio: stop the overlay rail going click-through while it is scrolling `Chat UI Tests (banner)` has been red on main since #9132, on the WebKit leg of "Update banner layout, other engines", at 921x534 on New chat: FAIL the card keeps its full width whatever the scrollbar does cardWidth=430 want=448 railGutter=0 scrolls=True FAIL the rail takes pointer input exactly when it scrolls scrolls=True pointerEvents=none Both assertions are from #8367 and both are right. The second one describes a state a user can actually be in, and the shard's own screenshot shows it: the rail is capped, the llama.cpp card is sliced off at the fold, the Unsloth update card is entirely above it, and the rail is `pointer-events: none`, so there is no scrollbar and no drag that brings it back. The suite's reachability checks pass because they call scrollIntoView, which a reader has no way to do. What #9132 changed is not the product, it is the state the suite finds. The banner scripts used to run on the machine and the Studio home the chat and extra shards had already been through; they now get their own runner and a pristine `~/.unsloth/studio`, since boot-studio-api-only.sh wipes only `auth`. The last green artifact is dark-themed with "Chat C" and "Chat B" in Recents; the first red one is default-themed with "No chats yet". Same commit range, different starting state, so the rail is capped now where it was not before. #9132 is correct; it exposed this rather than caused it, and the same failure reproduces on unrelated PR branches. The defect is that `overflowing` is a prediction. `floorRoom > maxHeight` asks whether the cards WOULD fit if they collapsed to the floor that was measured for them under a max-height of 0. When they stop short of that floor the box overflows a cap the prediction says it fits inside, and the rail is left click-through while it scrolls, which is the failing pair exactly. So the reading is kept and the actual state is or-ed into it, taken off the node in the same synchronous block that already lifts and restores the cap, with the real cap back on and the layout just flushed. It is re-read on every pass and never remembered, which is what the derived value was there to protect against: the observers watch the rail and every descendant, so a placement that grows to fit clears the flag on the same pass that applied it. Being an `||`, it can only add the case the prediction misses and can never take pointer input away from a rail that already had it. Verified on this box, WebKit and Chromium, against a build actually served from this tree (`unsloth studio --frontend`; the venv's installed copy is what gets served otherwise, which is worth knowing before trusting a local Studio run): - Broken deliberately, `overflowing` forced false: the full Chromium suite is 1433 checks, 1 failed, and the one is `320x480 at 20px: the rail takes pointer input exactly when it scrolls scrolls=True pointerEvents=none`. - Fixed: 1433 checks, 0 failed. Firefox and WebKit spot: 221, 0 failed each. - Unchanged where the prediction was already right. Sweeping WebKit down the height axis at 921 wide, the rail and the flag agree at every step both before and after: no scroll and `none` at 534 through 364, scroll and `auto` from 360 down, card 448 throughout. The width half is not fixed here, because I could not reproduce it and will not guess at it. 448 - 430 is 18px of scrollbar, but `offsetWidth - clientWidth` reports 0 in the same breath, so on that runner the bar takes width out of the content box without showing up in the gutter the assertion reads. This box never reproduces it: WebKit here keeps the card at 448 whether the rail scrolls or not. `scrollbar-gutter: stable` is the obvious candidate and is deliberately not taken on a guess, since it reserves the gutter permanently and would shift the cards left by the scrollbar width on Chromium, where the card is already correct. Instead both failing assertions now print the measurements that would settle it: the card's transform and border box, its computed and max width, innerWidth and documentElement.clientWidth, the rail's offset, client and content widths, its scroll and client heights, its cap, and the children's heights. Nothing is relaxed; the same two checks fail on the same conditions, with enough attached to say which of the two mechanisms it is. That output is what the next run of this shard is for. * Take the rail's overflow reading after the transition is restored The DOM reading was inserted between the flush of the restored cap and the line that puts the eased transition back, which is the one place the store must keep adjacent: update-banner-flex-priority asserts on it, and the assertion went red on both the Linux and the Windows frontend unit jobs. The reading does not need to sit there. The cap change is already committed under the suppression by the flush above it, and transition is not itself a transitionable property, so no reflow the read forces can hand that cap to an animation. Moving it below the restore keeps the invariant and the reading. * Measure the banner card's layout width, not its painted width The width half of the banner failure is the card's enter animation, not a scrollbar. The diagnostics added earlier in this branch settled it on the WebKit leg: transform matrix(0.96, 0, 0, 0.96, 0, 12), which is exactly the initial state in components/web/update-banner.tsx, with borderBox 448, cssWidth 448px, railContentW 448 and railGutter 0. 448 * 0.96 is 430.08, and 430 is what the assertion read. Nothing had taken any width; the card had simply not been painted at full size yet. So the assertion was measuring the painted box for a question about layout. getBoundingClientRect includes transforms and offsetWidth does not, so the reading moves to offsetWidth, which a scrollbar taking width out of the rail's content box still shrinks. The painted width is still reported next to it, since the gap between the two is the diagnosis. Checked on chromium, firefox and webkit that this is red exactly when it should be: with the transform applied and no width lost, the old reading fails and the new one passes; with 18px actually taken out of the rail's content box the new one fails on all three, with or without the transform also applied; on a settled healthy box both pass.
Chat UI Testswas the largest job in the repo: 2,514 minutes over a week, 22.1 minutes on average, 11 Playwright scripts run one after another against four Studios booted one after another.Where the 17.6 minutes went (real run 32028201521)
Setup that every shard must repeat is about 2.6 minutes, so splitting is nearly all profit in wall-clock.
The shards
Boundaries are the Studio instances, not an even division of scripts: a boot, its health wait, its bootstrap password and the scripts that drive it have to stay on one machine.
chat— 18892, plus the cross-browser permission passextra— its own 18894: Compare/Recipes/Export, per-chat settings, font scale, the three image stepsbanner— its own 18894: the two banner engines, 7.25 min on their own, which is why they are a shard rather than sitting with their neighbourspicker— 18898 and 18896, small and adjacentIn-machine parallelism is deliberately not used. These are separate runners, so each shard still boots one Studio at a time and nothing competes for RAM, which is what rules out simply running the scripts concurrently on one box. Runner minutes go up, wall-clock comes down; that trade is taken on purpose.
timeout-minutesdrops from 30 to 20. The old 30 existed because the job was landing at 22m30s and taking the banner step over the edge, leaving the three image steps unrun.Why there is a test
The risk here is not a broken shard, which is loud. It is a step whose
if:names no shard, or names one not in the matrix, or a shard left with nothing to do. The step then runs nowhere, all four shards go green, and a regression suite has quietly stopped existing — nothing else in CI notices, because a test that does not run cannot fail.tests/studio/test_chat_ui_shards_cover_everything.pyasserts coverage from the workflow itself rather than from a list kept alongside it: every Playwright step is reachable on some shard in the matrix, a script and the Studio it talks to land on the same shard, no shard is idle, and the count of driving steps is pinned at 11. Three mutations were checked and all fail it: renaming a shard in oneif:, dropping a gate entirely, and moving a script away from its Studio.