anomalyco / anomalyco/opencode
console: OA-compat stream conversion drops tool_calls when a chunk also has content
@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 fromOaCompatibleChunk → toOaCompatibleChunk / 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
- Import
fromOaCompatibleChunkandtoOaCompatibleChunkfrompackages/console/app/src/routes/zen/util/provider/openai-compatible.ts. - Feed the chunk above (as
data: {...}). - Convert back with
toOaCompatibleChunk. - Observe that
tool_callsis missing.
Screenshot and/or share link
No response
Operating System
Linux
Terminal
n/a (unit-level)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.