GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): classify AISDK network failures as transport errors by rekram1-node · Pull Request #45840 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

On the AISDK bridge, native network exceptions that the SDK does not wrap in APICallError — undici terminated/fetch failed, Bun connection errors (ECONNRESET, ConnectionClosed, ...), and our own SSE chunk-timeout error — previously fell through llmError to UnknownProviderError. They retry under the unknown-failure default, but they lack transport semantics: a mid-stream socket drop on this path could never take the continue-after-partial-output route, because the step continuation gate only recognizes Transport failures with operation: "read".

  • llmError now takes the operation from its call site: doStream rejection is "request", stream read failures and stream error parts are "read".
  • Recognized native network failure shapes construct a TransportError (transport: "http", call-site operation, extracted code) instead of UnknownProviderError. Recognition walks the cause chain (depth-bounded, tolerant of cyclic causes) so wrappers like undici's fetch failed TypeError resolve to the specific code on their cause.
  • The recognition list is deliberately minimal and traceable: the AI SDK's own Bun network error code list from handleFetchError, the UND_ERR undici code prefix, undici's fetch/stream termination strings, and the wrapSSE chunk-timeout message. Anything unrecognized still retries via the UnknownProvider default, so a miss costs only the transport label, not retryability.

Behavior notes

  • Mid-stream network drops on the AISDK path now match the existing interrupted-stream continuation gate (operation: "read"), preserving partial output instead of only retrying from scratch.
  • Request-phase failures classify as Transport with operation: "request" and undefined delivery, which is retry-eligible under the existing policy — same eligibility as before, now with the accurate category.
  • The native (non-AISDK) path already produced TransportError for these shapes and is unchanged.

Verification

  • New tests: request-phase fetch failed + ECONNREFUSED cause, mid-stream terminated + UND_ERR_SOCKET, SSE chunk timeout, and an unrecognized-code case staying UnknownProvider.
  • Full isolated Core suite: 3781 pass / 39 skip / 0 fail. bun typecheck and formatting pass in packages/core.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
fix(core): classify AISDK network failures as transport errors
bfb3a7a
@rekram1-node
rekram1-node merged commit d2ee536 into v2 Aug 28, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the aisdk-transport branch August 28, 2026 05:21
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
@rekram1-node
fix(core): classify AISDK network failures as transport errors (anoma…
029b018
…lyco#45840)
@neriousy neriousy mentioned this pull request Oct 1, 2026
Sessions fail on transient network errors instead of retrying #30611
Closed
@NerdyShawn NerdyShawn mentioned this pull request Nov 26, 2026
v2.4.1: opencode-go ECONNRESET before first token ends turns with zero retry attempts (provider.transport) #66681
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.