Honor per-auth request_retry override for unexpected-EOF retries#3
Merged
Conversation
Co-Authored-By: Hex <hex@codeigniter.org.cn>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Addresses the P2 review comment on router-for-me#3726: the statusless "unexpected EOF" fast path used
retryAllowed(attempt, providers), which returns true if any auth in the provider still has retries. So a request running on a credential whose auth file setsrequest_retry: 0would still retry its EOF as long as a sibling credential allowed retries — bypassing the per-auth override that the cooldown path already honors.Fix: scope the EOF retry decision to the credential that actually failed.
shouldRetryAfterError(..., failedAuthID string)now receives the failed auth ID. The threeExecute*loops thread it in via a*stringout-param set inexecuteMixedOnce/executeCountMixedOnce/executeStreamMixedOnceright after the auth is selected (the last selected auth is the one tied to the returned error).eofRetryAllowedconsults the failed auth's own effective retry; falls back to the provider-wideretryAllowedwhen the auth is unknown:Why an out-param instead of reading
opts.Metadata[selected_auth_id]in the outer loop:ensureRequestedModelMetadatamay copyopts.Metadatainto a fresh map inside the once-functions, so the outeroptsdoesn't reliably see the selected auth. TheSelectedAuthCallbackMetadataKeycallback is already used byhandlers.go, so overwriting it was not an option.Statusless EOF on a retry-enabled credential is unchanged; only the disabled-credential case now stops retrying.
Test
TestManager_ShouldRetryAfterError_UnexpectedEOFRespectsAuthRequestRetryOverride: twoclaudeauths (onerequest_retry: 0, one default). EOF on the disabled auth → no retry; EOF on the enabled auth → retry; unknown auth → falls back to provider-wide retry.gofmt -w,go build ./...,go vet, andgo test ./...all pass.Link to Devin session: https://app.devin.ai/sessions/eb1be9597f8d44c9af3d671e9fda7c03
Requested by: @hex-ci