Repository navigation
Releases
v0.1.1
What this release does
0.1.1 is the first working release — 0.1.0 loaded but silently did nothing. If you installed 0.1.0, upgrade.
The problem this plugin works around
Anthropic re-validates the signature of every thinking block on each request. When a reasoning turn is redacted for safety, it carries a short "lightweight" signature that does not pass re-validation on replay. Because the full message history is resent on every turn, a single such turn permanently breaks the whole session:
400 messages.N.content.M: Invalid `signature` in `thinking` block
What the plugin does
On the experimental.chat.messages.transform hook, before the request reaches Anthropic, it removes reasoning parts from any assistant turn that contains a redacted_thinking block or a signed thinking block whose signature is shorter than shortSignatureThreshold (default 256). Healthy signed reasoning and all text/tool content are left untouched, so the prompt-cache prefix is disturbed as little as possible.
Fixed in 0.1.1
- The hook cloned the messages and reassigned
output.messages. OpenCode keeps using its own array reference after the hook returns, so the reassignment was silently discarded and nothing was ever stripped (andstructuredClonecould throw on non-cloneable parts, swallowed by the fail-open guard). The hook now splicesreasoningparts out of the originalmessage.partsarrays in place, matching the mutation contract every other transform plugin relies on.
Tests
test-hook.ts— regression test for the in-place contract: fails if the hook reassigns the array or replaces message objects instead of mutating in place; asserts poisoned reasoning is removed and healthy reasoning survives.test-fixture.ts— strip-logic unit test over a fixture with redacted + short-signature turns.
Verification
Reproduced end to end on a real failing session: with the plugin disabled the (forked) session still returns Bad Request; with it enabled the poisoned turns are stripped and the request succeeds.
Full Changelog: v0.1.0...v0.1.1
v0.1.0
Initial release.
Strips non-replayable Anthropic reasoning blocks (redacted_thinking and short lightweight signatures) from poisoned assistant turns before OpenCode serializes the request, so replayed sessions stop returning 400 messages.N.content.M: Invalid \signature` in `thinking` block`. Healthy signed reasoning is left untouched.
- Hook:
experimental.chat.messages.transform - Zero-config (default mode:
redacted), fail-open - npm: https://www.npmjs.com/package/opencode-thinking-signature-guard