MoonshotAI / MoonshotAI/kimi-cli

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

Open
#2,653 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
11.4k
Forks
1.3k
Avg merge
9h 47m
Merged PRs (30d)
2

Description

Environment

  • Kimi Code version: Unknown
  • OS: Windows
  • Provider: OpenCode Go
  • Model: Unknown
  • Installation method: Unknown

Problem

When using Kimi Code with OpenCode Go, requests fail with the following error:

400 Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently. Please see https://opencode.ai/docs/go/#where-can-i-use-it
provider.api_error · HTTP 400

Expected behavior

Kimi Code should send a stable x-opencode-session header for each conversation when making requests to OpenCode Go. The value should remain stable during one conversation and change for a new conversation.

Actual behavior

The request does not include the x-opencode-session header, so OpenCode Go rejects the request with HTTP 400.

Relevant documentation

OpenCode Go requires coding agents to send a stable session ID in the x-opencode-session header:

https://opencode.ai/docs/go/#where-can-i-use-it

The OpenCode Go documentation lists Kimi Code as a known problematic client and tracks the missing automatic session-header support as issue #3506.

Reproduction steps

  1. Configure Kimi Code to use OpenCode Go.
  2. Select an OpenCode Go model.
  3. Start a new conversation.
  4. Send any prompt.
  5. The request fails with HTTP 400.

Possible fix

Add a stable session identifier to all OpenCode Go requests:

x-opencode-session: <stable-session-id>

The session ID should be generated once per conversation and reused for all related requests, including auxiliary or tool-related requests if applicable.

Additional context

This appears to be missing session metadata rather than an authentication or model availability problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the OpenCode Go provider request path and reproduce the failure using the configuration and steps in the issue. Trace how conversation identity is created and passed to requests, then verify that the header remains stable within one conversation, changes for a new conversation, and is included for related requests without causing the provider's HTTP 400 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.