Repository navigation
Conversation
jjxyxsjr
added a commit
to jjxyxsjr/omniroute-upstream
that referenced
this pull request
Oct 31, 2026
jjxyxsjr
force-pushed
the
feat/nonstream-execution-deadline-scaling
branch
from
October 31, 2026 07:16
d7c89aa to
5d6bf3f
Compare
This branch has not been deployed
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.
Problem and behavior
The execution backstop (
RATE_LIMIT_EXECUTION_MAX_WAIT_MS/ per-connection overrides / the upstream fetch-start floor) is calibrated for interactive calls. A non-streaming request that legitimately asks for tens of thousands of output tokens can still be mid-decode when that deadline fires — the client gets a hard 504 while the upstream was healthy and working. Observed shape:max_tokens=32768non-stream requests killed at exactly the base deadline, repeatedly, while the same calls streaming succeeded.Changes
computeNonStreamExecutionExpirationMs(baseMs, maxTokens, env)inopen-sse/services/rateLimitManager.ts, opt-in viaOMNIROUTE_EXECUTION_EXPIRATION_MS: unset = base unchanged;auto= scale bymax_tokensat a conservative ~20ms/token decode floor (50 tok/s), clamped to[baseMs, 15 min]; a number = fixed floor in ms.withRateLimit's deadline becomes a three-waymax()— the caller floor can only raise the deadline; the per-connection and upstream-fetch-start floors (fix(resilience): requestQueue.maxWaitMs is applied as a post-dispatch execution expiration — legitimate long LLM calls die with false 504s #12025/fix(resilience): decouple rate-limit execution expiration from queue-wait budget; preserve errors in oversized call-log artifacts #12027 invariants) cannot be undercut.executeProviderRequest.tspasses the computed floor for non-streaming calls only; streaming is untouched (token output keeps the stream alive)..env.example+docs/reference/ENVIRONMENT.md.Validation
tests/unit/execution-expiration-scaling.test.ts— 7 assertions pin, per mode:maxTokens(the compatibility property)auto:32768 × 20msscaled past the base;1024tokens keep the base (floor semantics);1_000_000tokens cap at 900s;0/undefined keep the base600000fixed floor;0passes through as a no-op floorjunk,-5,1e999→Infinity) ignoredtsc -p tsconfig.typecheck-core.jsonexit 0 · reponpm run lintexit 0 ·check:env-doc-syncgreen for this variable (the gate does fail on the pristinerelease/v3.8.53base for the unrelated pre-existingOMNIROUTE_MODEL_SYNC_TIMINGSgap — docs fix open as #18723).Limitation: no end-to-end dispatch test — the helper is pure and the wiring is a 4-line floor passthrough into the existing
max(); per-connection/upstream floors are covered by the existing suites.Notes
release/v3.8.53(active release branch); aware of the 3.8.55v4-featureretarget policy.