ferock (Discord, 10-30): Command Code requests sometimes fail with 400
"messages.3.content.20: Invalid signature in thinking block. The block
is bound to a different conversation ...". The client's history carries
thinking blocks signed for another conversation or account (a switch,
a fork, another provider), and the plugin passes the Messages body
through as written, so this is fixed in magpie, not the plugin.
forward(), which every Anthropic-protocol route goes through (relayed,
translated, plugin fetch, count_tokens), now reads that refusal
(thinking_bound.go). It remembers the block it names and every thinking
block after it, for that provider and account only, then asks again
without them. An assistant message left empty is dropped. The next turn
leaves them out at once. Other 400s, and other providers, keep every
block byte for byte. The drop_block beta isn't sent: Claude Code sends
it only behind a flag, and magpie doesn't mimic Claude Code.
Run (mote, at this head rebased on cae785a37):
- go test -run 'TestBoundRefusalRead|TestBoundThinkingLeftOut|
TestOtherRefusalKeepsThinking|TestWithoutThinkingBlocks|
TestPluginBoundThinkingLeftOut|TestPluginThinkingOff|TokenField|Beta'
./internal/gateway: ok
- go test -count=1 -timeout 45m ./internal/gateway (before the rebase):
every test ok except five Antigravity/Grok tests. They are red the
same way on origin/main e8d42c02d, and #4362 covers them.
- gofmt -l clean; go vet ./internal/gateway for darwin, linux, windows: ok
Broken by hand:
- the retry turned off: TestBoundThinkingLeftOut and
TestPluginBoundThinkingLeftOut go red with ferock's exact 400
- only the named block dropped, not the ones after it: red, because the
fake refuses message 5's block next
Not tried: a real Command Code account (the fake replays ferock's
literal error). The full ./... suite hasn't run yet. Claude
subscription accounts go through the bridge and are not covered here.