Skip to content

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

Open
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/bedrock-deepseek-arn-model-id
Open

fix(provider): prevent Bedrock from prefixing ARN and deepseek.v3.2 model IDs#18948
kevinWangSheng wants to merge 1 commit intoanomalyco:devfrom
kevinWangSheng:fix/bedrock-deepseek-arn-model-id

Conversation

@kevinWangSheng
Copy link
Contributor

Issue for this PR

Closes #18812

Type of change

  • Bug fix

What does this PR do?

Fixes two issues in the Amazon Bedrock model ID transformation logic (provider.ts getModel()):

  1. ARN guard — Foundation-model ARN IDs (arn:aws:bedrock:us-east-1::foundation-model/deepseek.v3.2) were incorrectly prefixed with region codes (e.g. us.arn:aws:bedrock:...), making them invalid. Added a guard to pass ARN-format model IDs through unchanged.

  2. DeepSeek prefix narrowing — The broad "deepseek" match in the US cross-region prefix list incorrectly prefixed deepseek.v3.2 with us., but this model has no cross-region inference profile. Narrowed the match to "deepseek-r1" which does support cross-region inference.

Before this fix:

  • deepseek.v3.2us.deepseek.v3.2ValidationException: The provided model identifier is invalid.
  • arn:aws:bedrock:...us.arn:aws:bedrock:... → same error

After this fix:

  • deepseek.v3.2 → passed through unchanged → works
  • arn:aws:bedrock:... → passed through unchanged → works
  • deepseek-r1-v1:0us.deepseek-r1-v1:0 → still gets cross-region prefix correctly

How did you verify your code works?

  • Typecheck passes (all packages)
  • Existing Bedrock tests in packages/opencode/test/provider/amazon-bedrock.test.ts still pass
  • The reporter verified via AWS CLI that deepseek.v3.2 works without prefix and fails with us. prefix
  • ARN-format model IDs are a standard AWS pattern that should never be modified

Screenshots / recordings

N/A — provider model ID transformation change

Checklist

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

…odel IDs

Two issues in the Bedrock model ID transformation:

1. ARN-format model IDs (arn:aws:bedrock:...) were incorrectly
   prefixed with region codes (e.g. us.arn:aws:bedrock:...), making
   them invalid. Add a guard to pass ARNs through unchanged.

2. The broad "deepseek" match in the US cross-region prefix list
   incorrectly prefixed deepseek.v3.2 with "us.", but this model
   has no cross-region inference profile. Narrow the match to
   "deepseek-r1" which does support cross-region inference.

Fixes anomalyco#18812
Sign up for free to 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.

Amazon Bedrock rewrites deepseek.v3.2 and foundation-model ARNs to invalid us.* model IDs

1 participant