Skip to content

OpenCode Go: add x-opencode-session header (required from Sep 6, 2026) #3866

Description

@eddy-lau

Summary

OpenCode (opencode.ai) emailed OpenCode Go subscribers that requests missing the x-opencode-session header will start erroring on 2026-09-06. Forge's OpenCode Go integration does not send this header.

From the OpenCode Go docs:

To ensure your account does not get flagged, make sure the tool you're using

  1. does not generate abusive traffic
  2. properly identifies itself (no broad user agents)
  3. includes the x-opencode-session header so we can optimize prompt caching

The email states the Forge user agent is not recognized and asks maintainers to add x-opencode-session (one stable ID per conversation).

Current state

  • Confirmed against latest main: no occurrence of x-opencode-session anywhere in the repo.
  • crates/forge_repo/src/provider/provider.json (opencode_go) has no headers set, and Provider::custom_headers is a static map — insufficient here since the value must be a stable per-conversation ID.
  • Reproduced with forge 2.13.21 logged into opencode_go.

Suggested fix

Attach x-opencode-session: <conversation-id> (e.g. the existing conversation/session UUID) to requests routed to the opencode_go provider (and likely opencode_zen as well — same gateway, https://opencode.ai/zen/go).

A static header won't work; the value should be one stable ID per conversation so OpenCode can optimize prompt caching.

Environment

  • forge 2.13.21 (latest), macOS arm64
  • provider: opencode_go, model: deepseek-v4-flash

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions