Repository navigation
Retry silent requests and temporarily deprioritize stalled nodes - #38
Merged
Merged
Conversation
A peer can accept a connection without ever answering. Each request then spends the entire response-header deadline on that peer before failing over, because candidate ordering remembers nothing about the stall. Record full silent header and inference first-body deadlines in each proxy process and move the candidate behind its eligible peers for one configured deadline. Expiry and a successful response restore normal ordering. Keep cooling candidates routable, including in a single-node cluster, and stop reservations or prefix affinity from promoting them back over ready peers. Hold successful inference responses until initial body bytes or valid empty EOF arrive, so a silent or dropped pre-commit attempt can use the existing failover loop. Preserve the request and workload identity and never replay a committed stream. Apply the same implementation and frozen-upstream regressions to Ollama, LM Studio, and oMLX. The default remains 120 seconds. Adapt the design from NVIDIA#144 and the pre-commit retry in NVIDIA/Personal-AI-Router@e0f75dd, addressing NVIDIA#6. Retain the existing unreleased proxy patch versions relative to v0.8.0, following the fork's versioning practice. Co-authored-by: canja006 <82221082+canja006@users.noreply.github.com> Co-authored-by: Noah (Terve) Tervalon <ntervalon@nvidia.com> Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
A fixed post-header deadline can abandon healthy long-context prefill and duplicate work on another node. LM Studio can send headers immediately, and large MLX models on Macs can remain silent for several minutes before their first response body bytes. Default the independent first-body timeout to disabled in all three proxies. Enable it only through --first-body-timeout or NVPAIR_PROXY_FIRST_BODY_TIMEOUT, with the flag taking precedence and zero explicitly disabling an environment opt-in. Keep the 120-second header deadline, header-stall cooldown, and pre-commit error retry unchanged. Add a slow-after-headers regression that fails under the previous default, configuration coverage, and flag/env opt-in stall cases. Require healthy failover peers to receive the full original body and require running workload notifications to name the serving node before completion. Update the READMEs, architecture, and troubleshooting with the distinct settings and the duplicate-work trade-off of enabling a first-body deadline. Signed-off-by: Jared Ping <13906915+JaredP94@users.noreply.github.com>
JaredP94
force-pushed
the
fix/stalled-node-retry
branch
from
November 3, 2026 06:37
1c21b05 to
fef5b77
Compare
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.
Description
A node can accept connections without returning response headers, making every request pay the full upstream deadline before failover. All three proxies now remember that measurement and move the stalled candidate behind its eligible peers for one configured response-header duration. Time expiry or a successful response restores normal ordering; the node is never excluded.
Successful inference waits for initial response-body bytes (or a valid empty EOF) before committing, so a pre-commit drop can use the existing failover list by default. Retries keep one request/workload identity and never replay a committed stream. The response-header default remains 120 seconds, and there is no first-body deadline by default. Post-header silence triggers timeout-based retry only when explicitly enabled with
--first-body-timeoutorNVPAIR_PROXY_FIRST_BODY_TIMEOUT.Addresses NVIDIA#6. Adapted from NVIDIA#144 and the pre-commit retry portion of NVIDIA/Personal-AI-Router@e0f75dd.
Scope
ollama-proxy,lmstudio-proxy, andomlx-proxy.--first-body-timeout/NVPAIR_PROXY_FIRST_BODY_TIMEOUTaccepts a positive Go duration. Default0disables it; the flag overrides the environment, and explicit0disables an environment opt-in. Invalid/negative values leave it disabled. Only an enabled first-body timer can turn post-header silence into retry/cooldown; cooldown still lasts one response-header duration.v0.8.0: Ollama and LM Studio1.4.0 → 1.4.1, oMLX1.4.1 → 1.4.2. No additional bump is needed under the implementation brief's fork practice. No changelog edits.Validation
On macOS arm64, in each of the three touched Go modules:
All passed after the review changes. At repository root,
git diff --checkpassed andnode scripts/spdx-headers.mjsreported 0 missing.Regression evidence in every proxy:
httptestupstreams cover accepting without headers under default configuration, plus headers-without-body with an explicit flag opt-in and an environment opt-in. A second request reaches only the healthy peer, which must receive the complete original request body on both requests.TestDefaultFirstBodyWaitIsUnboundedlets a healthy upstream remain silent after headers for three times the shortened test header budget. It completes without failover or cooldown. Before the fix, this new regression failed in all three proxies by dispatching duplicate work to the fallback.No desktop files changed. No real engine installation, live-cluster, or cross-process tests were run. Linux/Windows checks are static vet only, not runtime certification. The initial secondary-model review attempt timed out without a report.
Risk
--first-body-timeout/NVPAIR_PROXY_FIRST_BODY_TIMEOUTcan abandon legitimate prefill and duplicate work on a second node if set too short. Leave it disabled unless that trade-off is intended; choose a budget appropriate for long contexts, cold loads, and queues. The flag overrides the environment, and--first-body-timeout 0explicitly disables it. Header and enabled first-body waits are separate and can both be incurred before failover.--response-header-timeout/NVPAIR_PROXY_RESPONSE_HEADER_TIMEOUTif necessary, independently of the optional first-body setting.Checklist
git commit -s), certifying the Developer Certificate of Origin.