Skip to content

feat: send x-opencode-session header for OpenCode Go/Zen providers - #5868

Open
huangxianzhan wants to merge 1 commit into
Hmbown:mainfrom
huangxianzhan:feat/opencode-session-header
Open

feat: send x-opencode-session header for OpenCode Go/Zen providers#5868
huangxianzhan wants to merge 1 commit into
Hmbown:mainfrom
huangxianzhan:feat/opencode-session-header

Conversation

@huangxianzhan

Copy link
Copy Markdown

What

OpenCode Go (https://opencode.ai/docs/go/) asks clients to send a stable \x-opencode-session\ header so it can optimize prompt caching and attribute traffic to a conversation. Codewhale requests were missing it, and the client UA (Mozilla/5.0 compatible codewhale/...) gets classified as a plain browser on the gateway; traffic without the header may error starting 2026-09-06.

Changes

  • Inject one process-stable UUID v4 into \x-opencode-session\ in \�uild_default_headers\ for \OpencodeGo/OpencodeZen\ providers only.
  • Other providers are untouched; a user-configured \x-opencode-session\ via the existing \http_headers\ config always wins (extra-header loop overwrites).
  • Three unit tests: header present and stable per process; user-configured value wins; absent for non-OpenCode providers.

Verification

  • \cargo check -p codewhale-tui\ passes
  • \cargo test -p codewhale-tui --lib session_header: 3 passed, 0 failed
  • End-to-end capture against a local mock gateway shows the header on every request; live opencode.ai models/chat/SSE behave normally.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Thanks @huangxianzhan for taking the time to contribute.

This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered.

Please read CONTRIBUTING.md for the expected contribution shape. A maintainer can grant recurring PR access by commenting /lgtm on a pull request.

Replaces the earlier commit whose blob carried CRLF line endings, producing
a noisy full-file diff. Same code: process-stable x-opencode-session UUID v4
for OpencodeGo/OpencodeZen in build_default_headers, user-configured header
wins, three unit tests.
@huangxianzhan
huangxianzhan force-pushed the feat/opencode-session-header branch from 7faf58e to 4a2d296 Compare September 4, 2026 02:45
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