Skip to content

fix: preserve Bedrock DeepSeek model ids - #34441

Closed
YeEmrick wants to merge 5 commits into
anomalyco:devfrom
YeEmrick:bedrock-deepseek-id
Closed

fix: preserve Bedrock DeepSeek model ids#34441
YeEmrick wants to merge 5 commits into
anomalyco:devfrom
YeEmrick:bedrock-deepseek-id

Conversation

@YeEmrick

@YeEmrickYeEmrick commented Jun 29, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#34412
Related #18812

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Bedrock DeepSeek model IDs were being treated like generic cross-region model IDs. That changed deepseek.v3.2 into us.deepseek.v3.2, which Bedrock rejects for the on-demand model.

This PR keeps explicit Bedrock model identifiers intact:

  • deepseek.v3.2 stays deepseek.v3.2
  • arn:aws:bedrock:...:foundation-model/... stays unchanged
  • already-prefixed profile IDs like us.deepseek.r1-v1:0 still pass through unchanged

How did you verify your code works?

Tested:

  • cd packages/opencode && bun test test/provider/amazon-bedrock.test.ts
  • cd packages/core && bun typecheck
  • git diff --check

Reviewer can confirm by configuring amazon-bedrock/deepseek.v3.2 and checking that the provider receives deepseek.v3.2, not us.deepseek.v3.2.

Local note: cd packages/core && bun test test/plugin/provider-amazon-bedrock.test.ts currently fails before this PR assertions with Cannot access 'AmazonBedrockPlugin' before initialization.

Screenshots / recordings

N/A, provider behavior only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actionsgithub-actionsBot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #18948: fix(provider): prevent Bedrock from prefixing ARN and deepseek.v3.2 model IDs
#18948

This appears to be directly related to the current PR #34441. Both PRs address the same issue of preserving Bedrock DeepSeek model IDs (preventing prefixing/normalization that shouldn't happen).

You should check if PR #18948 was previously closed or if this is addressing a regression or incomplete fix.

@github-actionsgithub-actionsBot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@YeEmrick

Copy link
Copy Markdown
Author

Updated after rechecking the Bedrock DeepSeek R1 profile behavior.

This PR now preserves the intended split:

  • deepseek.v3.2 passes through unchanged.
  • Bedrock foundation-model ARNs pass through unchanged.
  • Already-prefixed profiles like us.deepseek.r1-v1:0 pass through unchanged.
  • Unprefixed deepseek.r1-v1:0 in us-* regions still resolves to us.deepseek.r1-v1:0.

This is related to #18948, but this PR also covers the current packages/core/src/plugin/provider/amazon-bedrock.ts plugin path in addition to the legacy packages/opencode/src/provider/provider.ts path.

Verified locally:

  • cd packages/opencode && bun test test/provider/amazon-bedrock.test.ts
  • cd packages/core && bun typecheck
  • git diff --check

Known unrelated local blockers while testing broader gates:

  • cd packages/core && bun test test/plugin/provider-amazon-bedrock.test.ts still fails before assertions with Cannot access 'AmazonBedrockPlugin' before initialization.
  • cd packages/opencode && bun typecheck fails in unchanged src/bus/global.ts EventEmitter typing.

@Robin1987ChinaRobin1987China left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The narrowing from "deepseek" to "deepseek.r1" correctly distinguishes cross-region inference profiles (R1) from on-demand models (V3.2). The arn: guard is a solid defensive addition — foundation-model ARNs should never be region-prefixed.

One non-blocking note: if Bedrock adds DeepSeek R2 models that also require cross-region profiles, the requiresPrefix list will need updating. The narrow match is the safer choice for now.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@marc-jan

Copy link
Copy Markdown

Can this be re-opened and merged? It was already reviewed, but now closed. It is still a problem if you are stuck with AWS and need to use bedrock.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bedrock DeepSeek V3.2 uses incorrect model ID (us.deepseek.v3.2) instead of deepseek.v3.2 in v1.17.11

3 participants

@YeEmrick@marc-jan@Robin1987China