Repository navigation
Studio smoke: report a transport failure instead of crashing on one - #10420
Conversation
Two fixed budgets in the Mac UI job that were the thing that was wrong, not the thing they were measuring. Neither is a product bug; both failed unrelated PRs. studio_api_smoke.py caught only HTTPError, so a socket timeout propagated out of http() and killed the script at module level. The traceback named urlopen and a line number and nothing about which endpoint had been slow, and the sections after it never ran. Transport failures now return status 0, which the existing `if code == 200 ... else fail(...)` sites already report, and http() emits the method, path, elapsed budget and exception so the reason is next to the failure rather than only in the returned body. The /v1/embeddings ceiling goes to 90s. This is the first request in that section that forces a model load, so it pays the load on top of the embedding: measured at 23.8s on a healthy runner against a 30s ceiling, 79% of budget. Three unrelated PRs (Windows code integrity, chat media turns, MLX install) timed out here at exactly 30.0s off the same base while main passed at 23.8s. This is headroom, not concealment -- a genuinely slow endpoint still fails, and now says so instead of crashing. playwright_loaded_models_indicator.py waited a hard 3000ms after each hard navigation before counting the card. Every other wait in the file derives from SETTLE_MS (12000); the sibling check one line above already uses wait_for_selector with a 30s timeout. Once the first route overran the budget all three failed together, which is the signature. Waits for the card it is about to assert on, bounded by SETTLE_MS. The check itself is unchanged and still fails if the card really does not survive the navigation. Verified against the pre-change code: a refused connection and a socket timeout both raised URLError out of http() before, and both now return 0 with the reason emitted and the run continuing.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f383c24d7
ℹ️ 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".
| # failed without saying that it timed out or after how long. | ||
| detail = f"{type(exc).__name__}: {exc}" | ||
| _emit(" NET ", f"{method} {path} failed after {timeout}s -- {detail}") | ||
| return 0, {"error": detail, "timeout": timeout} |
There was a problem hiding this comment.
Record transport failures in PID probes
When either /api/inference/status request surrounding the force-reload encounters one of these caught transport errors, returning status 0 does not produce a failed assertion: _llama_pid() converts every non-200 result to None, and the caller then reports the force-reload check as OK with the PID comparison skipped. A transient timeout in either probe can therefore leave this smoke run with a successful exit code despite the logged NET failure; record the transport error as a failure here or make the PID probe propagate it to the caller.
Useful? React with 👍 / 👎.
| return exc.code, json.loads(raw) | ||
| except (json.JSONDecodeError, UnicodeDecodeError): | ||
| return exc.code, raw | ||
| except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: |
There was a problem hiding this comment.
Catch failures while reading HTTP error bodies
When an endpoint sends 4xx/5xx headers but stalls or disconnects while its response body is being read, exc.read() in the preceding HTTPError handler can raise TimeoutError; because that exception is raised from inside an except suite, Python does not route it through this sibling handler. The script therefore still terminates with a traceback for this transport-failure path instead of reporting and continuing as intended, so the HTTP-error body read also needs to be enclosed by the transport handler.
Useful? React with 👍 / 👎.
…age looked like (unslothai#10435) * A failed presence check in the indicator driver should say what the page looked like unslothai#10420 fixed the /hub, /train and /images loop: a hard 3000ms after each hard navigation, the only fixed budget in the file not derived from SETTLE_MS, which a contended macOS runner occasionally blew and then all three routes failed together. Measured incidence of that flake before the fix was 1 in 1831 step executions, the single occurrence being run 34070594239 attempt 1, which is 2.4 hours older than the fix. Two things it left behind. The same shape is still here once, at the collapsed-pill reload. A reload has to re-parse the bundle and re-read the stored preference before the pill can exist, exactly as /hub must before the card can, and it is followed by a fixed SETTLE_MS // 2 and a positive presence assertion with nothing in between. It has not failed, but only because 6000ms is double the budget that did; the structure is identical. It waits for the pill now. A scan for that specific shape across all 31 playwright_*.py found no other instance that can fail a suite. The other is that when a presence check does go the wrong way, all it prints is "FAILED: card survives /hub", which is the one thing already known. It now prints the states that separate the causes: pathname for a redirect or a route that never resolved, root_children for an SPA that never mounted, auth_token for a slip the /login guard in boot cannot catch mid-suite, show_pref for a preference that was not seeded, status_reads for a poll that never fired, and the console for a bundle that threw. Job logs here are kept about 26 hours, so a failure that explains itself in the log is the difference between a diagnosis and a rerun. The wait keeps swallowing its exception -- the caller's assertion is what decides pass or fail, and raising would turn a product verdict into a traceback that loses the remaining checks -- but it no longer swallows it anonymously. A TimeoutError means the card really was not there in the budget; a closed target means the run died for a reason that has nothing to do with the card, and those two were reported identically. It also surfaces a third outcome the old pairing hid: wait_for_selector waits for visible and count() counts attached, so a card that attaches and never becomes visible times out and passes. That is latent today, since the component returns null rather than rendering hidden, so this only logs a NOTE and changes no verdict. Not exercised end to end here: this box is Linux, so a playwright webkit install is WebKitGTK rather than the WebKit the Mac job drives, and the driver also needs a built frontend and a running studio. What did run: py_compile, the repo's 23 meta-tests over the playwright suites, the kwarg-spacing check, and a stub-page unit test of the two new helpers covering the timeout, dead-browser, /login redirect and collapsed-pill cases. The Mac job is the real check. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Report the status reads this page issued, not the total since boot `Runtime.status_reads` counts every read since boot, so the raw total said nothing about the page that just failed: a route whose poll never fired still reported whatever boot and the earlier routes had accumulated, which is the one cause this probe was added to expose. Each navigation now takes the count before it and the report names the reads that navigation issued, scoped the same way `console_errors` already is. The total is kept alongside, since it is the thing to compare against when the delta looks plausible. Exercised directly, since the driver needs a built frontend and a running studio: a page issuing no reads with 7 behind it reported `status_reads=7` before this and reports `0 (of 7 since boot)` now, against `3 (of 10 since boot)` when the poll did fire. * Let a page that cannot be asked still reach its own diagnostic Naming what ended a wait is pointless if the next line re-raises it. A closed target or a navigation error fails `await_selector`, which records the name, and then fails `locator.count()` the same way, so the caller never reached its `check()` and the detail it had just collected was replaced by the traceback this change exists to avoid. Both presence checks did this. `counted` returns None when the page cannot be asked, and None is not zero: zero is a page that answered and had no card, None is a page that could not answer, and only the first is a verdict about the card. The probe block reports `<unreadable>` for the same reason, rather than a number standing in for an answer it never got. Exercised against a page that raises on every call: the old line raised and printed nothing, and the check now runs and reports `wait=Closed: Target page, context or browser has been closed`. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…age looked like (unslothai#10435) * A failed presence check in the indicator driver should say what the page looked like unslothai#10420 fixed the /hub, /train and /images loop: a hard 3000ms after each hard navigation, the only fixed budget in the file not derived from SETTLE_MS, which a contended macOS runner occasionally blew and then all three routes failed together. Measured incidence of that flake before the fix was 1 in 1831 step executions, the single occurrence being run 34070594239 attempt 1, which is 2.4 hours older than the fix. Two things it left behind. The same shape is still here once, at the collapsed-pill reload. A reload has to re-parse the bundle and re-read the stored preference before the pill can exist, exactly as /hub must before the card can, and it is followed by a fixed SETTLE_MS // 2 and a positive presence assertion with nothing in between. It has not failed, but only because 6000ms is double the budget that did; the structure is identical. It waits for the pill now. A scan for that specific shape across all 31 playwright_*.py found no other instance that can fail a suite. The other is that when a presence check does go the wrong way, all it prints is "FAILED: card survives /hub", which is the one thing already known. It now prints the states that separate the causes: pathname for a redirect or a route that never resolved, root_children for an SPA that never mounted, auth_token for a slip the /login guard in boot cannot catch mid-suite, show_pref for a preference that was not seeded, status_reads for a poll that never fired, and the console for a bundle that threw. Job logs here are kept about 26 hours, so a failure that explains itself in the log is the difference between a diagnosis and a rerun. The wait keeps swallowing its exception -- the caller's assertion is what decides pass or fail, and raising would turn a product verdict into a traceback that loses the remaining checks -- but it no longer swallows it anonymously. A TimeoutError means the card really was not there in the budget; a closed target means the run died for a reason that has nothing to do with the card, and those two were reported identically. It also surfaces a third outcome the old pairing hid: wait_for_selector waits for visible and count() counts attached, so a card that attaches and never becomes visible times out and passes. That is latent today, since the component returns null rather than rendering hidden, so this only logs a NOTE and changes no verdict. Not exercised end to end here: this box is Linux, so a playwright webkit install is WebKitGTK rather than the WebKit the Mac job drives, and the driver also needs a built frontend and a running studio. What did run: py_compile, the repo's 23 meta-tests over the playwright suites, the kwarg-spacing check, and a stub-page unit test of the two new helpers covering the timeout, dead-browser, /login redirect and collapsed-pill cases. The Mac job is the real check. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Report the status reads this page issued, not the total since boot `Runtime.status_reads` counts every read since boot, so the raw total said nothing about the page that just failed: a route whose poll never fired still reported whatever boot and the earlier routes had accumulated, which is the one cause this probe was added to expose. Each navigation now takes the count before it and the report names the reads that navigation issued, scoped the same way `console_errors` already is. The total is kept alongside, since it is the thing to compare against when the delta looks plausible. Exercised directly, since the driver needs a built frontend and a running studio: a page issuing no reads with 7 behind it reported `status_reads=7` before this and reports `0 (of 7 since boot)` now, against `3 (of 10 since boot)` when the poll did fire. * Let a page that cannot be asked still reach its own diagnostic Naming what ended a wait is pointless if the next line re-raises it. A closed target or a navigation error fails `await_selector`, which records the name, and then fails `locator.count()` the same way, so the caller never reached its `check()` and the detail it had just collected was replaced by the traceback this change exists to avoid. Both presence checks did this. `counted` returns None when the page cannot be asked, and None is not zero: zero is a page that answered and had no card, None is a page that could not answer, and only the first is a verdict about the card. The probe block reports `<unreadable>` for the same reason, rather than a number standing in for an answer it never got. Exercised against a page that raises on every call: the old line raised and printed nothing, and the check now runs and reports `wait=Closed: Target page, context or browser has been closed`. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Two fixed budgets in the Mac UI job that were themselves the problem, not the thing they were measuring. Neither is a product bug, and both failed unrelated PRs.
1. A socket timeout killed the whole smoke script
tests/studio/studio_api_smoke.py'shttp()caught onlyurllib.error.HTTPError, so a transport failure propagated out at module level:The traceback names
urlopenand a line number, and nothing about which endpoint was slow or for how long. Every section after it is abandoned.Transport failures now return status 0, which the existing
if code == 200 ... else fail(...)call sites already report as a failure, andhttp()emits the method, path, budget and exception so the reason sits next to the failure instead of only in the returned body:2. The
/v1/embeddingsceiling had no marginThat call is the first in its section to force a model load, so it pays the load on top of the embedding. On a healthy macOS runner it takes 23.8s against a 30s ceiling, 79% of budget:
/v1/modelsOKdcf12378OK /v1/embeddings -> 200 with data00:37:10.64TimeoutError01:27:52.20TimeoutError01:44:55.02TimeoutError02:40:36.42Three unrelated PRs (Windows code integrity, chat media turns, MLX install) off the same base
a6e9880c, none touching the embeddings path, all pinned at exactly the cap. Raised to 90s. This is headroom rather than concealment: a genuinely slow endpoint still fails the check, and now reports rather than crashes.3. A hard 3000ms wait after a hard navigation
tests/studio/playwright_loaded_models_indicator.py:A full SPA reload plus a loaded-models poll, then a fixed 3000ms and a single non-retrying
count(). It was the only fixed budget in the file not derived fromSETTLE_MS(12000), and the sibling check one line above already useswait_for_selector(CARD, timeout = 30_000). On #10409, whose diff is 19 lines ofstudio/backend/utils/mlx_repair.pyand cannot reach the frontend:All three together, which is what a fixed budget looks like when the runner is loaded. The same job printed
38/38on #10406, #10404 and #10403 at the identical base. Now waits for the card it is about to assert on, bounded bySETTLE_MS. Thecheck()is unchanged and still fails if the card genuinely does not survive.Verification
Against the pre-change
http(), a refused connection and a socket timeout both raiseURLErrorout of the function. After, both return0with the reason emitted and the run continuing: