You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tests/unit/global_repos/test_verification_semaphore.py::TestSemaphoreConcurrencyCap::test_semaphore_caps_concurrent_callers_at_exactly_cap is flaky: it fails intermittently under concurrent CPU load, with an internally impossible observed value, but passes deterministically in isolation.
Evidence
Failed once during the v11.28.0 full regression run, while the machine was saturated (fast-automation took 13:44 vs. the normal <10 min — a loaded-machine signature). Failure state captured in the traceback: shared = _SharedState(active=0, peak=7, released=True, ...)
with cap=2, num_callers=3. A peak=7 is physically impossible for a test that starts only 3 caller threads — a correct-or-broken semaphore would yield peak <= num_callers = 3. A value above the caller count can only come from the _SharedState/timing coordination in the test harness misbehaving under CPU saturation (counter contamination / lost condition-variable wakeups), not from a real semaphore-cap violation in production code.
Passed 5/5 in isolation (idle machine, immediately after the regression completed).
Pre-existing flaky test (test-harness concurrency race), NOT a product bug and NOT a v11.28.0 regression. verification_semaphore is entirely unrelated to the v11.28.0 changes (#1321 temporal-query provider resolution, #1322 langfuse test isolation).
Impact
Intermittent false failures in fast-automation.sh when the suite runs under heavy concurrent load. No production impact.
Fix Direction
Harden the test harness against load-induced flakiness: make _SharedState.peak/active bookkeeping and the "wait until cap active, then release" coordination robust to scheduler delays (e.g. bounded condition-variable waits with explicit re-checks, or assert on the semaphore's own accounting rather than a wall-clock-timed thread snapshot). The peak > num_callers observation is the key clue — the peak counter is being incremented/read outside proper synchronization. Reproduce by running the test under artificial CPU load (e.g. concurrent stress/parallel pytest) rather than in isolation.
Summary
tests/unit/global_repos/test_verification_semaphore.py::TestSemaphoreConcurrencyCap::test_semaphore_caps_concurrent_callers_at_exactly_capis flaky: it fails intermittently under concurrent CPU load, with an internally impossible observed value, but passes deterministically in isolation.Evidence
shared = _SharedState(active=0, peak=7, released=True, ...)with
cap=2, num_callers=3. Apeak=7is physically impossible for a test that starts only 3 caller threads — a correct-or-broken semaphore would yieldpeak <= num_callers = 3. A value above the caller count can only come from the_SharedState/timing coordination in the test harness misbehaving under CPU saturation (counter contamination / lost condition-variable wakeups), not from a real semaphore-cap violation in production code.Classification
Pre-existing flaky test (test-harness concurrency race), NOT a product bug and NOT a v11.28.0 regression.
verification_semaphoreis entirely unrelated to the v11.28.0 changes (#1321 temporal-query provider resolution, #1322 langfuse test isolation).Impact
Intermittent false failures in
fast-automation.shwhen the suite runs under heavy concurrent load. No production impact.Fix Direction
Harden the test harness against load-induced flakiness: make
_SharedState.peak/activebookkeeping and the "wait until cap active, then release" coordination robust to scheduler delays (e.g. bounded condition-variable waits with explicit re-checks, or assert on the semaphore's own accounting rather than a wall-clock-timed thread snapshot). Thepeak > num_callersobservation is the key clue — the peak counter is being incremented/read outside proper synchronization. Reproduce by running the test under artificial CPU load (e.g. concurrentstress/parallel pytest) rather than in isolation.Severity
priority-4. Test-infrastructure flake; false-positive noise only.