Skip to content

V2: define typed LLM errors for consumer-owned retry policy #34995

Description

@rekram1-node

Context

The LLM package should not decide retry policy, but opencode needs useful typed failures to implement its own policy. AI SDK errors are currently hard to interpret, especially for midstream provider failures.

Scope

  • Review packages/llm/src/schema/errors.ts and executor error mapping.
  • Prioritize context overflow, provider/API errors, transport failures, auth/config failures, and midstream provider failures.
  • Preserve raw provider details where useful without hardcoding brittle provider-specific status semantics.
  • Remove retry-policy language from public errors if it implies package-owned retries.

Acceptance Criteria

  • Consumers can distinguish context overflow from generic provider failure.
  • Midstream provider failure is surfaced ergonomically.
  • Errors include enough status/header/body/provider detail for opencode retry policy.
  • No error API implies automatic retries inside @opencode-ai/llm.

Metadata

Metadata

Assignees

Labels

2.0coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions