Skip to content

fix(provider): duplicated Bedrock/SSE fixes in provider.ts's legacy custom loader missed by earlier ports #242

Closed

Description

@alltomatos

Description

This fork has some provider logic duplicated in two places: a canonical copy in a packages/core plugin/helper, and a legacy copy inside packages/opencode/src/provider/provider.ts's "custom" loader / its own wrapSSE(). Two upstream (anomalyco/opencode) bug fixes were ported to the canonical copy but missed the duplicate:

  1. Bedrock model-id resolution (amazon-bedrock custom loader's getModel()): double-prefixes full Bedrock ARNs (arn:..., which Bedrock rejects) and over-matches "deepseek" (prefixing non-R1 DeepSeek models that don't need/support cross-region inference). Already fixed in packages/core/src/plugin/provider/amazon-bedrock.ts (commit d66cefea74, upstream ac1758c0e6), not in provider/provider.ts's own copy.
  2. wrapSSE() reader-cancel rejection: the timeout path calls void reader.cancel(err), leaving an unhandled promise rejection when the stream already errored. Already fixed in packages/core/src/aisdk.ts (commit ac3b15ba8d, upstream 69c172e8a7), not in provider/provider.ts's own wrapSSE().

How to verify

  • tsgo --noEmit on packages/core and packages/opencode.
  • oxlint on the changed file.
  • Re-read the fix against the sibling file it duplicates to confirm it's the same change.

Activity

  1. alltomatos commented on Sep 15, 2026

    @alltomatos
    OwnerAuthor

    Fixed in commit 3e9c5f9 by adding �rn: early return and deepseek.r1 scope in provider.ts's Bedrock getModel, and catch() handler to
    eader.cancel() in wrapSSE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions