Skip to content

fix(core): recognize Claude Bedrock family metadata - #53820

Open
fxckcode wants to merge 2 commits into
anomalyco:v2from
fxckcode:bedrock-arn-family
Open

fxckcode wants to merge 2 commits into
anomalyco:v2from
fxckcode:bedrock-arn-family

Conversation

@fxckcode

@fxckcode fxckcode commented Oct 7, 2026 •

Copy link
Copy Markdown

Issue for this PR

Related issue: #53756 (this PR does not close the issue)

Type of change

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

What does this PR do?

Bedrock application inference-profile ARNs are opaque. This change uses configured family metadata (claude or claude-*) to select Claude request fields instead of Nova's reasoningConfig fallback.

Limitation: family metadata does not identify a model version. For an arbitrary custom model key with an opaque ARN, this PR cannot determine whether Claude requires adaptive or manual thinking. Older model versions may still require explicit variants or using the catalog model ID as the model key, as documented in #53756.

How did you verify your code works?

  • cd packages/core && bun run test test/variant.test.ts — 14 passed, 0 failed, 60 expectations.
  • cd packages/core && bun typecheck — passed.
  • No AWS integration test was run; these tests verify local request-shape generation.

Screenshots / recordings

N/A — no UI change.

Checklist

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

Copilot AI balanced review requested due to automatic review settings October 7, 2026 22:26

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 7, 2026

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

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

@opencode-agent opencode-agent Bot 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.

I checked this by calling Variant.resolve directly in a scratch test. A full CLI run against a capture server failed to start from source on both base and this PR, so this is not verified end to end. On the base, a Bedrock application inference-profile ARN with family: "claude-sonnet" gets the Nova reasoningConfig shape. With this change it gets the Claude shapes for effort, toggle and budget. The catalog id us.anthropic.claude-sonnet-4-5… and a non-Claude ARN produce the same output as before. Variant tests and the core typecheck pass.

Main concerns:

  • An ARN carries no version, so ARN-backed Claude models always get thinking: {type: "adaptive"} on effort variants. Claude 4.5 and older don't use adaptive thinking. The same model by catalog id gets only output_config. The real-profile check in #53756 used a Sonnet 4.5 profile, so this case is likely common (details inline).
  • The two new tests are near-copies and could be one.

const bedrockConverse: Protocol = (model, support) => {
const id = modelID(model)
const claude = id.includes("anthropic")
const claude = id.includes("anthropic") || model.family === "claude" || model.family?.startsWith("claude-")

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.

With an opaque ARN, claudeInfo(model) can't parse a version. So manual is false, and effort variants always add thinking: ADAPTIVE_THINKING (I checked: the ARN + claude-sonnet case gives thinking: adaptive + output_config). The same model by catalog id (us.anthropic.claude-sonnet-4-5…) gets only output_config: {effort}, because 4.5 and older don't use adaptive thinking. The real-profile check in #53756 used a Sonnet 4.5 profile, so this path may still be rejected for many users. It's an improvement over reasoningConfig, but please consider adding a test for the older-model case and noting the limitation. The catalog-id-as-key config from the issue still covers those models.

Comment thread packages/core/test/variant.test.ts Outdated
])
})

test("recognizes the bare Claude family for Bedrock inference profile ARNs", () => {

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.

This test only differs from the one above in the family value. Could you merge them into one test that loops over ["claude-sonnet", "claude"]? It would be shorter with the same coverage. A non-Claude family on an ARN (e.g. nova) that still gets reasoningConfig would be a useful extra check.

This branch has not been deployed

No deployments
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.

2 participants