Description
xAI sessions fail after the first tool call when Responses WebSockets are enabled. The initial response and tool execution succeed, but OpenCode's incremental response.create includes both instructions and previous_response_id.
xAI rejects that combination, then OpenCode masks the provider error as Invalid xAI Responses WebSocket event because xAI's error envelope has no top-level type.
A pass-through WebSocket probe captured:
{"error":{"message":"Request validation error: Argument not supported: instructions and previous_response_id together","type":"api_error"}}
This reproduces consistently on beta-19398 and dev-19405. dev-19390 passes and dev-19391 is the first failing published build, corresponding to #48140 (bdc143c1d5caa9571106233dd3014242f5c126ec), which enabled Responses WebSockets by default.
Expected: the tool result is sent and the model completes the response.
Actual: the continuation aborts with the generic WebSocket event error.
Disabling xAI WebSockets makes the identical request pass:
{"providers":{"xai":{"websocket":false}}}
Plugins
None configured
OpenCode version
0.0.0-beta-19398
Also reproduced on 0.0.0-dev-19405
Steps to reproduce
- Authenticate the xAI provider and use
xai/grok-4.6 with the default WebSocket setting.
- Run:
opencode2 run --standalone --model "xai/grok-4.6" -- "Run pwd with the shell tool, then reply with exactly DONE"
- The tool succeeds, then the continuation fails with:
Invalid xAI Responses WebSocket event
Screenshot and/or share link
Not provided; the minimal standalone reproduction above is consistent.
Operating System
macOS 26 / Darwin 25.6.0 (arm64)
Terminal
WezTerm (TERM=xterm-256color)
Description
xAI sessions fail after the first tool call when Responses WebSockets are enabled. The initial response and tool execution succeed, but OpenCode's incremental
response.createincludes bothinstructionsandprevious_response_id.xAI rejects that combination, then OpenCode masks the provider error as
Invalid xAI Responses WebSocket eventbecause xAI's error envelope has no top-leveltype.A pass-through WebSocket probe captured:
{"error":{"message":"Request validation error: Argument not supported: instructions and previous_response_id together","type":"api_error"}}This reproduces consistently on
beta-19398anddev-19405.dev-19390passes anddev-19391is the first failing published build, corresponding to #48140 (bdc143c1d5caa9571106233dd3014242f5c126ec), which enabled Responses WebSockets by default.Expected: the tool result is sent and the model completes the response.
Actual: the continuation aborts with the generic WebSocket event error.
Disabling xAI WebSockets makes the identical request pass:
{"providers":{"xai":{"websocket":false}}}Plugins
None configured
OpenCode version
0.0.0-beta-19398Also reproduced on
0.0.0-dev-19405Steps to reproduce
xai/grok-4.6with the default WebSocket setting.Screenshot and/or share link
Not provided; the minimal standalone reproduction above is consistent.
Operating System
macOS 26 / Darwin 25.6.0 (arm64)
Terminal
WezTerm (
TERM=xterm-256color)