Skip to content

fix(copilot): support max reasoning effort for claude-sonnet-4.6#33606

Open
dzianisv wants to merge 1 commit into
anomalyco:devfrom
dzianisv:copilot-claude-max-effort
Open

fix(copilot): support max reasoning effort for claude-sonnet-4.6#33606
dzianisv wants to merge 1 commit into
anomalyco:devfrom
dzianisv:copilot-claude-max-effort

Conversation

@dzianisv

@dzianisv dzianisv commented Jun 24, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #33607

Type of change

  • Bug fix

What does this PR do?

Bug 1: max reasoning effort not available for claude-sonnet-4.6

The Copilot API returns reasoning_effort: ["low", "medium", "high", "max"] for claude-sonnet-4.6. Two places in transform.ts blocked max from reaching the user:

  1. @ai-sdk/anthropic + github-copilot fallback path filtered it out with efforts.filter(v => v !== "max" && v !== "xhigh"). Comment said "Efforts currently supported: low, medium, high" — outdated.
  2. @ai-sdk/github-copilot claude fallback path used WIDELY_SUPPORTED_EFFORTS (no max).

Fix: remove the max filter (keep xhigh filtered, not in Copilot API); add max to the claude efforts list; extract COPILOT_CLAUDE_EFFORTS constant.

Bug 2: model key mismatch drops catalog metadata on every refresh

Static catalog keys claude-sonnet-4-6 (hyphen). Copilot API returns claude-sonnet-4.6 (dot). remote.get(model.api.id) fails the lookup, so the catalog entry is pruned and replaced with a new entry (no prev) on every refresh, discarding catalog metadata and breaking saved model preferences.

Fix: build a secondary normalized map keying API IDs with dots replaced by hyphens, track matched IDs to avoid duplicates.

How did you verify your code works?

  • Live API calls confirmed output_config.effort=max accepted by /v1/messages, produces more thinking tokens than effort=low
  • Live API call confirmed reasoning_effort=max accepted by /chat/completions for claude models
  • 279 existing tests pass

Screenshots / recordings

N/A

Checklist

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

The Copilot API returns reasoning_effort: [low, medium, high, max] for
claude-sonnet-4.6. Two bugs prevented max from being available:

1. transform.ts filtered out "max" in the @ai-sdk/anthropic+github-copilot
   fallback path with an outdated comment "Efforts currently supported: low,
   medium, high". Confirmed via live API test that output_config.effort=max
   is accepted and controls thinking depth on /v1/messages.

2. transform.ts used WIDELY_SUPPORTED_EFFORTS (no max) for the fallback
   claude path on @ai-sdk/github-copilot. Confirmed reasoning_effort=max
   works on /chat/completions for claude models.

Also fix a model key mismatch: the static catalog keys claude-sonnet-4-6
(hyphen) while the Copilot API returns claude-sonnet-4.6 (dot). This caused
the catalog entry to be deleted on every model refresh and re-added without
the prev metadata, breaking saved model preferences. Added a normalized
lookup index so the catalog key is preserved when model IDs differ only in
version separator.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jun 24, 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:

Based on my search, I found one potentially related PR:

PR #31570: feat: drive reasoning variants from models.dev reasoning_options

This PR may be related because it also deals with reasoning options/variants for models, which overlaps with the reasoning effort support being fixed in PR #33606. However, it appears to be a different feature focused on driving reasoning variants from models.dev, rather than the specific bug fixes for max effort support and catalog key mismatches in the current PR.

All other search results only returned PR #33606 (the current PR itself), indicating no direct duplicates exist.

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

Copy link
Copy Markdown
Contributor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(copilot): claude-sonnet-4.6 max reasoning effort not available; model key mismatch on refresh

1 participant