fix(0.14.1): per-attempt fetch timeout + retry thrown network errors#24
Merged
Conversation
A production eval persona burned 15 minutes on a single hung request: the tcloud router accepted the connection, never responded, and the fetch sat open until the runtime gave up with `fetch failed`. Two gaps in createOpenAICompatibleBackend caused it: 1. No per-attempt deadline — a hung upstream blocked the attempt indefinitely. 2. Thrown fetch errors (network failure, DNS, the eventual `fetch failed`) propagated straight out of the retry loop. Only HTTP error *statuses* were retried; a thrown error killed the attempt. Fixes: - BackendRetryPolicy.requestTimeoutMs (default 120s) — each attempt gets an AbortController deadline linked to the caller signal. A hung upstream now aborts in 2 min and retries instead of hanging. - The fetch call is wrapped: a thrown error is treated as a retryable transport failure (backoff + retry) just like a 5xx. Caller-initiated aborts stay terminal. Exhausted retries throw BackendTransportError with the last error message. 3 new tests: thrown-error retry, per-attempt-timeout abort + retry, all-attempts-throw → BackendTransportError. 216 tests pass.
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
A real eval persona burned 15 minutes on one hung request — the tcloud router accepted the connection, never responded, and the fetch sat open until the runtime gave up with
fetch failed. Two gaps increateOpenAICompatibleBackend:fetch failedkilled the attempt.Fix
BackendRetryPolicy.requestTimeoutMs(default 120s) — per-attemptAbortControllerdeadline linked to the caller signal. Hung upstream aborts in 2min and retries.BackendTransportError.Test plan
Unblocks the eval run — without this one router hiccup kills a persona.