Skip to content

Wait for the earlier turn to finish instead of asserting it stayed queued - #423

Merged
abhishekgahlot2 merged 1 commit into
mainfrom
fix/stop-test-earlier-turn
Nov 5, 2026
Merged

abhishekgahlot2 merged 1 commit into
mainfrom
fix/stop-test-earlier-turn

Conversation

@abhishekgahlot2

@abhishekgahlot2 abhishekgahlot2 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor
  • Fixes the flaky stop.test.ts case "stopping a later turn leaves the threads an earlier turn delegated" (seen on Give every outgoing mail a Date, a Message-ID and an encoded subject #420 CI: Expected "queued", Received "running").
  • Stopping the later turn pumps its own thread, which correctly starts the earlier turn queued there, so the strict "queued" read raced the worker.
  • The test now asserts the delegated child stays queued and waits for the earlier turn to settle as completed.
  • Test-only change; 50 looped runs pass, also with the race window widened.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…eued

The stop test for a later turn read the earlier turn in the same thread as queued. Stopping the later turn pumps its own thread (src/runs/stop.ts), which correctly starts the earlier turn queued there; the spawned worker marks it running, so the read raced it and CI saw 'running'.

The product is right: the delegated thread is never touched and the earlier turn is not stopped. The test now asserts the delegated child stays queued and waits for the earlier turn to settle as completed, which also keeps its worker from running into later tests. 50 looped runs pass, also with the race window widened.
@abhishekgahlot2
abhishekgahlot2 merged commit 60d1bf5 into main Nov 5, 2026
38 of 39 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant