Skip to content

test: fix flaky mllama exact-zero assert and webui 401 wait - #2517

Merged
inureyes merged 2 commits into
mainfrom
fix/issue-2467-flaky-tests
Oct 21, 2026
Merged

inureyes merged 2 commits into
mainfrom
fix/issue-2467-flaky-tests

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

  • The mllama ragged multi-image test asserted an exact 0.0 max_abs_diff where a one-ulp reassociation difference is possible; it now uses the sibling reassociation tolerance with the same documented reasoning (fix(tests): tolerate f32 reassociation in the mllama tile-selection parity test #1067).
  • The WebUI router harness waited on the session-key prompt with a 5 s DOM window after assuming the refresh click's own request carries the rewritten header; it now waits on the 401 catalog response, which is the signal that the expired key was processed.

Item 2 root cause

WebUiSynchronizer.refresh() (webui/src/state/sync.ts) returns early when an observation tick is already in flight, so the explicit resnapshot behind the "Refresh server state" click only sets needsFullSnapshot and defers the forced full snapshot to the next 2 s poll tick. The one-shot route stays armed until that later tick's catalog GET, so the 401 lands at (in-flight tick remainder + 2 s poll + bootstrap latency) after the click, which exceeds the 5 s DOM wait under CPU load. An instrumented run confirmed the passing ordering: the click's own catalog GET consumes the one-shot route and the key prompt mounts ~22 ms after the 401 response, so the DOM signal itself was never late, the timing assumption was.

What changed

  • tests/mllama_parity.rs: ragged_multi_image_states_concatenate_real_rows asserts diff <= TILE_SELECTION_REASSOCIATION_TOL (1e-6) instead of 0.0, and the constant's doc comment now covers both comparisons in the file.
  • webui/tests/router-real.harness.ts: injectRealUnauthorizedCatalog registers a waitForResponse for the 401 catalog response (15 s cap) before arming the one-shot route, clicks refresh, awaits that response, then asserts the session-key field is visible.

Test plan

  • MLX_ENABLE_TF32=0 cargo test --profile test-fast --features cuda --test mllama_parity -- --test-threads=1 (8 passed)
  • Deliberately swapped media-major row order still fails the tolerance assert (max|delta|=0.316 vs 1e-6), then restored
  • 20 consecutive harness runs via the canonical make verify-webui-integration-fake invocation, runs 8-14 under a 16-process yes load

Closes #2467

The ragged multi-image test asserted max_abs_diff of exactly 0.0 against rows taken from the legacy all-tiles path, but the two sides batch tiles differently and reassociate the parallel reductions, so the same value can differ by one f32 ulp (1.19e-7 was seen once on main). Reuse the sibling TILE_SELECTION_REASSOCIATION_TOL (1e-6, #1067); a deliberately swapped media-major row order still fails the assert with a diff of 0.32.

injectRealUnauthorizedCatalog waited on the session-key field (5 s) but assumed the refresh click's own catalog request carries the rewritten header. WebUiSynchronizer.refresh() returns early while an observation tick is in flight, deferring the forced resnapshot to the next 2 s poll, so the 401 can land past the 5 s window under CPU load. Wait on the 401 catalog response instead (waiter registered before the route is armed), then assert the field, which mounts ~22 ms after the 401 is processed.

Validated with 20 consecutive harness runs, runs 8-14 under a 16-process yes load, and the full mllama parity file.

Closes #2467
@inureyes inureyes added priority:low Low priority status:review Under review type:test Test related changes labels Oct 21, 2026
@inureyes

Copy link
Copy Markdown
Member Author

PR Finalization Complete

Summary

  • Tests: Verified the test-only fix against issue test: fix intermittent mllama exact-zero assert and webui router race #2467; no missing coverage (the PR fixes two existing tests and introduces no new surface). Diff matches the PR body: the mllama ragged multi-image assert now uses TILE_SELECTION_REASSOCIATION_TOL (1e-6) and the webui harness waits on the 401 catalog response before asserting session-key visibility. PR body records the negative control (swapped row order still fails) and 20 consecutive harness runs.
  • Documentation: PR body root-cause section verified accurate against the code (WebUiSynchronizer.refresh() early return defers the forced resnapshot to the next 2 s poll tick; the key prompt mounts ~22 ms after the 401). No doc updates needed for a test-only change; the extract-flags docs item belongs to feat(token-classification): expose GLiNER2.5 CLI options, fix leftovers #2468.
  • Lint/Format: cargo fmt --all --check clean; eslint --max-warnings=0 clean on webui/tests/router-real.harness.ts; clippy on touched targets verified during the review passes.

All checks passing. Ready for merge.

Bilingual technical report for the flaky-test fixes (#2467): mllama reassociation tolerance and webui 401 wait.
@inureyes inureyes added status:done Completed and removed status:review Under review labels Oct 21, 2026
@inureyes
inureyes merged commit 93e75e9 into main Oct 21, 2026
27 of 28 checks passed
@inureyes
inureyes deleted the fix/issue-2467-flaky-tests branch October 21, 2026 06:00
@inureyes inureyes added this to the 0.8 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:low Low priority status:done Completed type:test Test related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: fix intermittent mllama exact-zero assert and webui router race

1 participant