Repository navigation
Fix the deterministic macOS failure in the floating monitor geometry test - #7714
Closed
danielhanchen wants to merge 1 commit into
Closed
danielhanchen wants to merge 1 commit into
danielhanchen wants to merge 1 commit into
Conversation
…geometry The geometry check baselines the panel with a single bounding_box() taken as soon as the caller observes an /api/system request go out. The response has not been applied yet at that point, so the panel is still painting use-system.ts's zero-filled DEFAULT_SYSTEM, which reports no GPU. On a host that does report one the VRAM row then lands and adds a row permanently, so the panel never returns to the sampled baseline and "content shrink" waits out its whole 5s deadline before failing. That is why this looked flaky but is not: macos-14 reports a single MLX device and failed on every PR, while ubuntu-latest and windows-latest have no GPU row to add and passed. Three jobs share the name "Chat UI Tests", so the one consistent platform failure read as one of three parallel runs failing at random. Wait for the payload to be rendered and for the panel to have finished resizing to it before sampling the baseline. The gate requires a non-zero RAM total, the scroll region to exactly fit the content it was reconciled against, and that geometry to hold for two consecutive animation frames, which is how Playwright defines a stable element and is what wait_for_function's default polling="raf" provides.
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
Member
Author
|
Superseded by #7722, which combines this with the other two repo-wide CI fixes so a single merge unblocks the whole batch. The files there are byte-identical to this PR's head, and the commits are cherry-picked with provenance. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Chat UI Testshas been red across the repo's open PRs. It is not flaky: it fails deterministically on macOS, and the appearance of flakiness comes from three separate workflows publishing the same check name.On #7686, the three checks named
Chat UI Testsare three different runners:macos-14ubuntu-latestwindows-latestSo "one of three parallel runs failed" reads as a flake but is one consistently broken platform. Every mac failure emits the identical box,
{'x': 1008, 'y': 712, 'width': 256, 'height': 172}.The race
In
exercise_floating_monitor_geometry, the caller gates on the/api/systemrequest, not its response, becausectx.on("request", ...)fires when the request is issued:initial_boxis then sampled a couple of IPC round trips later with no further gate. Until the response is applied, the panel paintsuse-system.ts'sDEFAULT_SYSTEM, whosegpuis{available: false, devices: []}. On macOSdetect_hardware()returnsDeviceType.MLXandhardware.py:2705reports"available": Truewith one device, sohasGpuflips andfloating-monitor.tsx:469renders a VRAM row. The panel's natural height changes permanently.That makes the later predicate unsatisfiable:
The bottom-anchor half passes (712 + 172 = 884 = 900 - 16); only the height comparison against the stale baseline fails, which is exactly the reported box. The growth check is satisfied by the VRAM row alone, which is why growth completes in 0.4s and the shrink burns its whole deadline.
Measured against the real component with the real stylesheet: RAM alone renders 113.5px, RAM plus one VRAM row renders exactly 172.0px at y=712.
The fix
Wait for the real signal before sampling the baseline, via one
wait_for_functionwith three conditions: a non-zero RAM total (proving a real payload replacedDEFAULT_SYSTEM), the scroll region exactly fitting the content it was reconciled against (proving the ResizeObserver pass landed), and that geometry holding for two consecutive animation frames.The frame-stability condition is load-bearing. There is an intermediate state where both rows exist but the
space-y-3gap has not been applied, and that state is self-consistent, so an instantaneous check latches onto it. Two frames is how Playwright itself defines a stable element, andwait_for_functiondefaults topolling="raf", so consecutive polls are consecutive frames.No sleeps added and no timeout raised.
Verification
The real
exercise_floating_monitor_geometrywas extracted fromgit show HEAD:(before) and the working tree (after) and run against the live component with the/api/systemresponse held back by a randomised delay:Every "before" failure reproduced the byte-identical CI string including
'height': 172. The no-GPU control explains why ubuntu and windows pass and confirms the fix does not regress them.Scope
Test-only; no frontend or backend file is touched.
Two things this was not able to establish locally: the suite was not run end to end (the harness renders the real
FloatingMonitorfrom the worktree through the project's own vite server and executes the real test function, but it is not the whole suite), and it was not run on macOS, so the MLX-implies-available: Truestep rests on the backend source plus the platform correlation of the failing jobs rather than on a mac run. CI on this PR covers both.