fix(auth): retain session affinity on transient errors - #212
Open
warelik wants to merge 1 commit into
Open
Conversation
Port upstream #5109: primary session binding is now retained across 5xx/429/408 and cloudflare challenges, while terminal auth rejections (401/402/403/404, invalid_grant, unsupported model) still release it. A sticky temporary fallback cache keeps failover from flapping while the primary credential cools down, then returns to the warm cache on recovery. This flips the Plus-pinned release-on-failure behavior and removes the session quarantine mechanism that is no longer needed.
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.
Ports
router-for-me/CLIProxyAPI#5109into Plus.Summary
fallbackCacheso a single sticky fallback is used while the primary cools down, then the session returns to the primary once it recovers.SessionCache.Aliases(sessionID).session_affinity_retention_test.gosuite.Behavior flip
This intentionally reverses the release-on-failure semantics pinned since #188, as discussed in #204. Existing tests that asserted the old purge-and-rebind behavior have been updated to the retention expectations:
TestSessionAffinity_RetryableFailureInvalidatesMatchingBindingTestSessionAffinity_StreamFailureThroughWrapperInvalidatesTestSessionAffinitySelector_FailoverWhenAuthUnavailableTestManagerSessionAffinityPreservesBindingAcrossHigherPriorityRecoveryCloses #204