Repository navigation
Drop mismatched Claude thinking blocks for Posit AI Pass provider - #190
Merged
Merged
Conversation
The Posit AI gateway now accepts the thinking-binding-controls-2026-08-01 beta and thinking.block_binding (prism-gateway #354), so Posit AI requests to prefix-checked Claude models carry drop_block like every other Anthropic Messages route. A prefix change now drops replayed thinking instead of returning 400. Posit AI was the only transport in TRANSPORTS_WITHOUT_BLOCK_BINDING, so remove the veto set, the AnthropicTransport type and the transport parameter of anthropicRequestOptions. Verified live against the staging gateway with Opus 5.5: a forced prefix change returned 200 with thinking_dropped entries in input_transformations.
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.
Claude 5.5-generation models (Fable 5.1, Opus/Sonnet/Haiku 5.5) bind each thinking block that PA replays in a later turn to the conversation content in front of it. If that earlier content changes, for example because a user message was edited, Anthropic either rejects the request with 400 "The block is bound to a different conversation" (on accounts where it enforces the binding) or, if the request opts in, drops the mismatched blocks and lists them in the response's
input_transformations. Since #138, PA opts in on every Claude route by sendingthinking.block_binding.prefix_mismatch_behavior: "drop_block"with the beta headerthinking-binding-controls-2026-08-01. Posit AI Pass was the exception: its gateway rejected the beta with 400 "disallowed Anthropic-Beta value", soai-provider-bridgeleft the binding off for that route.The gateway now accepts both the beta and the body field (prism-gateway #354, releases
2026.10.20-1and later) and passes the response through unchanged, soinput_transformationsreaches PA's existing warning. This PR sends the binding over Posit AI Pass too, so edited history is handled the same way as on the other Claude routes. The monorepo companion PR (anthropic-drop-blocks) only moves theai-libpointer to this commit.How the binding is decided
The host decides which models get
drop_block(resolveThinkingBlockBindinginpackages/node). The function that builds the Anthropic request options for every Claude client,anthropicRequestOptionsinai-provider-bridge/src/utils.ts, attached that binding unless the client'stransportwas in an exclusion set whose only member waspositai. Removing Posit AI Pass would leave the set empty, so this PR removes the mechanism: the set, thetransportparameter, and thetransportargument each of the five Claude clients passed. The bridge now attaches the host's binding whenever thinking is adaptive:As before, thinking "Off" and the provider-default effort send no binding.
What to watch for
Mismatched thinking blocks on Posit AI Pass are now dropped instead of kept. The staging gateway's Anthropic account does not enforce the binding, so without
drop_blockAnthropic keeps a mismatched block and reports it asthinking_mismatch_allowed; Posit AI Pass users were not getting the 400 on staging. Dropping matches the other Claude routes and keeps Posit AI Pass working if Anthropic later enforces the binding for the gateway's account. Anthropic notes that a drop can increase output tokens. The prompt cache is already invalid from the changed content onward, so caching is no worse.The production gateway's release is unconfirmed. Only staging was tested, and we don't know which release production runs. If it is older than
2026.10.20-1, it rejects the beta, and every Posit AI Pass request to these models with adaptive thinking fails.Validation
Headless TUI against the Posit AI Pass staging gateway with
positai/claude-opus-5-5and raw HTTP capture:block_binding: drop_blockin the request.input_transformations: [].thinking_droppedfor both replayed blocks (prefix_binding_mismatch), and PA logged itsinput_transformationswarning.PA_THINKING_BLOCK_BINDING=header-only(beta header, no body field): 200, withthinking_mismatch_allowedfor both blocks, which shows the staging account is not enforced.The ai-lib type check, format check, bridge lint and full bridge test suite pass. As before, the binding has no live verification on Bedrock, Vertex or Snowflake.
Alternatives considered
Remove only
positaiand keep the empty exclusion set for future proxies that reject the beta. Not taken: it would leave an unused parameter threaded through five clients. If a transport later rejects the beta, the exclusion can come back in that client or as a parameter again.