Skip to content

fix(opencode): send x-opencode-session header to OpenCode Go upstream - #138

Merged
raine merged 1 commit into
raine:mainfrom
PauloPhagula:fix/opencode-session-header
Sep 8, 2026
Merged

fix(opencode): send x-opencode-session header to OpenCode Go upstream#138
raine merged 1 commit into
raine:mainfrom
PauloPhagula:fix/opencode-session-header

Conversation

@PauloPhagula

@PauloPhagula PauloPhagula commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • OpenCode Go now rejects requests missing x-opencode-session ("Request is missing x-opencode-session and cannot be routed efficiently"), so all OpenCode Go traffic through the proxy currently fails.
  • OpenCodeClient::post now sets x-opencode-session on every upstream request, using the Claude Code session id already threaded through RequestContext.session_id (from x-claude-code-session-id), falling back to a generated UUID for callers with no session id.
  • Traffic-capture metadata now reflects the x-opencode-session value sent upstream.

Fixes #137

Test plan

  • cargo test opencode — 41 tests pass, including new header-capture and end-to-end forwarding assertions
  • cargo clippy --all-targets — clean
  • cargo fmt --check — clean

OpenCode Go now rejects requests missing x-opencode-session ("Request
is missing x-opencode-session and cannot be routed efficiently"). Forward
the Claude Code session id (already threaded through RequestContext) as
that header on every upstream request, falling back to a generated UUID
when no session id is available.

Fixes raine#137
@PauloPhagula
PauloPhagula marked this pull request as ready for review September 8, 2026 13:31
@raine
raine merged commit ed8c97a into raine:main Sep 8, 2026
@raine

raine commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Thanks

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.

OpenCode Go rejects requests over missing x-opencode-session

2 participants