refactor(llm): remove the provider-error stream event#36692
Open
rekram1-node wants to merge 4 commits into
Open
refactor(llm): remove the provider-error stream event#36692rekram1-node wants to merge 4 commits into
rekram1-node wants to merge 4 commits into
Conversation
This was referenced Jul 13, 2026
Replace the LLMError { module, method, reason } wrapper with a flat
tagged union (LLM.BadRequest, LLM.Authentication, LLM.PermissionDenied,
LLM.NotFound, LLM.RateLimit, LLM.QuotaExceeded, LLM.ContentPolicy,
LLM.ContextOverflow, LLM.ServerError, LLM.APIError, LLM.ConnectionError,
LLM.TimeoutError, LLM.MalformedResponse, LLM.NoRoute) plus an isLLMError
guard. Add one shared classifyApiFailure classifier used by the HTTP
executor and the AI SDK adapter so both surfaces classify identically,
preserving status, headers, body, and retry-after.
Core policy moves onto tags: retry RateLimit | ServerError |
ConnectionError | TimeoutError; toSessionError adds
provider.context-overflow, provider.timeout, and provider.not-found.
The provider-error stream event and the runner's held-back overflow
handling are unchanged here; isContextOverflowFailure now bridges old
events and new tags until the event is removed.
Delete the provider-error LLMEvent so streams carry output only and every provider-reported failure exits through the typed error channel. Anthropic SSE error events, OpenAI Responses response.failed/error events, and Bedrock exception frames now fail the stream with an LLMError from the shared classifier (carrying the provider code, e.g. rate_limit_exceeded -> LLM.RateLimit). Core follows: the publisher drops its provider-error case, the runner drops held-back overflow events (overflow recovery keys off a thrown LLM.ContextOverflow), compaction and title stop scanning events for failures, and isContextOverflowFailure is deleted with its last consumer. V1 packages/opencode gets minimal compile fixes only (dead switch case, one test stream).
rekram1-node
force-pushed
the
llm-remove-provider-error
branch
from
July 13, 2026 17:25
3cf531b to
5d87c7a
Compare
rekram1-node
force-pushed
the
llm-error-types
branch
from
July 13, 2026 17:25
cd02b48 to
fce506b
Compare
rekram1-node
force-pushed
the
llm-error-types
branch
2 times, most recently
from
July 18, 2026 17:05
f8b254a to
0eacf8d
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.
Stacked 2/3 on #36691. Merge that first (or merge this into it).
Summary
provider-errorLLMEvent: streams carry output only, and every provider-reported failure exits through the typedLLMErrorchannel.errorevents, OpenAI Responsesresponse.failed/error, and Bedrock exception frames now fail the stream via the sharedclassifyApiFailure, carrying the provider code (OpenAI's real in-stream codesrate_limit_exceeded→LLM.RateLimit,internal_error→LLM.ServerError; Bedrock exception frame names as codes).hasProviderErrornow means content-filter only); the runner drops held-back overflow events — overflow recovery keys off a thrownLLM.ContextOverflow; compaction and title stop scanning events for failures.isContextOverflowFailureandProviderFailureClassificationare deleted with their last consumers.packages/opencode(V1) gets minimal compile fixes only: deadprovider-errorswitch case removed, one test stream converted toStream.fail. The experimental V1 native path now sees typed failures instead of a thrownError(message).Behavior notes
provider.unknown(wasprovider.error) since the failure arrives as a typed error rather than an event.Testing
packages/llm: typecheck clean, 309 pass / 0 failpackages/core: typecheck clean, 1270 pass / 0 failpackages/opencode: typecheck clean