Repository navigation
test(episode): give the episode tests' wait a budget that covers a cold start - #745
Merged
andrewpark-scaleai merged 1 commit intoNov 18, 2026
Merged
Conversation
The first episode in a process imports every sandbox provider's SDK before its first turn opens, which takes several seconds. Run on its own, test_a_turn_not_taken_by_its_deadline_fails_the_run_and_is_never_handed_out spent its whole 5 s wait on that import and timed out before the 1 s turn deadline began. The wait returns as soon as its condition holds, so a 30 s budget costs a passing test nothing.
earakely-scale
approved these changes
Nov 18, 2026
andrewpark-scaleai
deleted the
andrew-park/fix-flaky-turn-deadline-test
branch
November 18, 2026 16:48
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.
Why
test_a_turn_not_taken_by_its_deadline_fails_the_run_and_is_never_handed_outfails every time it runs alone, on main included, with aTimeoutErrorfrom the test's own wait. It passes in CI only because an earlier test in the same worker usually pays a one-time cost first.The first episode in a process looks up request headers for its in-process agent's MCP URL. That lookup imports every registered sandbox provider's SDK, which took 5 to 10 s on a dev box (Daytona's alone was 5.7 s under a profiler). The test's
_untilhelper allows 5 s, so the import used up the whole budget before the run's 1 s turn deadline started.What
_untilintst/unit/task/episode/run_test.pyallows 30 s instead of 5 s. It polls every 10 ms and returns as soon as its condition holds, so a passing test finishes at the same speed. Only a test that is really broken waits the full 30 s.Design decisions
Test
Before: 3 of 3 runs failed with
TimeoutErrorin_until. After: 3 of 3 passed, in about 7 s each.

Confidence Score: 5/5
This PR appears safe to merge.Summary
Raises the episode tests’
_untiltimeout from 5 to 30 seconds to cover cold-start imports.Reviews (1) · Last reviewed commit: "test(episode): give _until a budget that..." · Reviewed by Greptile