fix(harness): classify undici stream-timeout terminations as transient network failures#1038
Open
LEFTEQ wants to merge 1 commit into
Open
fix(harness): classify undici stream-timeout terminations as transient network failures#1038LEFTEQ wants to merge 1 commit into
LEFTEQ wants to merge 1 commit into
Conversation
…t network failures When a provider response stream stalls past undici's headers/body timeout, the fetch is killed with `TypeError: terminated` (cause BodyTimeoutError / HeadersTimeoutError, codes UND_ERR_BODY_TIMEOUT / UND_ERR_HEADERS_TIMEOUT). The semantic-error catalog did not recognize either signal, so classifyModelCallError fell through to "recoverable" and a task-mode run failed with zero retries — a transient transport stall became a terminal run failure. Add the two undici timeout codes to NETWORK_ERROR_CODES and "terminated" to the exact-message fallback (same stripped-cause rationale as "fetch failed"). Fixes vercel#1037 Signed-off-by: Lukáš Přibík <lukas.pribik@reservine.me>
Contributor
|
Someone is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #1037.
Problem
When a provider/proxy response stream stalls past undici's headers/body timeout, the fetch is killed with
TypeError: terminated(causeBodyTimeoutError/HeadersTimeoutError, codesUND_ERR_BODY_TIMEOUT/UND_ERR_HEADERS_TIMEOUT). The semantic-error catalog recognizes neither the codes nor the message, soclassifyModelCallErrorfalls through to"recoverable"— and in task mode the harness fails the run outright with zero retries. A transient transport stall becomes a terminal run failure (hit in production behind a LiteLLM proxy; details in the issue).Fix
UND_ERR_BODY_TIMEOUTandUND_ERR_HEADERS_TIMEOUTtoNETWORK_ERROR_CODESinsemantic-errors/rules/system.ts— the coded rule wins whenever the cause chain survives."terminated"to the exact-equality message fallback, same stripped-cause rationale as"fetch failed"(undici'sFetch.terminaterejects with aTypeErrorwhose message is exactlyterminated). Equality, never containment.Both signals now summarize as
network-request-failed(tagtransient) →classifyModelCallErrorreturns"retry"andrunModelCallWithRetrieshandles it like any other transient network failure.Tests
semantic-errors.test.ts: coded shape (terminated+UND_ERR_BODY_TIMEOUTcause) and bareTypeError: terminatedboth classify asnetwork-request-failed.model-call-error.test.ts: the body-timeout shape classifies"retry"alongside the existing structural-signal cases.pnpm vitest runon both files: 71 passed.Note on commit signature: this commit carries a DCO sign-off but is not yet GPG/SSH-signed — happy to re-sign and force-push once my signing key is set up, or feel free to squash-merge.