Repository navigation
fix(evaluator): give evaluations a free worker after a timeout - #611
Open
tushar-mahalya wants to merge 1 commit into
Open
tushar-mahalya wants to merge 1 commit into
tushar-mahalya wants to merge 1 commit into
Conversation
A timed-out evaluation keeps running in its executor thread. With the default parallel_evaluations=1 that thread is the only one, so every later evaluation queued behind it and timed out without starting, even for valid programs. Replace the executor when a call times out.
|
|
This branch has not been deployed
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.
Fixes #610
When an evaluation times out,
asyncio.wait_forstops waiting but the call keeps running in its executor thread. With the defaultparallel_evaluations=1, that thread is the only worker, so every later evaluation queues behind it and times out without starting. One program with an infinite loop turns all the valid programs after it into timeouts for the rest of the run.This adds
Evaluator._run_with_timeout, which swaps in a fresh executor when a call times out. The stuck executor is shut down withwait=False, so it still doesn't blockasyncio.run()cleanup, which was the point of #485. The four copies of therun_in_executor+wait_forcode (direct evaluation and cascade stages 1 to 3) now all go through this helper. Timeout handling and the returned results are unchanged.I added two tests, one for direct evaluation and one for the cascade. Each evaluates a hanging program and then a valid one, and checks that the second isn't reported as a timeout. Both fail on main and pass with this change. The full suite passes (1140 tests, 7 skipped).
I also checked it end to end with a fake OpenAI server. Before the change, iterations 2 to 5 (all valid code) reported timeouts. With it, only the hanging program and its child do, and the best score improves as expected.
Things to be aware of:
parallel_evaluations > 1, evaluations already running when the executor is swapped still finish on the old one. Only new submissions use the new executor.except asyncio.TimeoutErrorbranches instead of a shared helper.Found and fixed with help from Claude Code; I reproduced and tested it myself.