fix(claude): gate block binding beta on final body - #5411
fix(claude): gate block binding beta on final body#5411papajade55-debug wants to merge 1 commit into
Conversation
|
This pull request targeted The base branch has been automatically changed to |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da1b2efabc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if beta = strings.ToLower(strings.TrimSpace(beta)); beta != "" { | ||
| requested[beta] = true |
There was a problem hiding this comment.
Canonicalize advisor beta casing before inserting it
When a caller-owned first-party request supplies only a casing variant such as ADVISOR-TOOL-2026-03-01, lowercasing it here makes advisorNeeded true, but the subsequent withClaudeAdvisorToolBeta comparison remains case-sensitive. It therefore preserves the unrecognized uppercase token and inserts a second canonical token, leaving Anthropic an invalid extra beta that can cause the request to be rejected. Canonicalize and deduplicate the advisor beta case-insensitively, as is now done for fast mode and block binding.
Useful? React with 👍 / 👎.
Summary
thinking-binding-controls-2026-08-01only for first-party Anthropic requests whose final serialized body contains an object-valuedthinking.block_bindingthinking.typeisdisabled, and do not enable it from caller headers orbody.betasaloneAnthropic-Betahandling in both Claude client detection and request forwardingcount_tokens, forced tool choice, custom gateways, and duplicate/header edge casesWhy
Anthropic rejects
thinking.block_bindingunless the matching beta is present. The request pipeline can add or remove thinking fields before serialization, so the header must be derived from the exact final body sent upstream rather than from the original caller request.The shared header parser also prevents client detection and forwarding from observing different beta lists when a hand-built
http.Headercontains multiple case spellings.Validation
go test ./... -count=1go test -raceon the changed executor and helper pathsgo vet ./internal/runtime/executor/...go build ./cmd/servergofmtandgit diff --checkAll checks pass locally with Go 1.26.5.