fix(opencode): send x-opencode-session header to OpenCode Go provider - #15
Open
Usman0220 wants to merge 1 commit into
Open
fix(opencode): send x-opencode-session header to OpenCode Go provider#15Usman0220 wants to merge 1 commit into
Usman0220 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenCode Go began enforcing the
x-opencode-sessionheader on 2026-09-05 to optimize routing and prompt caching. Every request made through the built-inopencode-goprovider is now rejected:Upstream OpenCode (v1.18.x) works against the same endpoint because it sends the header natively per session. This PR ports those send points into pentestcode.
Changes
packages/opencode/src/session/llm/request.ts— replace thex-pentestcode-*headers with the canonicalx-opencode-*headers (x-opencode-session,x-opencode-request,x-opencode-client,x-opencode-project) for allopencode*providers, and applyx-parent-session-iduniformly across both provider branches (matches upstreamanomalyco/opencodebehavior).packages/core/src/session/runner/llm.ts— add the missinghttp.headerssend point (x-session-affinity,X-Session-Id,x-parent-session-id) so auxiliary/runner requests carry the session too, includingx-opencode-sessionwhen the model provider isopencode*.Why not keep
x-pentestcode-*?The
x-pentestcode-*headers were only produced inrequest.tsand consumed nowhere in this repo — swapping them for the upstreamx-opencode-*names is safe and fixes routing tohttps://opencode.ai/zen/go/v1.Testing
bun run build --single --skip-embed-web-ui), smoke test passed.opencode-go/*models now carry a stable per-conversation session ID inx-opencode-session.