Skip to content

fix(core): migrate the v1 thinking block-binding opt-out - #52327

Merged
rekram1-node merged 4 commits into
anomalyco:v2from
dmitrii-galantsev:migrate-block-binding
Oct 6, 2026
Merged

rekram1-node merged 4 commits into
anomalyco:v2from
dmitrii-galantsev:migrate-block-binding

Conversation

@dmitrii-galantsev

@dmitrii-galantsev dmitrii-galantsev commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #52325

Type of change

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

What does this PR do?

V1 users opt out of thinking block binding with blockBinding: false in the model's thinking (or Bedrock reasoningConfig) options. The V2 migration forwarded that into model settings, which nothing reads, so the opt-out stopped working after upgrading.

migrateModel now turns it into compatibility.supportsThinkingBlockBinding: false and drops the key from settings. The Anthropic protocol already honors that override. Configs without the opt-out migrate exactly as before.

It also declares supportsThinkingBlockBinding on Model.Compatibility (plus the regenerated client type), because config decoding otherwise strips it. #51864 and #52172 add the same field, so that line goes away when either lands. Draft until then.

Per-variant opt-outs aren't migrated, since compatibility is per model.

How did you verify your code works?

  • New normalization test: fails without the migrate.ts change, passes with it.
  • bun test test/config/ test/models.test.ts test/model-resolver.test.ts in packages/core: 270 pass. Pre-push lint and typecheck pass.
  • End to end with a legacy config against an Anthropic-compatible endpoint that rejects block_binding (Claude Opus 5.5):
    • with the opt-out: works (it failed on v2 before this change)
    • without the opt-out: still fails with Extra inputs are not permitted, so the default is unchanged

Screenshots / recordings

N/A, not a UI change.

Checklist

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

Assisted-by: opus 5.5

V1 opts a model out of Anthropic thinking block binding with
`blockBinding: false` in its `thinking` (or Bedrock `reasoningConfig`)
options. The V2 migration copied that into model settings, which nothing
reads, so the opt-out stopped working after upgrading.

Move it to `compatibility.supportsThinkingBlockBinding`, which the
Anthropic protocol already honors, and declare that field on
`Model.Compatibility` so config decoding keeps it.

Assisted-by: LLM
@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:

@dmitrii-galantsev
dmitrii-galantsev marked this pull request as ready for review September 30, 2026 16:22
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:22

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 review overview

🟡 Changes recommended

When both legacy option objects opt out, migration still leaves one blockBinding flag in settings.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

This PR restores the V1 thinking block-binding opt-out when legacy model configs are migrated to V2.

Changes:

  • Moves blockBinding: false into model compatibility and removes the migrated setting.
  • Exposes the compatibility flag in the schema and generated client type, with a normalization test.
File Description
packages/​schema/​src/​model.ts Declares the compatibility flag.
packages/​core/​test/​config/​normalization.test.ts Tests migration of each legacy option location.
packages/​core/​src/​v1/​config/​migrate.ts Migrates the opt-out into compatibility.
packages/​client/​src/​promise/​generated/​types.ts Exposes the flag to client types.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/core/src/v1/config/migrate.ts Outdated
A model can set `blockBinding: false` under both `thinking` and
`reasoningConfig`. Remove it from each instead of only the first match.

Assisted-by: LLM

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 review overview

🟢 Approval recommended

The migration, schema exposure, generated type, and regression coverage consistently address the reported failure.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@ssc-esiemiat

Copy link
Copy Markdown

Can confirm this fixes the issue for me. Using Sonnet 5.5 / Opus 5.5 via a Bedrock-backed Anthropic-compatible gateway work again with my v1 config (blockBinding: false). This is the main thing blocking me on v2, so I'd love to see it merged. Anything I can do to help?

@dmitrii-galantsev

Copy link
Copy Markdown
Contributor Author

@rekram1-node @fwang
excuse the ping, but we really need some help with moving this along.
Without this patch i cant use opencode at my work at all 🙃

@dmitrii-galantsev

Copy link
Copy Markdown
Contributor Author

@adamdotdevin bump

@rekram1-node

Copy link
Copy Markdown
Collaborator

yes will merge a fix need to think if i still like the name

@rekram1-node
rekram1-node merged commit cabb5d0 into anomalyco:v2 Oct 6, 2026
9 checks passed
@dmitrii-galantsev

Copy link
Copy Markdown
Contributor Author

cheers!

@dmitrii-galantsev
dmitrii-galantsev deleted the migrate-block-binding branch October 6, 2026 20:09
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.

4 participants