fix: prevent llm fallback retries after output - #7233
Open
chenghao-mou wants to merge 2 commits into
Open
Conversation
Mark post-output API errors non-retryable when retry_on_chunk_sent is false, so the outer LLMStream retry loop cannot replay text or tool calls. Preserve retries before output and explicit opt-in retries after output. Addresses AGT-3492 Based on the diagnosis and reproducers in livekit/agents-js#2477. Related fix: livekit/agents-js#2480 Co-authored-by: Dan Tran <7690403+dtran26@users.noreply.github.com>
Track text and tool-call output when each chunk enters the stream channel, before a provider can raise and retry within the same event-loop turn. Apply the fallback adapter's retry policy to foreground child streams. Preserve metadata-only retries, recovery probes, and explicit opt-in retries. Addresses AGT-3492 Fixes Devin's "Child retries still replay output" finding on e295c64.
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.
Outer retries could replay text or tool calls after a provider failure. Mark the error non-retryable when
retry_on_chunk_sent=False; preserve pre-output and opt-in retries.Addresses AGT-3492. Adopts @dtran26's diagnosis and reproducers from agents-js#2477, matching the outer-retry fix in agents-js#2480.
Validated: 35 fallback tests,
make check, and 2,911 broader tests. Excluded baseline Google credential and missinglivekit-serverfailures, both reproduced on main.Initial prompt and agent context
Model: GPT-6