Retry completion responses missing 'choices' instead of crashing the actor - #148
Open
jlamypoirier wants to merge 1 commit into
Open
Retry completion responses missing 'choices' instead of crashing the actor#148jlamypoirier wants to merge 1 commit into
jlamypoirier wants to merge 1 commit into
Conversation
…actor A malformed or error response (an HTTP 200 carrying an error body, or an empty payload) can lack 'choices'. llm_async_generate parsed it unguarded, raising KeyError, which the actor does not catch — so a single bad vLLM response killed the entire rollout loop mid-run. Raise RetryableAbortedCompletionError instead, so it is retried like other transient vLLM failures. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Authored by Claude Opus 4.8 (1M context) via Claude Code.
Problem
The actor can die mid-run with:
A single response lacking
choicescrashes the whole rollout loop.Root cause
llm_async_generatefetches the completion in a retry loop._is_retryable_abort_responsealready inspectschoicesbut returnsFalsefor a missing one (correctly — a missingchoicesis not an abort), the loop breaks, and the post-loop parse dereferencesresponse_data["choices"][0]...unguarded. When the body lackschoices(e.g. an HTTP 200 carrying an error object, or an empty payload) this raisesKeyError; the surroundingtry/exceptonly logs and re-raises, and the actor retriesRetryableAbortedCompletionErrorbut not a bareKeyError, so it propagates and kills the actor.Fix
After the loop, if
response_datahas nochoices, raiseRetryableAbortedCompletionErrorso the response is retried like other transient vLLM failures.Scope — what this does and does NOT cover
run_vllm1process exits non-zero, and the launcher's monitor is fail-fast —launch.pytears down the entire run when any child exits non-zero (gently_stop_all_processes(); sys.exit(1); comment: "if just one dies non-zero, stop all"). So a dead engine ends the run regardless of this actor guard. Surviving that needs launcher-level resilience (restart the dead inference server + route the actor around it), which is out of scope here.choices(a server-side error / OOM / EngineCore death are all plausible; in the case that motivated this, the engine had died and was returning a 200InternalServerErrorbody).🤖 Generated with Claude Code