Repository navigation
Fix the composer clearing test timeout on busy CI runners - #1173
Merged
Merged
Conversation
TestClock.advance runs Task.megaYield twice per tick, and each megaYield starts 20 detached background-priority tasks. On a busy CI runner those tasks starve. The capped kill-lines case steps the clock through up to 80 settle polls, so it hit the one-minute time limit (5 of the last 7 failed test runs). Under full CPU load it fails locally too; with TASK_MEGA_YIELD_COUNT=0 it passes in 5 ms. The executor counts settle polls, not time, so inject YieldingClock, whose sleep is one Task.yield. The typing test now injects the local key at the first settle poll through onObserve instead of advancing a TestClock.
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.
Summary
AgentComposerClearingTests/killLinesStopsAtTheFirstEmptyReadingAndCapsPresses()hit its one-minute time limit in 5 of the last 7 failedtestruns (for example run 45141949753). The fix in 616d312 did not stop it.Root cause:
TestClock.advancerunsTask.megaYieldtwice per tick. EachmegaYieldstarts 20 detached.background-priority tasks. On a busy runner those tasks starve. The capped case steps the clock through up to 80 settle polls, which is thousands of such tasks.Fix: the executor counts settle polls, not time. The tests now inject
YieldingClock(new, inTestWaiting.swift), whosesleepis oneTask.yield(). The typing test injects the local key at the first settle poll throughonObserve, asaLocalKeyCoincidingWithTheEmptyReadingRefusesalready does.TestClockis no longer used in this file. Theadvance(_:by:until:)doc now warns about the megaYield cost.Verification
yes× 2 × ncpu), the test failed locally at 60 s. WithTASK_MEGA_YIELD_COUNT=0it passed in 5 ms. This confirms the starvation.AgentComposerClearingTests(8 tests) passed 3 times in a row under the same load; the slowest test took 4 ms.make checkand the fullmake testpass.