Skip to content

test(session): park the replay-gap claimant deterministically before the reset - #13122

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
billygerhard:fix/stop-gate-park-before-reset
Sep 23, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
billygerhard:fix/stop-gate-park-before-reset

Conversation

@billygerhard

Copy link
Copy Markdown
Contributor

Problem / Motivation

test/test_cross_surface_stop_gate.py::TestStopTurnRecordsASessionScopedStop::test_a_woken_claimant_lands_behind_the_successor flakes on Windows shard 5 (#13115): assert order == ['replay'] sees ['newer', 'replay'].

Why it matters

A PR that lands on that shard while the runner is slow goes red for a reason unrelated to its diff; on a fork PR every re-roll needs a maintainer to release the workflow hold again. #11827 hit it once today; the same shard was green on its three previous heads.

What changed

Symptom: the woken waiter appears to run ahead of the replay → root cause: the test's scenario is "a claimant ALREADY parked on the held lease when the reset lands", but it establishes that with await asyncio.sleep(0.05); on a loaded Windows runner the waiter task has not reached the semaphore in 50 ms, so the reset lands on a claimant that has passed the gap check but not yet parked -- a different scenario whose outcome (newer first) is not what the test is pinning → change: a bounded _until_parked(mgr, key) helper polls the lease semaphore's waiter list and the reset is issued only once a claimant is provably parked; the post-replay absence check is kept generous (loop yields plus a short sleep) rather than tightened. Test-only; no production code touched.

The un-parked claimant window (gap check passed, park not yet reached, reset lands) is a separate question about get_or_create ordering, noted on #13115 for the maintainers; this PR does not change the product and does not widen the test to that scenario.

Backwards compatibility

Compatible: test-only change.

Tests

The changed test file (20 pass locally). The new precondition makes the intended scenario deterministic; the assertion still fails if the woken claimant does not queue behind the open gap.

Manual verification

N/A — unit coverage sufficient; the runner-timing dependence is removed by construction rather than by widening a sleep.

Screenshots / video

N/A — no UI change.

Closes #13115

…the reset

test_a_woken_claimant_lands_behind_the_successor asserted its scenario -- a
claimant ALREADY parked on the held lease when the reset lands -- with a 50 ms
wall-clock sleep. On a loaded Windows runner the waiter task had not reached
the semaphore in that window, so it was a different claimant (one that had
passed the gap check but not yet parked) and the ordering assertion saw
['newer', 'replay'] (kirodotdev#13115). Wait for the park itself: poll the lease
semaphore's waiter list, bounded, so the reset provably lands on a parked
claimant, and keep the post-replay absence check generous (loop yields plus
a short sleep) rather than tight.

Closes kirodotdev#13115
@billygerhard
billygerhard requested review from a team and dwu96 September 23, 2026 16:58
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 91126dc163a3ac629817831af1573bf250c11da7 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 91126dc

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 91126dc163a3ac629817831af1573bf250c11da7 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the un-parked-claimant ordering question gets its own open tracker, since this PR closes #13115 where it was noted.

[DESIGN-REVIEWED] 91126dc

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 91126dc163a3ac629817831af1573bf250c11da7 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 91126dc

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 23, 2026
@iamwhatever
iamwhatever merged commit c555c72 into kirodotdev:main Sep 23, 2026
139 of 140 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 23, 2026
@billygerhard
billygerhard deleted the fix/stop-gate-park-before-reset branch September 23, 2026 18:31
wknight1 pushed a commit to wknight1/KiroCrew that referenced this pull request Oct 5, 2026
…the reset (kirodotdev#13122)

test_a_woken_claimant_lands_behind_the_successor asserted its scenario -- a
claimant ALREADY parked on the held lease when the reset lands -- with a 50 ms
wall-clock sleep. On a loaded Windows runner the waiter task had not reached
the semaphore in that window, so it was a different claimant (one that had
passed the gap check but not yet parked) and the ordering assertion saw
['newer', 'replay'] (kirodotdev#13115). Wait for the park itself: poll the lease
semaphore's waiter list, bounded, so the reset provably lands on a parked
claimant, and keep the post-replay absence check generous (loop yields plus
a short sleep) rather than tight.

Closes kirodotdev#13115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(windows): test_cross_surface_stop_gate::test_a_woken_claimant_lands_behind_the_successor flakes on shard 5 (50 ms sleep ordering)

2 participants