Repository navigation
Stop one test's app settings answering another test's read - #11309
Conversation
test_chat_absent_model_with_only_resolver_withheld_checkpoints fails as `assert 500 == 404` in the (Python 3.13, l-r) shard and nowhere else. This is the half of #11241 that stayed open all session because nothing reproduced it. The CI traceback named it: Error loading model: '_B' object has no attribute 'load_model' File "studio/backend/routes/inference.py", line 16213, in _load_model_impl `_B` is the withheld tests' own backend double, reached through _load_model_impl -- a LOAD path those tests must never take. _wire_unloaded_chat pins every input for determinism (local catalog, resolver, auto-switch, both backends) and misses auto-download. get_openai_auto_download_enabled is `stored AND auto_switch`, and auto_switch IS pinned to True there, so the answer is whatever `stored` says. `stored` comes from _cached_setting, a module-level memo with _CACHE_TTL_S = 2.0 and no test isolation, so a neighbouring test that read that setting hands this one its value and the refusal becomes a fetch-and-load. Reproduced by seeding the memo the way a neighbour would: seeded True -> not 404, takes the auto-download path seeded False -> 404, as the test expects That is why no amount of reordering found it. It is not an ordering bug, it is a clock: only tests landing inside a two second window are affected, which is why it shows up in the full shard and never in a single-file run, and why CPU contention, a leaked managed account and a stranded waiter all came back clean. Two independent layers: - _wire_unloaded_chat pins auto-download off, which is what line 6190 of this same file already does for the one test that thought to. - an autouse fixture clears the memo around every test, so no process-wide settings cache can carry across tests at all. Sabotage, each hitting its own test: remove the wiring pin and the new regression test fails; drop the fixture's entry clear or its exit clear and the fixture test fails, each with its own message. The fixture test drives the fixture directly rather than relying on two tests running in order, since under --dist loadgroup that pair can land on different workers and pass by luck. test_openai_auto_switch.py: 695 passed, 1 skipped. Full studio/backend/tests vs a clean-main baseline: nothing fails only on this branch.
|
@codex review |
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 security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Keep them coming! 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". |
…#11309) * Stop one test's app settings answering another test's read test_chat_absent_model_with_only_resolver_withheld_checkpoints fails as `assert 500 == 404` in the (Python 3.13, l-r) shard and nowhere else. This is the half of unslothai#11241 that stayed open all session because nothing reproduced it. The CI traceback named it: Error loading model: '_B' object has no attribute 'load_model' File "studio/backend/routes/inference.py", line 16213, in _load_model_impl `_B` is the withheld tests' own backend double, reached through _load_model_impl -- a LOAD path those tests must never take. _wire_unloaded_chat pins every input for determinism (local catalog, resolver, auto-switch, both backends) and misses auto-download. get_openai_auto_download_enabled is `stored AND auto_switch`, and auto_switch IS pinned to True there, so the answer is whatever `stored` says. `stored` comes from _cached_setting, a module-level memo with _CACHE_TTL_S = 2.0 and no test isolation, so a neighbouring test that read that setting hands this one its value and the refusal becomes a fetch-and-load. Reproduced by seeding the memo the way a neighbour would: seeded True -> not 404, takes the auto-download path seeded False -> 404, as the test expects That is why no amount of reordering found it. It is not an ordering bug, it is a clock: only tests landing inside a two second window are affected, which is why it shows up in the full shard and never in a single-file run, and why CPU contention, a leaked managed account and a stranded waiter all came back clean. Two independent layers: - _wire_unloaded_chat pins auto-download off, which is what line 6190 of this same file already does for the one test that thought to. - an autouse fixture clears the memo around every test, so no process-wide settings cache can carry across tests at all. Sabotage, each hitting its own test: remove the wiring pin and the new regression test fails; drop the fixture's entry clear or its exit clear and the fixture test fails, each with its own message. The fixture test drives the fixture directly rather than relying on two tests running in order, since under --dist loadgroup that pair can land on different workers and pass by luck. test_openai_auto_switch.py: 695 passed, 1 skipped. Full studio/backend/tests vs a clean-main baseline: nothing fails only on this branch. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The failure
In the
(Python 3.13, l-r)shard and nowhere else. This is the half of #11241 that stayed open, because nothing reproduced it: not CPU contention, not a leaked managed account, not a stranded auto-switch waiter.Cause
The CI traceback named it:
_Bis the withheld tests' own backend double. Reaching_load_model_implat all means the request took a load path, which these tests must never take._wire_unloaded_chatpins every input for determinism -- local catalog, resolver, auto-switch, both backends -- and misses auto-download.get_openai_auto_download_enabled()isstored AND auto_switch, andauto_switchis pinned toTruethere, so the answer is whateverstoredsays.storedcomes from_cached_setting: a module-level memo,_CACHE_TTL_S = 2.0, no test isolation. A neighbouring test that reads that setting hands this one its value, and the refusal becomes a fetch-and-load.Reproduced by seeding the memo the way a neighbour would:
TrueFalseThis is why reordering never found it. It is not an ordering bug, it is a clock. Only tests landing inside a two-second window are affected, which is exactly why it appears in the full shard, never in a single-file run, and never twice in the same place.
The fix, in two independent layers
_wire_unloaded_chatpins auto-download off -- which is what line 6190 of this same file already does for the one test that thought to. Consistency with existing practice, not a new idea.The product code is left alone. A 2-second memo on a request hot path is reasonable, and writes already call
_invalidate. The defect is that the suite let it cross a test boundary.Verification
Sabotage, each hitting exactly one test:
the memo was not cleared before the test bodythe memo was not cleared after the test bodyThe fixture test drives the fixture directly rather than relying on two tests running in order: under
--dist loadgroupthat pair can land on different workers and pass by luck.test_openai_auto_switch.py: 695 passed, 1 skipped.studio/backend/testsagainst a clean-main baseline on the same host: nothing fails only on this branch. The 165 failures and 200 errors present in both are this workspace's missing CUDA runtime. (The baseline predates the Disengage FBCache on the word of whoever owns it #11304 merge, so the one main-only failure in that diff is the video test Disengage FBCache on the word of whoever owns it #11304 already fixed.)Being a timing window, the honest statement about the original symptom is that the shard passing once does not prove it gone. What is directly verified is the mechanism: seeded one way the test fails, seeded the other it passes, and the fix makes the seeding irrelevant.