Skip to content

🤖 fix: send drop_block on the Coder AI Gateway route to anthropic-typed instances - #6765

Merged
ThomasK33 merged 3 commits into
mainfrom
tk/f25-restart-signature-400
Oct 15, 2026
Merged

ThomasK33 merged 3 commits into
mainfrom
tk/f25-restart-signature-400

Conversation

@ThomasK33

Copy link
Copy Markdown
Member

Summary

On the Coder AI Gateway route, Xum now sends Anthropic's drop_block thinking-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-envelope rows in durable-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.

Cause Workspaces Status
Hot and pinned memory sections rebuilt from changed files 52 Fixed by #6519
Notion MCP server changed its tool schemas while the app was down 18 External
AGENTS.md or other context files edited 15 Real content change
mcp_prompt_get missing or added on the first turn 10 Open (#6406)
Plugin skills and an MCP server hidden until the #6587 review 5 One-time upgrade effect
An MCP server failed or was missing about 10 Open

This PR does not stop these prefix changes. It removes the rejected request and the retry that each of them cost.

Implementation

  • anthropicBlockBindingRouteAvailable keeps the direct-route check unchanged. On the coder route it allows drop_block when the model reaches an instance whose type is exactly anthropic, and the request-level beta opt-out still turns it off. Bedrock-typed and other instances stay excluded.
  • The instance-type check moved into anthropicTypedCoderRoute, which between_tools eligibility already used, so both decisions share it.
  • The AI SDK sends the thinking-binding-controls-2026-08-01 beta header together with thinking.blockBinding.

Validation

  • providerOptions.test.ts: coder:anthropic/… ids and anthropic: ids routed onto Coder through canonicalRoutes get drop_block. Bedrock-typed instances and the beta opt-out do not. The test fails with the source change reverted.
  • Live probe through dogfood 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:
    • A changed system prompt or tool list without drop_block returns the same 400 as in the app log.
    • The same request with drop_block and the beta header returns 200 and reports input_transformations: [{type: thinking_dropped, reason: prefix_binding_mismatch}].
    • An unchanged history with drop_block returns 200 and drops nothing.
    • Adding block_binding to 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 coder route to an anthropic-typed instance.

  • Without the beta header, Anthropic rejects block_binding with "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.
  • A dropped block still costs the cache miss of the changed prefix. Only the 400 and the retry go away.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $437.19

…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 -->
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T12:14:30.719202Z 3b015ae New commits
🔒 Security Review ✅ Completed 2026-10-15T12:16:24.405830Z 3b015ae New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/common/utils/ai/providerOptions.ts
…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 -->
@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit a675e9f Oct 15, 2026
33 checks passed
@ThomasK33
ThomasK33 deleted the tk/f25-restart-signature-400 branch October 15, 2026 12:34
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