Skip to content

fix(opencode): preserve signed thinking during anthropic reorder#30182

Open
rekram1-node wants to merge 6 commits into
devfrom
fix/anthropic-signed-thinking-order
Open

fix(opencode): preserve signed thinking during anthropic reorder#30182
rekram1-node wants to merge 6 commits into
devfrom
fix/anthropic-signed-thinking-order

Conversation

@rekram1-node
Copy link
Copy Markdown
Collaborator

@rekram1-node rekram1-node commented Jun 1, 2026

Summary

  • keep the existing Anthropic reorder for trailing ordinary text
  • skip that reorder when it would move signed or redacted Anthropic reasoning after a tool call
  • add focused coverage for signed-thinking preservation without changing existing regression expectations

Context

The existing workaround correctly handles tool_use -> text histories by putting ordinary text before tool calls. It is unsafe for tool_use -> thinking, because Anthropic thinking blocks are signed and cannot be relocated during replay.

This change narrows the workaround rather than restructuring model messages at a higher level.

Tests

  • bun test test/provider/transform.test.ts
  • bun test test/session/message-v2.test.ts
  • bun test test/session/llm.test.ts

@rekram1-node rekram1-node changed the title fix(opencode): preserve anthropic signed thinking order fix(opencode): restore anthropic replay step boundaries Jun 1, 2026
@rekram1-node rekram1-node changed the title fix(opencode): restore anthropic replay step boundaries fix(opencode): preserve signed thinking during anthropic reorder Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant