Keep the leaked solver daemons off the known-lane pass under pytest - #406
Merged
Merged
Conversation
test_interval_gate_holds_between_passes asserts that its first maybe_run_pass runs, and under xdist that assertion fails now and then with the attempt count still 0 (2026-09-06, 2026-09-15 on #389, and twice in a row on #403, all diffs that never touched the backend). conftest turns KNOWN_LANE_MODE off for the suite so the solver worker daemons every TestClient lifespan leaks do not poll the pass, but DARK_FOLLOW_MODE keeps its "shadow" default, lanes_armed() is true when either lane is on, and maybe_run_pass returns early only when both are off. So every leaked daemon takes the pass lock, stamps the pass clock and runs an empty dark-follow pass every two seconds, and one landing between the fixture's clock reset and the test's first call leaves that call gated. DARK_FOLLOW_MODE is now off for the suite the way KNOWN_LANE_MODE is, and the known-lane fixture turns it off again per test for a daemon armed while another file had a lane on, before the reset that drains any pass in flight. Tests that exercise dark following already set the mode themselves. The fixture's clock comment is trimmed to the reason the reset stands; the ordering story it told was the first guess at this. ClickUp: 123zgec3130 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Claude finished @Babissimo's task in 1m 45s —— View job Review: PR #406 — Keep the leaked solver daemons off the known-lane pass under pytest
Verdict: looks correct, no blocking issues found. I traced the mechanism the PR describes against the actual source and it holds up:
The fix is minimal and consistent with the existing pattern:
Minor, non-blocking observations:
Nice, precise root-cause fix — matches the two-flag semantics of |
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.
ClickUp test_known_lane interval-gate test still flakes under xdist despite its own mitigation.
test_interval_gate_holds_between_passesfails now and then under xdist with its first assertion reading 0 attempts (2026-09-06, on #389, and twice in a row on #403 today, none of them backend diffs). The ticket had the mechanism right, and review found why the mitigation did not hold: conftest turnsKNOWN_LANE_MODEoff for the suite, butDARK_FOLLOW_MODEkeeps itsshadowdefault,lanes_armed()is true when either lane is on, andmaybe_run_passreturns early only when both are off. So every solver worker daemon a TestClient lifespan leaks takes the pass lock, stamps the pass clock and runs an empty dark-follow pass every two seconds, and one landing between the fixture's reset and the test's first call leaves that call gated.What changes
backend/tests/conftest.py:DARK_FOLLOW_MODEdefaults tooffunder pytest, beside the existingKNOWN_LANE_MODEline, so no leaked daemon is armed at thread start.backend/tests/test_known_lane.py: the autouse fixture turnsDARK_FOLLOW_MODEoff per test as well (a daemon armed while another file had a lane on keeps polling), before the reset that drains any pass in flight, and restores it afterwards. Its clock comment is trimmed to the standing reason for the reset.Tests that exercise dark following already set the mode themselves (
test_dark_follow.py's own autouse fixture does the same per test). The ticket's other option, asserting on a return value, is not available:maybe_run_passreturns None. The leaked daemons themselves stay with the ticket.Verification: the full backend suite locally against this branch: 3608 passed, 2 skipped, 0 failed;
pre-commiton both files: all hooks passed.🤖 Generated with Claude Code