Skip to content

fix(models): tell OpenCode no session at all, nor an empty tools list - #847

Merged
leookun merged 1 commit into
mainfrom
fix/opencode-no-session-headers
Nov 9, 2026
Merged

leookun merged 1 commit into
mainfrom
fix/opencode-no-session-headers

Conversation

@leookun

@leookun leookun commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #845, which didn't fix the 400s on OpenCode's DeepSeek.

#845 dropped only X-Claude-Code-Session-Id. The requests still carried x-opencode-session (added by the proxy itself since #75) and x-session-id (sent by the CLI). Replaying the failing requests from the usage traces against OpenCode:

  • any one session header + cache_control → 400 (Extra inputs are not permitted … cache_control)
  • no session header → 200
  • no session header, side request with tools: [] → 400 (tools must not be an empty array); without the empty list → 200

Changes:

  • Nothing that names a session (x-claude-code-session-id, x-session-id, x-session-affinity, x-opencode-session) is passed on to OpenCode.
  • The proxy adds x-opencode-session only for OpenCode Go (/zen/go), which refuses a request without it.
  • An empty tools list is left out for OpenCode.
  • A user's own custom headers still go out as configured.

Prompt caching without a session header was checked in #845: turns 2–5 hit ~23.5k/23.6k tokens.

🤖 Generated with BaoCode

#845 dropped only X-Claude-Code-Session-Id, but OpenCode still got
x-opencode-session (which the proxy adds itself since #75) and the CLI's
x-session-id; either one alone still routes the request to the backend
that refuses cache_control. Replaying the failing requests from the
usage traces: 400 with any session header, 200 with none.

So nothing that names a session goes to OpenCode, and the proxy adds
x-opencode-session only for Go, which refuses a request without it.
Untold, OpenCode's backend refuses `tools: []` (Claude Code's side
requests), so an empty list is left out.

Co-Authored-By: BaoCode <noreply@baocode.dev>
@leookun
leookun merged commit 917fae3 into main Nov 9, 2026
3 checks passed
@leookun
leookun deleted the fix/opencode-no-session-headers branch November 9, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants