GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — normalizeMessages() removes empty text parts between reasoning blocks, invalidating Anthropic thinking block signatures · Issue #16748 · anomalyco/opencode Closed DescriptionSummary
Root CauseThe filter at const filtered = msg.content.filter((part) => { if (part.type === "text" || part.type === "reasoning") { return part.text !== "" } return true }) This is correct for user and tool messages (Anthropic rejects empty content in those), but incorrect for assistant messages. Assistant messages must be replayed verbatim because thinking block signatures are positionally sensitive — they encode the exact arrangement of content blocks in the message. How the Empty Text Gets There
Real-World EvidenceSession SELECT p.id, json_extract(p.data, '$.type') as type, length(json_extract(p.data, '$.text')) as text_len, json_extract(p.data, '$.metadata.anthropic.signature') IS NOT NULL as has_sig FROM part p WHERE p.message_id = 'msg_ccf03eebf002tXp65stpIG2MnX' ORDER BY p.time_created; The empty text part at row 3 is removed by Reproduction TestA failing test is provided in the companion PR. It constructs: Runs it through Existing PRs That Don't Fix This
Suggested FixSkip empty-text filtering for assistant messages. They must be replayed verbatim since the Anthropic API originally returned them: const filtered = msg.content.filter((part) => { if (msg.role === "assistant") return true // preserve assistant content exactly if (part.type === "text" || part.type === "reasoning") { return part.text !== "" } return true }) Related Issues
Environment
Reacted by Jonjo McKay and Matthew Crenshaw Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |