[Bug] OpenCode Go requests rejected with 400 "Request is missing x-opencode-session" #2110
Closed
gilsion0929
started this conversation in
Bug reports
Replies: 3 comments
|
I’m taking a look at this. |
0 replies
0 replies
|
Merged in #2131; this fix is not released yet. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Affected area
AI providers and models
What happened?
Requests to the OpenCode Go provider are rejected by the gateway with HTTP 400:
Error: 400 Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently.
prime-agent never sends the x-opencode-session header that OpenCode Go requires, so the opencode-go provider is unusable.
Root cause: The bundled openai-completions provider only emits session-affinity headers when compat.sendSessionAffinityHeaders is true, and even then it sends session_id, x-client-request-id, and x-session-affinity — never x-opencode-session. detectCompat() defaults sendSessionAffinityHeaders: false, and the built-in opencode-go model definitions do not set it, so no session header is sent at all for the Go provider.
if (sessionId && compat.sendSessionAffinityHeaders) {
headers.session_id = sessionId;
headers["x-client-request-id"] = sessionId;
headers["x-session-affinity"] = sessionId;
}
"opencode-go": {
"deepseek-v4-flash": {
api: "openai-completions",
provider: "opencode-go",
baseUrl: "https://opencode.ai/zen/go/v1",
compat: { "requiresReasoningContentOnAssistantMessages": true, "thinkingFormat": "deepseek" },
...
}
}
Steps to reproduce
Expected behavior
For the opencode-go provider, prime-agent should send the x-opencode-session header (with a stable per-conversation session ID) so OpenCode Go can route and cache efficiently.
Suggested fix: add "opencode-go" to the set of providers that send session-affinity headers, and emit x-opencode-session (in addition to session_id/x-client-request-id/x-session-affinity) for that provider.
Prime Agent version
0.9.3-beta.634.1.bf8894a (also present in 0.9.3-beta.632.1.b9cf467)
Installation method
Stable release installer
Operating system
Windows Subsystem for Linux (WSL)
Operating system version
Ubuntu 24.04.4 LTS
CPU architecture
x86_64 / amd64
Shell and terminal
bash (GNU bash) in a terminal emulator
Additional context
Local workaround (lost on every update): manually patch the bundled openai-completions-*.js to (1) set sendSessionAffinityHeaders: provider === "opencode-go" and (2) add headers["x-opencode-session"] = sessionId; in the session-header block. A proper upstream fix is requested so this survives updates.
All reactions