Problem
aimock currently accepts an Anthropic messages.stream request that continues a tool-use loop with extended thinking enabled but omits the original thinking block (and its signature) as the first content block of the prior assistant turn.
The real Anthropic API rejects this with a 400 error (e.g. "expected thinking as the first block / signature required"), and it additionally requires redacted_thinking blocks to be replayed back in subsequent turns.
Because aimock simply replays the next fixture without validating the request shape, a backend that drops, last-only-keeps, or otherwise omits thinking blocks passes green in replay but 400s against the real Anthropic API.
Impact
This masked real bugs in the CopilotKit showcase claude-sdk-python reasoning agents, including:
- thinking blocks dropped from conversation history on tool-loop continuation
- only the last thinking block retained instead of all of them
redacted_thinking blocks not replayed back
All of these passed under aimock replay while being invalid against the real API.
Ask
When extended thinking is enabled on an Anthropic messages.stream request, aimock should validate the request invariants on the prior assistant turn:
- the
thinking block is present as the first content block
- the thinking block's
signature is present
- any
redacted_thinking blocks are preserved/replayed
When these invariants are violated, aimock should surface a replay error (go red) instead of silently replaying the next fixture — so this class of bug is caught in the harness rather than blowing up against the real provider.
Problem
aimock currently accepts an Anthropic
messages.streamrequest that continues a tool-use loop with extended thinking enabled but omits the originalthinkingblock (and itssignature) as the first content block of the prior assistant turn.The real Anthropic API rejects this with a
400error (e.g. "expectedthinkingas the first block / signature required"), and it additionally requiresredacted_thinkingblocks to be replayed back in subsequent turns.Because aimock simply replays the next fixture without validating the request shape, a backend that drops, last-only-keeps, or otherwise omits thinking blocks passes green in replay but
400s against the real Anthropic API.Impact
This masked real bugs in the CopilotKit showcase
claude-sdk-pythonreasoning agents, including:redacted_thinkingblocks not replayed backAll of these passed under aimock replay while being invalid against the real API.
Ask
When extended thinking is enabled on an Anthropic
messages.streamrequest, aimock should validate the request invariants on the prior assistant turn:thinkingblock is present as the first content blocksignatureis presentredacted_thinkingblocks are preserved/replayedWhen these invariants are violated, aimock should surface a replay error (go red) instead of silently replaying the next fixture — so this class of bug is caught in the harness rather than blowing up against the real provider.