Skip to content

fix(core): send x-opencode-session header on session runner requests - #47473

Open
pengzh1 wants to merge 1 commit into
anomalyco:devfrom
pengzh1:fix/issue-47438
Open

fix(core): send x-opencode-session header on session runner requests#47473
pengzh1 wants to merge 1 commit into
anomalyco:devfrom
pengzh1:fix/issue-47438

Conversation

@pengzh1

@pengzh1 pengzh1 commented Sep 5, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #47438

Type of change

  • Bug fix

What does this PR do?

Requests made by the V2 session runner only carried x-session-affinity and X-Session-Id. #44752 fixed the header set on the request path in packages/opencode/src/session/llm/request.ts, but the runner builds its own headers in packages/core/src/session/runner/llm.ts and never got the x-opencode-session header, so those requests reach opencode providers with only the transport's default user agent (Node fetch) and no session identifier. That matches the provider report in the issue.

This adds x-opencode-session alongside the existing correlation headers in the runner, so both request paths now identify the session the same way.

How did you verify your code works?

Added x-opencode-session to the existing "adds session correlation headers to model requests" test in packages/core/test/session-runner.test.ts and confirmed it fails against the current runner with exactly that key missing from the received headers, then passes after the one-line fix. The full packages/core suite passes: 1091 pass, 7 skip (the one Npm.add failure in the full run is an unrelated 5s timeout that passes in isolation).

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The V2 session runner only sent x-session-affinity and X-Session-Id on
provider requests, so requests leaving through the Node fetch transport
reached opencode providers without the x-opencode-session header the
service expects. Add it alongside the existing correlation headers.
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential duplicate found:

The current PR (47473) appears to be a focused fix for the session runner's LLM requests missing the x-opencode-session header. PR #47213 addresses a similar concern for Copilot requests. Both are related to ensuring session identifiers are correctly included in outgoing requests to external providers.

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.

Missing x-opencode-session header in Node.js fetch calls

1 participant