anomalyco / anomalyco/opencode

console: OA-compat stream conversion drops tool_calls when a chunk also has content

Open
#45,240 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 26, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

fromOaCompatibleChunk splits a single SSE chunk that contains both delta.content and delta.tool_calls into two choices entries. toOaCompatibleChunk and toAnthropicChunk only read choices[0], so the tool call is dropped.

Reproduced on current dev with a one-chunk payload:

{"choices":[{"delta":{"content":"fox","tool_calls":[{"index":0,"id":"call_1","type":"function","function":{"name":"get_time","arguments":"{}"}}]}}]}

After fromOaCompatibleChunktoOaCompatibleChunk / toAnthropicChunk, only the text "fox" remains. The get_time tool call is gone.

This is the format converter used when Zen translates OA-compat streams to another provider format (and back). Same-format passthrough is unaffected.

Plugins

None

OpenCode version

dev (c7134cb)

Steps to reproduce
  1. Import fromOaCompatibleChunk and toOaCompatibleChunk from packages/console/app/src/routes/zen/util/provider/openai-compatible.ts.
  2. Feed the chunk above (as data: {...}).
  3. Convert back with toOaCompatibleChunk.
  4. Observe that tool_calls is missing.
Screenshot and/or share link

No response

Operating System

Linux

Terminal

n/a (unit-level)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.