opencode-fix-thinking-signature
v0.1.1
Published
OpenCode plugin: workaround for Anthropic thinking block signature invalidation bug (anomalyco/opencode trimEnd issue)
Maintainers
Readme
opencode-fix-thinking-signature
Workaround plugin for the Anthropic thinking block signature invalidation bug in anomalyco/opencode.
The Bug
In processor.ts, opencode calls trimEnd() on thinking text after Anthropic has already computed the signature over the original text (including trailing \n). On the next turn, the stored text no longer matches the signed text → Anthropic returns 400: Invalid signature in thinking block.
Upstream fix PRs exist but have been unreviewed for months:
- #12131 — remove
trimEnd()inprocessor.ts - #14393 — fix
differentModelguard strippingproviderMetadataduring compaction
What This Plugin Does
Uses the experimental.chat.messages.transform hook to strip any message part that carries an Anthropic signature before sending to the API. Anthropic only validates signatures you include — omitting old thinking blocks is accepted.
Each new turn still gets fresh thinking. Only cross-turn thinking continuity is lost, which is acceptable for most use cases.
Installation
{
"plugin": [
"[email protected]"
]
}Important: place this last in your
pluginlist so no later hook can reintroduce signed parts.
Removal
Remove this plugin once upstream merges either of the fix PRs above and you update to that version.
