Treat runtime queue saturation as backpressure, not target failure - #36
Merged
Merged
Conversation
A queue-timeout or queue-full 429 (from this gateway's runtime queue or relayed by a federated node) opened the per-target circuit breaker. While it was open, or while its single half-open probe sat in the same queue, every other caller was fast-failed as "temporarily unavailable" even though the model was healthy and merely busy. Entities sharing one local model lost turns to this cascade. Recognize RUNTIME_QUEUE_TIMEOUT / RUNTIME_QUEUE_FULL (including the code carried in a federated upstream's error body) and release the probe instead of recording a target failure. Failover to a next member is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A relaying gateway rewrote a federated node's RUNTIME_QUEUE_* error body to the generic 'upstream_error', so the breaker exemption survived only one hop. Keep the queue code on the relayed error; its response body and Retry-After then carry backpressure to every downstream gateway and client. Co-Authored-By: Claude Opus 5.5 <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.
Summary
RUNTIME_QUEUE_FULL/RUNTIME_QUEUE_TIMEOUT) is load, not a broken target. The failover path now releases the target probe instead of recording a target failure, so busy nodes are not marked unhealthy.upstream_error.Test plan
node test/model-failover.test.mjsnode --test test/runtime-queue.test.mjs test/federated-priority.test.mjs🤖 Generated with Claude Code