Skip to content

Stub all three fields the snapshot reads, not two of them - #9274

Merged
danielhanchen merged 2 commits into
mainfrom
fix-warm-window-detail-leak
Aug 19, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
fix-warm-window-detail-leak

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What broke

Backend CI (Python 3.13) went red across several open PRs on:

assert (True, 'mlx_u...eds >=0.4.4)') == (True, 'mlx_u...ilable', None)
FAILED tests/test_warm_window_review_fixes.py::test_health_snapshot_returns_a_settled_verdict

None of those PRs touch this code, and main was green at 07:19 and red by 07:45, so nothing in the repo changed either.

Why

_hardware_snapshot() reads three fields. The test pinned all three while monkeypatching only two:

monkeypatch.setattr(hw_mod, "CHAT_ONLY", True, raising = False)
monkeypatch.setattr(hw_mod, "CHAT_ONLY_REASON", "mlx_unavailable", raising = False)
assert main_mod._hardware_snapshot() == (True, "mlx_unavailable", None)

CHAT_ONLY_DETAIL was never stubbed, so the third element asserted whatever the real hardware module happened to be carrying. That was None until an mlx-vlm bump left a live (needs >=0.4.4) detail behind.

The expensive part is not the red run, it is where it points: the failure reads as a snapshot bug and sends the next person into main.py's seqlock, which is fine.

The fix

Stub the third field too.

Stubbing it to None alone would swap one under-specification for another -- it would equally pass against a snapshot that had stopped reading the detail at all. So the test now also pins a non-None detail and asserts it travels with its reason, which is the property the test is named for.

Verification

Mutation-tested against main.py, both directions:

CAUGHT  snapshot drops the detail (returns None)
CAUGHT  snapshot pairs the reason with a stale detail

studio/backend: 100 passed.

Backend CI (Python 3.13) went red across several open PRs on

  assert (True, 'mlx_u...eds >=0.4.4)') == (True, 'mlx_u...ilable', None)

and none of those PRs touch this code. _hardware_snapshot reads three
fields; the test pinned all three while monkeypatching only two, so the
third assertion held on whatever the real hardware module happened to be
carrying. That was None until an mlx-vlm bump left a live
'(needs >=0.4.4)' detail behind, and the whole thing tipped over.

The failure then reads as a snapshot bug, which is the expensive part: it
sends the next person into main.py's seqlock, which is fine.

So the detail is stubbed too. And since stubbing it to None could equally
hide a snapshot that had stopped reading it at all, the test now also
pins a non-None detail and asserts it travels with its reason -- which is
the property the test is named for. Mutation-tested both ways: a snapshot
that returns None for the detail, and one that pairs a reason with a
stale detail, are both caught.

studio/backend: 100 passed.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@danielhanchen
danielhanchen merged commit daa74f6 into main Aug 19, 2026
32 of 33 checks passed
@danielhanchen
danielhanchen deleted the fix-warm-window-detail-leak branch August 19, 2026 09:18
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