Client or integration
Codex App (also reproduced via Pi coding-agent 0.83.0 when routed through OpenCodex proxy)
Area
Provider adapter
Summary
muse-spark-1.2 via opencode-go (adapter: openai-chat, baseUrl: https://opencode.ai/zen/go/v1) fails frequently in streaming tool-call turns with:
upstream stream ended mid tool call without a terminal signal — possible truncation
Source is src/adapters/openai-chat.ts:1718-1726:
const sawFinish = finishReason !== undefined;
if (!sawFinish && pendingToolCalls.length > 0) {
yield { type: "error", message: "upstream stream ended mid tool call without a terminal signal — possible truncation" };
}
The upstream SSE emits response.created / tool deltas but closes without finish_reason, [DONE], or response.completed. The model is reasoning-heavy and the turn is truncated mid-JSON, leaving pending tool calls un-finalized. Same model via Pi direct to opencode-go (no ocx) is fine — this isolates the failure to the ocx streaming proxy layer, matching anomalyco/opencode#40888 matrix (stream:true + tools fails, stream:false + tools works).
Expected: streaming tool request should produce a complete terminal sequence or a structured retryable error, or automatically fallback to buffered mode like the opencode#40888 workaround (stream:false + reframe as SSE).
Reproduction
ocx start --port 10100 (default, opencodex 2.26.0)
- Pi/Codex config:
{
"defaultProvider": "opencode-go",
"defaultModel": "muse-spark-1.2-contributor",
"defaultThinkingLevel": "xhigh"
}
- Run a session that triggers a tool-heavy turn (e.g.,
read/write/edit batch, ~14k thinking tokens). No manual abort.
- Observe request log: turn emits thinking then 1-3 tool calls, last tool args truncated mid-token (
cd ~/code/zosmaai/z-like), then proxy yields:
[openai-chat] stream-truncated { finishReason: null, hadUsage: false, pendingToolCalls: 2 }
error: upstream stream ended mid tool call without a terminal signal — possible truncation
- Reproduction matrix (same as
anomalyco/opencode#40888 for gpt-5.6-luna through same opencode Go endpoint):
stream:true + tools → fails with upstream stream ended mid tool call...
stream:false + tools → works (buffered, reframed as SSE)
stream:true + no tools → works
- Frequency via Codex App →
ocx → opencode-go/muse-spark-1.2: ~30-50% of tool turns with xhigh. Pi direct (no ocx) not observed. Other models via same proxy (opencode-go/kimi-k2.7-code, qwen3.8-max) rarely hit it.
Why this model hits it a lot:
- Reasoning budget vs output cap:
muse-spark-1.2 defaults to extended thinking (budgetTokens: min(16000, limit.output/2)). opencode Go caps OUTPUT_TOKEN_MAX=32000 (see opencode#18108). Turns that spend 13-16k thinking + a 30-40KB write JSON hit finishReason: length mid-tool-call. See opencode#18108 repros: reasoning ~130k, output 32000, finish: "length", text_len=0.
- Known bridge shape:
zosmaai/zosma-cowork#329 (mimo-v2.5 via opencode-go → 3 bash pending running) and opencode#26170 (finishReason: "other" with 0 output) show same orphaned-running-tool pattern behind opencode-go.
Version
2.26.0
Operating system
macOS 15.7.9 (Build 24G830), Darwin 24.6.0 arm64
Provider and model
opencode-go / muse-spark-1.2 (Pi alias muse-spark-1.2-contributor, PI_REASONING_LEVEL=xhigh, adapter openai-chat, baseUrl: https://opencode.ai/zen/go/v1, authMode: key)
Logs or error output
[openai-chat] stream-truncated { finishReason: null, hadUsage: false, pendingToolCalls: 2 }
error: upstream stream ended mid tool call without a terminal signal — possible truncation
No finish_reason, no [DONE], 2 pending tool calls (last JSON truncated mid-key). Same as opencode#40888 observed response.created then HTTP 502 / stream termination during tool call.
Screenshots and supporting files
No screenshots — error is in proxy log / SSE stream. Can provide curl SSE capture or ocx --debug trace on request.
Redacted configuration
{
"port": 10100,
"providers": {
"opencode-go": {
"adapter": "openai-chat",
"baseUrl": "https://opencode.ai/zen/go/v1",
"authMode": "key"
}
}
}
Catalog entry (~/.opencodex/catalog-backup.json):
{ "slug": "muse-spark-1.2", "provider": "opencode-go" }
Related upstream reports (same error family):
anomalyco/opencode#40888 — exact same string, stream:false workaround works
anomalyco/opencode#18108 — finishReason: length doom loop, OUTPUT_TOKEN_MAX=32000
anomalyco/opencode#26170 / #26177 / #13102 — truncated tool variants
zosmaai/zosma-cowork#329 — mimo-v2.5 via opencode-go orphaned running
can1357/oh-my-pi#5600 / earendil-works/pi#4433 / pi#6019 / pi#6133
Checks
Client or integration
Codex App (also reproduced via Pi coding-agent
0.83.0when routed through OpenCodex proxy)Area
Provider adapter
Summary
muse-spark-1.2viaopencode-go(adapter: openai-chat,baseUrl: https://opencode.ai/zen/go/v1) fails frequently in streaming tool-call turns with:Source is
src/adapters/openai-chat.ts:1718-1726:The upstream SSE emits
response.created/ tool deltas but closes withoutfinish_reason,[DONE], orresponse.completed. The model is reasoning-heavy and the turn is truncated mid-JSON, leaving pending tool calls un-finalized. Same model via Pi direct toopencode-go(noocx) is fine — this isolates the failure to theocxstreaming proxy layer, matchinganomalyco/opencode#40888matrix (stream:true + toolsfails,stream:false + toolsworks).Expected: streaming tool request should produce a complete terminal sequence or a structured retryable error, or automatically fallback to buffered mode like the
opencode#40888workaround (stream:false+ reframe as SSE).Reproduction
ocx start --port 10100(default, opencodex 2.26.0){ "defaultProvider": "opencode-go", "defaultModel": "muse-spark-1.2-contributor", "defaultThinkingLevel": "xhigh" }read/write/editbatch, ~14k thinking tokens). No manual abort.cd ~/code/zosmaai/z-like), then proxy yields:anomalyco/opencode#40888forgpt-5.6-lunathrough sameopencode Goendpoint):stream:true + tools→ fails withupstream stream ended mid tool call...stream:false + tools→ works (buffered, reframed as SSE)stream:true + no tools→ worksocx→opencode-go/muse-spark-1.2: ~30-50% of tool turns withxhigh. Pi direct (noocx) not observed. Other models via same proxy (opencode-go/kimi-k2.7-code,qwen3.8-max) rarely hit it.Why this model hits it a lot:
muse-spark-1.2defaults to extended thinking (budgetTokens: min(16000, limit.output/2)).opencode GocapsOUTPUT_TOKEN_MAX=32000(seeopencode#18108). Turns that spend 13-16k thinking + a 30-40KBwriteJSON hitfinishReason: lengthmid-tool-call. Seeopencode#18108repros:reasoning ~130k, output 32000, finish: "length", text_len=0.zosmaai/zosma-cowork#329(mimo-v2.5 via opencode-go→ 3bashpendingrunning) andopencode#26170(finishReason: "other" with 0 output) show same orphaned-running-tool pattern behindopencode-go.Version
2.26.0
Operating system
macOS 15.7.9 (Build 24G830), Darwin 24.6.0 arm64
Provider and model
opencode-go / muse-spark-1.2 (Pi alias
muse-spark-1.2-contributor,PI_REASONING_LEVEL=xhigh, adapteropenai-chat,baseUrl: https://opencode.ai/zen/go/v1,authMode: key)Logs or error output
[openai-chat] stream-truncated { finishReason: null, hadUsage: false, pendingToolCalls: 2 } error: upstream stream ended mid tool call without a terminal signal — possible truncationNo
finish_reason, no[DONE], 2 pending tool calls (last JSON truncated mid-key). Same asopencode#40888observedresponse.createdthen HTTP 502 / stream termination during tool call.Screenshots and supporting files
No screenshots — error is in proxy log / SSE stream. Can provide
curlSSE capture orocx --debugtrace on request.Redacted configuration
{ "port": 10100, "providers": { "opencode-go": { "adapter": "openai-chat", "baseUrl": "https://opencode.ai/zen/go/v1", "authMode": "key" } } }Catalog entry (
~/.opencodex/catalog-backup.json):{ "slug": "muse-spark-1.2", "provider": "opencode-go" }Related upstream reports (same error family):
anomalyco/opencode#40888— exact same string,stream:falseworkaround worksanomalyco/opencode#18108—finishReason: lengthdoom loop,OUTPUT_TOKEN_MAX=32000anomalyco/opencode#26170/#26177/#13102— truncated tool variantszosmaai/zosma-cowork#329—mimo-v2.5 via opencode-goorphanedrunningcan1357/oh-my-pi#5600/earendil-works/pi#4433/pi#6019/pi#6133Checks