Skip to content

feat(opencode): send x-opencode-session header for all providers#15520

Closed
SeanThomasWilliams wants to merge 1 commit intoanomalyco:devfrom
SeanThomasWilliams:feat/unconditional-session-header
Closed

feat(opencode): send x-opencode-session header for all providers#15520
SeanThomasWilliams wants to merge 1 commit intoanomalyco:devfrom
SeanThomasWilliams:feat/unconditional-session-header

Conversation

@SeanThomasWilliams
Copy link

@SeanThomasWilliams SeanThomasWilliams commented Mar 1, 2026

Why

LiteLLM and other proxy or relay setups use the x-opencode-session header for session affinity routing. Today this header is only sent for opencode providers, so non-opencode providers behind a proxy cannot route consistently.

What changed

  • Send x-opencode-session unconditionally for all providers
  • Keep existing opencode-only headers (x-opencode-project, x-opencode-request, x-opencode-client) behind the existing provider check
  • Preserve existing User-Agent behavior for non-anthropic providers

Impact

This enables stable session affinity across proxy setups, including LiteLLM, Ollama relay, and similar gateways, without changing existing provider-specific header behavior.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 1, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

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

Based on my search, I found related PRs that address session handling and headers, though not exact duplicates of PR #15520:

Potentially Related PRs:

  1. PR feat: send x-session-id and x-parent-session-id headers in LLM API requests #12932 - feat: send x-session-id and x-parent-session-id headers in LLM API requests

    • Addresses session headers for LLM API requests, which is conceptually similar to adding session affinity headers
  2. PR feat: add mistral session affinity header #11474 - feat: add mistral session affinity header

    • Directly related to session affinity routing like your PR, but specific to Mistral provider
  3. PR feat(opencode): add LiteLLM provider with auto model discovery #14468 - feat(opencode): add LiteLLM provider with auto model discovery

    • Related to LiteLLM provider support mentioned in your PR's impact section
  4. PR feat(opencode): add auto loading models for litellm providers #13896 - feat(opencode): add auto loading models for litellm providers

    • Also related to LiteLLM provider functionality

The current PR #15520 appears to be addressing a more comprehensive solution (sending the header unconditionally for all providers), whereas the related PRs are either provider-specific or handle different session header approaches.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 1, 2026
@github-actions github-actions bot closed this Mar 1, 2026
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.

1 participant