Repository navigation
🤖 fix: send drop_block on the Coder AI Gateway route to anthropic-typed instances - #6765
Merged
Merged
Conversation
…ed instances Opus/Sonnet/Haiku 5.5 and Fable 5.1 bind replayed thinking to the system prompt and tool list. On the Coder gateway route Xum did not send `thinking.block_binding.prefix_mismatch_behavior: "drop_block"`, so every prefix change (an app restart that changes the MCP tool list, a plugin consent upgrade, an MCP schema change) cost each conversation one 400 and a full strip-and-retry request. The block-binding check now also accepts the `coder` route when the model reaches an instance whose type is exactly "anthropic" (the same instance check between_tools uses, moved into `anthropicTypedCoderRoute`). The request beta opt-out still turns it off. Bedrock-typed and other instances stay excluded. Live probe through dogfood `claude-aws-us-east-2` (2026-10-15): all four models return the 400 without drop_block and 200 with it plus the beta header (`input_transformations: thinking_dropped`). Adding block_binding to an unchanged conversation keeps the whole prompt cache. --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
--- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79fe5e408f
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…outes The Coder route's block-binding check read only the request-level `disableBetaFeatures`. When `providers.anthropic.disableBetaFeatures` is true but persisted request options carry `false`, the factory keeps the `false` (`?? true`), so Xum sent block_binding and its beta header despite the backend-authoritative ZDR opt-out. The check now consults both sources, as the direct route does. The coder provider has no opt-out of its own (providerService surfaces disableBetaFeatures for anthropic only). --- _Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking: `high`_ <!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the Coder AI Gateway route, Xum now sends Anthropic's
drop_blockthinking-binding control to anthropic-typed instances. Anthropic then drops a replayed thinking block whose prefix changed and answers 200, instead of rejecting the whole request with a signature 400 that Xum must repair and retry. Before this PR, only the direct Anthropic route sent it.Background
Opus, Sonnet and Haiku 5.5 and Fable 5.1 bind replayed thinking to the system prompt and tool list before it. When either changes, a replayed block fails its signature check. On one host the 400s ran at about 0.128 per Anthropic turn, and they clustered in the 20 minutes after each app start (31, 20, 28, 17 and 14 per start on Oct 14).
Comparison of each workspace's last request before an app start with its first request after it (8 starts, 281 workspaces, from
turn-enveloperows indurable-events.jsonl): the system prompt or tool list changed in 95 of 281 (34%), against 195 of 2,590 (7.5%) between two turns in one process.mcp_prompt_getmissing or added on the first turnThis PR does not stop these prefix changes. It removes the rejected request and the retry that each of them cost.
Implementation
anthropicBlockBindingRouteAvailablekeeps the direct-route check unchanged. On thecoderroute it allowsdrop_blockwhen the model reaches an instance whose type is exactlyanthropic, and the request-level beta opt-out still turns it off. Bedrock-typed and other instances stay excluded.anthropicTypedCoderRoute, whichbetween_toolseligibility already used, so both decisions share it.thinking-binding-controls-2026-08-01beta header together withthinking.blockBinding.Validation
providerOptions.test.ts:coder:anthropic/…ids andanthropic:ids routed onto Coder throughcanonicalRoutesgetdrop_block. Bedrock-typed instances and the beta opt-out do not. The test fails with the source change reverted.claude-aws-us-east-2(raw Messages API, about $0.10), for Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1:drop_blockreturns the same 400 as in the app log.drop_blockand the beta header returns 200 and reportsinput_transformations: [{type: thinking_dropped, reason: prefix_binding_mismatch}].drop_blockreturns 200 and drops nothing.block_bindingto an unchanged conversation read the whole cache (Haiku: 21,710 of 21,710 tokens), so turning it on costs no cache miss.Risks
Low to medium. The change affects every Claude 5.5 and Fable 5.1 request with thinking on the
coderroute to an anthropic-typed instance.block_bindingwith "Extra inputs are not permitted". The gateway passes the header through for Anthropic upstreams, and its Bedrock path converts or strips the header and the field together (fix: retry Anthropic thinking binding errors with drop_block coder#29792). Bedrock-typed instances are excluded anyway. An older gateway was not tested live.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high• Cost:$437.19