Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.

fix(llm): send x-opencode-session for OpenCode Go hosts - #2656

Open
FOWEPJF255 wants to merge 2 commits into
MoonshotAI:mainfrom
FOWEPJF255:fix/opencode-session-header-2653
Open

FOWEPJF255 wants to merge 2 commits into
MoonshotAI:mainfrom
FOWEPJF255:fix/opencode-session-header-2653

Conversation

@FOWEPJF255

@FOWEPJF255 FOWEPJF255 commented Sep 20, 2026 •

Copy link
Copy Markdown

Related Issue

Resolve #2653

Description

OpenCode Go returns HTTP 400 when coding agents omit a stable x-opencode-session header.

This change:

  • Detects official OpenCode hosts (opencode.ai / *.opencode.ai)
  • Sets x-opencode-session to the current Kimi session id for openai_legacy and openai_responses
  • Leaves an explicit custom_headers value untouched
  • Passes session_id into web title-generation LLM creation so that path stays consistent

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Test plan

  • pytest tests/core/test_create_llm.py -k opencode -- 5 passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

OpenCode Go returns HTTP 400 when coding agents omit the stable
x-opencode-session header. Bind it to the Kimi session id for
*.opencode.ai openai-compatible providers, and leave explicit custom
headers untouched. Also pass session_id from web title generation.

Fixes MoonshotAI#2653
Record the x-opencode-session behavior for users and mention it next to the openai_legacy provider example.

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] OpenCode Go returns 400 because x-opencode-session header is missing

2 participants