Skip to content

Comments

feat(opencode): support adaptive thinking for claude sonnet 4.6#14283

Merged
rekram1-node merged 5 commits intoanomalyco:devfrom
tctev:feat/sonnet-4-6-adaptive-thinking
Feb 19, 2026
Merged

feat(opencode): support adaptive thinking for claude sonnet 4.6#14283
rekram1-node merged 5 commits intoanomalyco:devfrom
tctev:feat/sonnet-4-6-adaptive-thinking

Conversation

@tctev
Copy link
Contributor

@tctev tctev commented Feb 19, 2026

Issue for this PR

Closes #14284

Type of change

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

What does this PR do?

This updates Sonnet 4.6 to use adaptive thinking, matching the Opus 4.6 behavior that is already in place.

Before this change, Sonnet 4.6 still used thinking.type: "enabled" with budgetTokens.

With this PR:

  • Sonnet 4.6 is included in adaptive model detection
  • adaptive variants (low, medium, high, max) are returned for Anthropic, Gateway, and Bedrock paths
  • existing manual budgetTokens behavior for other Anthropic models stays the same

How did you verify your code works?

I added test coverage in packages/opencode/test/provider/transform.test.ts for:

  • @ai-sdk/gateway
  • @ai-sdk/anthropic
  • @ai-sdk/amazon-bedrock

I also ran:

  • bun test test/provider/transform.test.ts (from packages/opencode)

Screenshots / recordings

N/A (no UI changes)

Checklist

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

@github-actions
Copy link
Contributor

Hey! Your PR title support adaptive thinking for claude sonnet 4.6 doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Feb 19, 2026
@github-actions
Copy link
Contributor

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

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

Related PR:

Why it's related:
This PR adds adaptive thinking support for Claude Opus 4.6, which is closely related to PR #14283's focus on adding adaptive thinking for Claude Sonnet 4.6. Both PRs are addressing similar adaptive thinking feature implementations across different Claude model variants. You may want to check if they're part of the same feature initiative or if there's shared work that could benefit from coordination.

@tctev tctev changed the title support adaptive thinking for claude sonnet 4.6 feat(opencode): support adaptive thinking for claude sonnet 4.6 Feb 19, 2026
@github-actions
Copy link
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 removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Feb 19, 2026
@github-actions
Copy link
Contributor

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

@rekram1-node
Copy link
Collaborator

nice find, will review


case "@ai-sdk/gateway":
if (model.id.includes("anthropic")) {
if (isAnthropicAdaptive) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will not work

Copy link
Collaborator

Choose a reason for hiding this comment

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

U removed the 4.6 cases like

opus-4.6 and sonnet-4.6, so isAnthropicAdaptive will never be true for the vercel ai gateway provider

@rekram1-node
Copy link
Collaborator

/review

@github-actions
Copy link
Contributor

lgtm

@rekram1-node rekram1-node merged commit 193013a into anomalyco:dev Feb 19, 2026
7 checks passed
ariane-emory pushed a commit to ariane-emory/opencode that referenced this pull request Feb 20, 2026
…alyco#14283)

Co-authored-by: tctev <224793535+tctev@users.noreply.github.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
lacymorrow added a commit to lacymorrow/lash that referenced this pull request Feb 22, 2026
* upstream/dev: (476 commits)
  release: v1.2.9
  fix: issue from structuredClone addition by using unwrap (anomalyco#14359)
  tweak(ui): adjust session feed spacing
  tweak(ui): tone down reasoning emphasis
  tweak(ui): refine session feed spacing
  fix(desktop): restore settings header mask
  tweak(ui): nudge edited files chevron
  tweak(ui): stabilize collapsible chevron hover
  fix: add missing id/sessionID/messageID to MCP tool attachments (anomalyco#14345)
  Use structuredClone instead of remeda's clone (anomalyco#14351)
  remove unnecessary deep clones from session loop and LLM stream (anomalyco#14354)
  fix(web): correct config import path in Korean enterprise docs
  docs: update providers layout and Windows sidebar label
  core: remove User-Agent header assertion from LLM test to fix failing test
  release: v1.2.8
  fix(app): black screen on launch with sidecar server
  chore: generate
  feat(opencode): support adaptive thinking for claude sonnet 4.6 (anomalyco#14283)
  feat(tui): add custom tool and mcp call responses visible and collapsable (anomalyco#10649)
  chore: cleanup
  ...

# Conflicts:
#	bun.lock
#	packages/app/package.json
#	packages/console/app/package.json
#	packages/console/core/package.json
#	packages/console/function/package.json
#	packages/console/mail/package.json
#	packages/desktop/package.json
#	packages/enterprise/package.json
#	packages/extensions/zed/extension.toml
#	packages/function/package.json
#	packages/opencode/package.json
#	packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
#	packages/opencode/src/cli/cmd/tui/routes/home.tsx
#	packages/opencode/src/config/config.ts
#	packages/opencode/src/tool/lsp.ts
#	packages/opencode/src/tool/read.ts
#	packages/plugin/package.json
#	packages/sdk/js/package.json
#	packages/slack/package.json
#	packages/ui/package.json
#	packages/util/package.json
#	packages/web/package.json
#	sdks/vscode/package.json
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.

[FEATURE]: support adaptive thinking for claude sonnet 4.6

2 participants