Skip to content

Multi-account Playwright: record and retry once when the post-logout /login load never fires - #16437

Merged
danielhanchen merged 2 commits into
mainfrom
dh/multi-account-login-commit
Nov 2, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
dh/multi-account-login-commit

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Unsloth UI CI / Chat UI Tests (extra) failed on main after #16431 (run 41358447599, push 681111a2e2) in the multi-account step:

File "tests/studio/playwright_multi_account.py", line 133, in run
    open_login(page)
File "tests/studio/playwright_multi_account.py", line 60, in open_login
    page.goto(f"{BASE_URL}/login")
playwright._impl._errors.TimeoutError: Page.goto: Timeout 30000ms exceeded.
  - navigating to "http://127.0.0.1:18894/login", waiting until "load"

The same failure, at the same line, hit run 41290526680 (perf/r14-chat-search) this morning. Until #16431, the chat width step failed first on most runs, so this step was not reached and the failure stayed hidden.

Line 133 is the open_login that runs right after log_out. In the server log, POST /api/auth/logout returns 204 and GET /login returns 200 about 20 ms later. After that the server sees nothing from that tab for 30 s, until the driver's cleanup DELETE /api/accounts/.... The server answered the navigation, but the page's load event never fired. In the passing run on #16431's head, the same sequence fires load and the second tab opens 1.4 s later.

What I could and could not pin down

Locally, against a Studio built from current main, the driver passed 25 of 25 runs normally and 15 of 15 with Chromium throttled 8x. So I could not reproduce the stall itself. Asset requests are excluded from the request log, so the CI artifacts also do not say which request hung.

What I could show is that one stalled request is enough to produce exactly the CI error. I held one of the login page's /assets chunks during that navigation, and main fails at line 133 with Page.goto: Timeout 30000ms exceeded ... waiting until "load". Every chunk I tried (tour-*.js, chat-*.css, stt-download-mirror-*.js, training-*.js) is on the login page's critical path. So waiting for commit or domcontentloaded and then for the form would not help, and I did not do that.

Change

tests/studio/playwright_multi_account.py: open_login keeps its single retry on ERR_ABORTED (#15398) and now also retries once on a navigation timeout. Before retrying, it records:

  • the requests that were still unfinished;
  • document.readyState and the URL;
  • a screenshot.

These go to a WARN: line in the step log and to login-load-timeout.{json,png} under PW_ART_DIR. A second timeout or abort still fails the step. The multi-account checks themselves (account switch, second tab reload, password change, per-account storage) are unchanged.

.github/workflows/studio-ui-smoke.yml: the step sets PW_ART_DIR=logs/playwright_multi_account, and that directory is added to the extra job's artifact upload. The next stall will then name the request that hung.

Testing

All runs used a local Studio from this tree. "Stalled" means one /assets chunk was held during the post-logout navigation; "transient" holds the first request only, "persistent" holds every attempt.

Scenario main this branch
Transient stall fails at line 133 with the CI error WARN names the held chunk, retry passes, PASS
Persistent stall fails at line 133 WARN, then the retry fails with Page.goto: Timeout 30000ms exceeded
No stall passes 8 of 8 PASS

The persistent-stall row shows a login page that really cannot load still fails.

  • tests/studio workflow / playwright / artifact tests: 871 passed, 45 skipped.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 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-11-02T00:25:38.927321Z d9b1829 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. You're on a roll.

Reviewed commit: d9b182970b

ℹ️ 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 3a4406b into main Nov 2, 2026
@danielhanchen
danielhanchen deleted the dh/multi-account-login-commit branch November 2, 2026 01:00
danielhanchen added a commit that referenced this pull request Nov 5, 2026
…ed-load retry (#16768)

## Summary

`Chat UI Tests (extra)` fails on unrelated PRs several times a day at
the same place, for example #16722, #16741 and the staging run for
#16750:

```
File "tests/studio/playwright_multi_account.py", line 173, in run
    open_login(page)
File "tests/studio/playwright_multi_account.py", line 67, in open_login
    page.goto(url)
playwright._impl._errors.TimeoutError: Page.goto: Timeout 30000ms exceeded.
Call log:
  - navigating to "http://127.0.0.1:18894/login", waiting until "load"
```

#16437 added a recorded retry for exactly this stalled `/login` load,
but it never runs in these failures. None of the failing logs print its
`WARN: /login did not fire load ...` line, and the whole step lasts
about 33 s, i.e. one 30 s timeout. `open_login` gives aborts and
timeouts one shared two-attempt budget: right after a log-out the app's
own 401 redirect (`redirectToAuth`) aborts the first `goto` with
`ERR_ABORTED`, which spends attempt 1, and the stalled load then happens
on attempt 2, where it is fatal.

## Change

`tests/studio/playwright_multi_account.py`, `open_login` only:

- Aborts and timeouts each get their own single retry, so an abort can
no longer use up the retry #16437 added for a stalled load. A second
abort, a second timeout, or any other error still fails the run as
before.
- When the abort came from the app's redirect and that redirect has
already loaded `/login`, the page is used as it is instead of navigating
to `/login` a second time. A redirect that ends anywhere else (for
example `/change-password`) still navigates to `/login`.

Nothing outside this Playwright driver changes.

`tests/studio/test_playwright_multi_account_open_login.py` drives
`open_login` with a scripted page and the real Playwright error types:

| goto outcomes | expected |
|---|---|
| abort, redirect already on `/login` | returns after one goto |
| abort elsewhere, timeout, load | returns after the third goto (the CI
failure) |
| abort to `/change-password`, load | navigates to `/login` |
| two aborts / two timeouts / abort then two timeouts | raises |
| an error other than an abort | raises, no retry |

## Testing

- New test: 7 passed. Against the driver on main: 3 failed, including
`test_a_timeout_after_an_abort_still_gets_its_retry`, the sequence the
CI logs show.
- `tests/test_ci_repo_cpu_shards.py`,
`tests/studio/test_playwright_suites_run_in_ci.py` and
`tests/studio/test_pwsh_calls_use_the_shared_runner.py` pass.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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