Skip to content

OpenCode Go inference and connection tests omit required x-opencode-session #4663

Closed

Description

@Totoro-qaq

What happened

OpenCode Go inference requests sent by Maka omit the provider-required
x-opencode-session header. This affects both the normal AI SDK model path
and the direct Connection Test probe.

OpenCode Go's operator has announced that requests without this header may
start failing on September 5, 2026:
vercel/ai#20271

The value must be one stable opaque ID per conversation. Generating a fresh ID
per HTTP request would not satisfy the routing/affinity contract.

Maka already has the needed identities:

  • main runs: input.context.sessionId
  • title/recap/memory/goal auxiliary calls: transportContextId
  • Connection Test: a stable connection-scoped probe identity can be derived
    separately because it is not a conversation

Expected: every OpenCode Go inference request carries a stable
x-opencode-session, including streaming/non-streaming requests, later
turns, tool-loop steps, retries, history compaction, auxiliary calls, and
Connection Test probes. The header should be limited to OpenCode Go traffic,
contain no user data, and preserve an explicitly configured header.

How to reproduce

I reproduced this against the JavaScript packaged in the current Desktop
build, using an isolated mock fetch. No real API key was read and no
network request was sent.

  1. Import getAIModel from the packaged @maka/runtime/model-factory.
  2. Construct an opencode-go model for
    muse-spark-1.2-contributor with a mock fetch.
  3. Invoke model.doGenerate(...) and inspect the resulting Request.
  4. Call testConnection(...) for the same provider/model with a mock fetch
    and inspect that Request as well.

Sanitized result:

{
  "inference": {
    "url": "https://opencode.ai/zen/go/v1/responses",
    "sessionHeader": null,
    "userAgent": "ai-sdk/openai/4.0.44 ai-sdk/provider-utils/5.0.28 runtime/node.js/24"
  },
  "connectionTest": {
    "url": "https://opencode.ai/zen/go/v1/responses",
    "sessionHeader": null
  }
}

The current main source also contains no x-opencode-session
implementation:

  • packages/runtime/src/model-factory.ts applies only stored
    requestHeaders; its input has no per-session request identity.
  • packages/runtime-host/src/server/execution-model-composition.ts has
    input.context.sessionId, but does not add it to provider request headers.
  • runHostAuxiliaryModelCall() has transportContextId, but likewise
    forwards only stored request headers.
  • packages/runtime/src/test-connection.ts sends its inference probes
    directly, bypassing the model factory.

Environment

  • Maka version: 0.2.0-dev.15.20260902
  • Maka main inspected at: 91624f1f3ea14eef92b686c56f8fcd92034446b8
  • OS: macOS 26.6.2 arm64
  • Surface: Desktop / Runtime Host
  • Node.js: 24.18.1

Logs, screenshots, or additional context

The public upstream report says AI SDK does not create or persist this
provider-specific conversation identity automatically; clients must pass the
header themselves. OpenCode's own request path sends its session ID as
x-opencode-session:
https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/llm/request.ts

OpenCode Go supports several wire protocols, so the safest boundary is a
provider-specific fetch/header policy shared by every adapter rather than
patching only one OpenAI-shaped request.

AI assistance

OpenAI Codex assisted with source inspection, the isolated packaged-runtime
probe, and drafting this issue. I reviewed the evidence and the final report.

Activity

  1. Totoro-qaq commented on Sep 3, 2026

    @Totoro-qaq
    ContributorAuthor

    take

  2. added a commit that references this issue on Sep 3, 2026
    7ab2a43
  3. added a commit that references this issue on Sep 4, 2026
    6244a04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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