anomalyco / anomalyco/opencode
Responses API: Zen Go gateway returns invalid "truncation": "" (empty string), breaking strict clients like Grok Build web_search
@MrMushrooooom is already working on this.
Since Aug 20, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Summary
--
When calling the OpenCode Zen Go gateway (https://opencode.ai/zen/go/v1/responses) with model grok-4.5 and a web_search tool, the response object contains "truncation": "" (empty string). The OpenAI Responses API spec defines truncation as an enum of "auto" \| "disabled". Strict clients that deserialize this field as an enum fail on the very first SSE event of every response.
In Grok Build, the web_search tool fails with:
Failed to parse response: unknown variant ``, expected `auto` or `disabled` at line 1 column 315
As a result, web_search is completely unusable when pointed at this endpoint, even though the request itself succeeds server-side (the model does execute the search and generate an answer).
Environment
- Endpoint:
https://opencode.ai/zen/go(Responses API) - Model:
grok-4.5 - Client: Grok Build TUI, model configured with
api_backend = "responses"and an OpenAI-compatiblebase_urlpointing at the Zen Go endpoint - Date: 2026-08-21
Steps to reproduce
Direct call to the gateway (no proxy involved):
curl -s -N -H "Authorization: Bearer <OPENCODE_GO_API_KEY>" -H "Content-Type: application/json" \
-d '{"model":"grok-4.5","input":"test web search","tools":[{"type":"web_search"}],"stream":true}' \
https://opencode.ai/zen/go/v1/responses
First SSE event returned:
event: response.created
data: {"type":"response.created","sequence_number":0,"response":{"id":"resp_...","object":"response","created_at":...,"completed_at":null,"status":"in_progress","parallel_tool_calls":true,"temperature":1,"top_p":1,"max_output_tokens":null,"previous_response_id":null,"background":false,"truncation":"","top_logprobs":0,"max_tool_calls":null,"model":"grok-4.5","error":null,"incomplete_details":null,"output":[],"usage":null,"instructions":null,"tool_choice":"auto","tools":[],"reasoning":null,"text":{"format":{"type":"text"}}}}
Note "truncation":"" in the response object. The same empty value also appears in non-streaming responses.
Expected behavior
Per the OpenAI Responses API spec, truncation must be one of "auto" or "disabled". Return a valid value (e.g. "truncation":"auto") or null instead of an empty string.
Impact
- Any client that strictly validates the Responses API contract fails on the first event of every streamed response, before any content can be processed.
- For Grok Build,
web_searchconfigured to usegrok-4.5via OpenCode Zen Go is 100% broken — the tool errors out before returning any results.
Secondary observation (possibly related)
With the web_search tool and stream:false, the output contains a search_results item with 15 result entries, but every entry is an empty object {} (no title/url/content fields). The model still generates an answer from the search, but the structured results are empty — possibly another serialization issue in the same gateway.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
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.