Skip to content

feat(resilience): opt-in max_tokens scaling for the non-streaming execution deadline - #18657

Open
jjxyxsjr wants to merge 2 commits into
cheaper-inference:release/v3.8.53from
jjxyxsjr:feat/nonstream-execution-deadline-scaling
Open

jjxyxsjr wants to merge 2 commits into
cheaper-inference:release/v3.8.53from
jjxyxsjr:feat/nonstream-execution-deadline-scaling

Conversation

@jjxyxsjr

@jjxyxsjr jjxyxsjr commented Oct 31, 2026 •

Copy link
Copy Markdown

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=32768 non-stream requests killed at exactly the base deadline, repeatedly, while the same calls streaming succeeded.

Changes

Validation

tests/unit/execution-expiration-scaling.test.ts — 7 assertions pin, per mode:

  • default: base returned unchanged for any maxTokens (the compatibility property)
  • auto: 32768 × 20ms scaled past the base; 1024 tokens keep the base (floor semantics); 1_000_000 tokens cap at 900s; 0/undefined keep the base
  • numeric: 600000 fixed floor; 0 passes through as a no-op floor
  • junk (junk, -5, 1e999→Infinity) ignored

tsc -p tsconfig.typecheck-core.json exit 0 · repo npm run lint exit 0 · check:env-doc-sync green for this variable (the gate does fail on the pristine release/v3.8.53 base for the unrelated pre-existing OMNIROUTE_MODEL_SYNC_TIMINGS gap — 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

  • Unset = the only delta is a boolean env check — identical behavior, effectively zero cost.
  • No new dependencies, no schema change, no UI. The 20ms/token floor and 15-min cap are deliberately conservative; happy to make them configurable.
  • Base: release/v3.8.53 (active release branch); aware of the 3.8.55 v4-feature retarget policy.

jjxyxsjr added a commit to jjxyxsjr/omniroute-upstream that referenced this pull request Oct 31, 2026
@jjxyxsjr
jjxyxsjr force-pushed the feat/nonstream-execution-deadline-scaling branch from d7c89aa to 5d6bf3f Compare October 31, 2026 07:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant