Skip to content

sync: tolerate Anthropic's thinking block binding on Claude 5.1+ (three upstream ports) - #132

Merged
filipeforattini merged 4 commits into
mainfrom
sync/anthropic-thinking
Sep 5, 2026
Merged

filipeforattini merged 4 commits into
mainfrom
sync/anthropic-thinking

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 5, 2026 •

Copy link
Copy Markdown

First port with the ledger (#131, which this is stacked on). Three upstream commits, each carrying its Upstream: trailer:

  • 3f39a329c feat: tolerate Anthropic thinking block binding
  • 9a71624d2 fix: scope thinking binding to Claude 5.1+
  • 68abdce1a fix: let config opt out of Anthropic thinking blockBinding

What it does

Fable 5.1 binds each thinking signature to the system prompt, tool list and messages above it, and rejects the request when any of that changes; we re-render parts of that prefix between turns (system prompt, tools, compaction). Requests to Claude 5.1+ — @ai-sdk/anthropic, @ai-sdk/google-vertex/anthropic, @ai-sdk/amazon-bedrock — now carry blockBinding: { prefixMismatchBehavior: "drop_block" }, which the patched SDKs turn into the thinking-binding-controls beta; the processor logs the blocks Anthropic reports dropping so churn in the prefix can be tracked down. blockBinding: false in the model's provider options opts out.

Port notes

  • The first commit did not apply as a whole: upstream had bumped @ai-sdk/amazon-bedrock to 4.0.166 in an earlier commit we had not taken, so its package.json hunks and the lockfile were done by hand — versions bumped, lockfile regenerated, not patched.
  • The override to @ai-sdk/anthropic 3.0.111 did not reach the nested copy under google-vertex until a clean install; the vertex wire test is what caught it. CI installs clean, so it sees the same tree.
  • The other two applied clean through bun upstream:port and were committed by it.

Tested

test/provider/transform.test.ts: 542 pass, including upstream's new wire tests for direct Anthropic, Vertex, and Bedrock. Provider + processor suites: 586 pass after a clean bun install --frozen-lockfile. Typecheck clean in redcode and core. bun upstream:status now lists 51.

https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@filipeforattini
filipeforattini changed the base branch from feat/upstream-ledger to main September 5, 2026 15:49
…46653)

Ported from anomalyco/opencode 3f39a32.

Fable 5.1 binds each thinking signature to the system prompt, tool list and messages above
it, and rejects the request when any of that changes; we re-render parts of that prefix
between turns. The request now asks the API to drop the affected blocks instead of failing,
via a patched @ai-sdk/anthropic 3.0.111 and @ai-sdk/amazon-bedrock 4.0.166 that carry the
thinking-binding-controls beta, and the processor logs the blocks Anthropic reports dropping.

Port notes: the two @ai-sdk versions were bumped here (upstream bumped Bedrock in an earlier
commit we had not taken), the lockfile was regenerated rather than patched, and the nested
copy under @ai-sdk/google-vertex needed a relink for the override to reach it — the vertex
wire test is what showed that.

Upstream: 3f39a32
…nomalyco#46820)

Ported from anomalyco/opencode 68abdce.

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>

Upstream: 68abdce
@filipeforattini
filipeforattini enabled auto-merge (rebase) September 5, 2026 15:49
@filipeforattini
filipeforattini merged commit b331e2e into main Sep 5, 2026
13 checks passed
@filipeforattini
filipeforattini deleted the sync/anthropic-thinking branch September 18, 2026 03:50
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.

1 participant