Skip to content

Studio composer icon check: re-measure a case when the dev page reloads mid-case - #14647

Merged
danielhanchen merged 2 commits into
mainfrom
fix/composer-icons-reload
Oct 22, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix/composer-icons-reload

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The composer icon alignment step in Studio Frontend CI fails intermittently on the Windows leg with:

File "tests/studio/playwright_composer_icons.py", line 99, in main
    page.evaluate(
playwright._impl._errors.Error: Page.evaluate: Execution context was destroyed, most likely because of a navigation

Seen on main (run 39678763807, job 119495424607) and on #14592 (job 119703801606), which does not touch the composer, the smoke page or the script. The vite dev page navigates after its buttons have rendered, and the next evaluate loses its context.

Change

  • Each display case (font scale, zoom, dark, direction) is now applied and measured in one evaluate. Before, the case was applied in one call and measured in a second; a reload between them resets the case, so retrying only the measurement would record the default layout under the case's name.
  • measure_case re-runs the whole case on a fresh render when the context is lost, up to 3 attempts. Any other evaluate error fails at once, and a page that keeps navigating still fails.
  • When it does re-measure, it prints the dev server's recent output so the next occurrence names what triggered the reload. I could not reproduce the reload on Linux with a cold node_modules/.vite, so the trigger on Windows is not proven yet.

Verification

  • tests/studio/test_composer_icons_navigation.py (new, collected by the Backend CI studio shard) uses a fake page whose reload resets the applied case and kills the evaluate in flight. It checks that one evaluate applies and measures, that a reload on the first or second attempt still returns the requested case, that persistent navigation fails after 3 attempts, and that other errors are not retried.
  • Against main's script: 5 of 5 fail. Against a naive fix that keeps the separate apply call and retries only the measurement: 3 of 5 fail, including the reload mid-case test.
  • Ran the real driver locally in Chromium: PASS: 1296 rendered icons centered, and the measured widths scale with each case (20.80 at font 1 / zoom 1, 32.5 at 1.25 / 1.25), so the case is applied inside the measuring call.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T10:23:20.839779Z 53aed45 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 3a9944a15e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 53aed45905

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit b20f180 into main Oct 22, 2026
@danielhanchen
danielhanchen deleted the fix/composer-icons-reload branch October 22, 2026 11:26
danielhanchen added a commit that referenced this pull request Oct 22, 2026
…pped server releases auth.db (#14658)

The Windows Unsloth UI CI "Chat UI Tests" job sometimes fails on lane
`extra` even though every suite in it passed:

```
[banner] 2155 checks, 0 failed
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db': Device or resource busy
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db-shm': Device or resource busy
rm: cannot remove 'D:\a\unsloth\unsloth/.studio-lane-extra/auth/auth.db-wal': Device or resource busy
##[error]Windows UI lane extra failed (exit 1)
```

Seen on run 39669502772 and again on a staging replica of #14647 (a
test-only change unrelated to the lane).

### Cause

`run-studio-ui-lane.sh` (lane `extra`) stops its own server with `kill`
plus a 2 second sleep, then calls `run-studio-permission-browser.sh` on
the same `UNSLOTH_STUDIO_HOME`. That script wipes `$studio_home/auth`
before booting a fresh server. On Windows the killed server can still
hold `auth.db` open past the sleep, so the `rm -rf` fails and `set -euo
pipefail` ends the lane with exit 1.

### Change

- The wipe is now `wipe_auth`, which retries `rm -rf
"$studio_home/auth"` quietly once a second for up to 30 tries
(`STUDIO_AUTH_WIPE_TRIES`), then makes one last attempt that shows
`rm`'s own error. If that attempt succeeds the wipe succeeds; if not, it
prints an `::error::` naming the held directory and fails. A server that
never exits still fails the lane, now with a message that says so.
- The fix is in the step that needs the lock released rather than in the
lane's `stop()`, so it covers any caller that hands this script a home
whose server just went away.

### Verification

`tests/studio/test_permission_browser_auth_wipe.py` (new, collected by
the Backend CI `studio` shard) runs the script's own `wipe_auth` body in
bash against an `rm` shim that reports "Device or resource busy" for its
first calls:

- held for 4 calls: wiped on the 5th, exit 0
- released exactly on the final attempt (5 tries): wiped, exit 0
- held throughout (5 tries): exits non-zero after 6 calls, with the
`still held open` error and `rm`'s message
- no bare `rm -rf "$studio_home/auth"` remains outside the helper, and
the wipe runs before `unsloth studio` boots

Sabotage: main's script fails all of them; a `wipe_auth` with the retry
loop removed fails 2 of 3 of the original tests; the previous head of
this PR (which returned 1 after a successful final attempt) fails the
final-attempt test. `test_ui_scripts_report_signals.py` and
`test_windows_ui_lanes_are_isolated.py` still pass.

Not proven here: the timing on a real Windows runner. This PR's own
Windows UI CI run exercises the path; the failure is intermittent, so
one green run is consistent with the fix rather than proof of it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant