Skip to content

fix(ai): batch Anthropic parallel tool results - #41948

Merged
rekram1-node merged 1 commit into
v2from
anthropic-parallel-tools
Aug 12, 2026
Merged

rekram1-node merged 1 commit into
v2from
anthropic-parallel-tools

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

  • batch consecutive canonical tool-result messages into one Anthropic user message
  • preserve parallel tool-result order and IDs to match Anthropic's official TypeScript SDK continuation shape
  • add regression coverage for two streamed tool calls, persisted assistant content, and the follow-up wire body

Anthropic expects every result for one assistant tool-use response in a single immediately following user message. The native AI route previously emitted one user message per persisted tool-result message, which split parallel results on the wire.

Checks

  • bun typecheck (packages/ai)
  • bun test test/provider/anthropic-messages.test.ts test/tool-stream.test.ts test/tool-runtime.test.ts test/provider/anthropic-messages.recorded.test.ts --timeout 30000 (79 passed, 1 skipped)
  • bun x prettier --check src/protocols/anthropic-messages.ts test/provider/anthropic-messages.test.ts

The full package suite still has 11 unrelated failures on the current v2 base in existing Azure URL, Bedrock fixture, and OpenRouter reasoning tests.

Requested by: @rekram1-node (Aiden Cline via Slack)

@rekram1-node
rekram1-node merged commit 01cbdcb into v2 Aug 12, 2026
8 of 10 checks passed
@rekram1-node
rekram1-node deleted the anthropic-parallel-tools branch August 12, 2026 05:18
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant