GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(session): send x-opencode-session on OpenCode Go requests by yanyihan-xiaomi · Pull Request #2655 · XiaomiMiMo/MiMo-Code

Conversation

@yanyihan-xiaomi

@yanyihan-xiaomi yanyihan-xiaomi commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

What

Send x-opencode-session (same stable per-conversation sessionID) on OpenCode Go inference requests only — including ephemeral title/summary — so opencode-go/* models work again. Non-Go providers stay byte-identical.

Why

Fixes #2317, #2477. OpenCode Go hard-rejects requests with no per-conversation ID since 2026-09-05 (400 MissingSessionID). MiMoCode already sends the value as x-session-affinity on non-ephemeral calls; the Go gateway requires the second name, and community reports show title/summary (ephemeral) also need it.

User-Agent is already mimocode/<version> (matches https://opencode.ai/docs/go/). Only the session header was missing.

Prior PRs #2327 (closed) / #2494 (conflicting) targeted the retired packages/opencode/ tree and only covered non-ephemeral calls.

Design

isOpenCodeGoModel(model) matches:

  1. providerID is opencode-go or starts with opencode-go (covers opencode-go-chat etc.)
  2. or model.api.url / options.baseURL|baseUrl contains opencode.ai/zen/go (custom ids like oc)

On match: x-opencode-session: sessionID whenever sessionID is present (incl. ephemeral). x-session-affinity / x-parent-session-id unchanged.

Tests

packages/cli/test/session/llm-system-prompt.test.ts:

  • isOpenCodeGoModel unit matrix (id / URL / negative)
  • Go non-ephemeral: both x-opencode-session and x-session-affinity == sessionID
  • Go ephemeral: x-opencode-session == sessionID, no x-session-affinity
  • non-Go: no x-opencode-session, affinity unchanged

Verification on this branch:

  • bun test test/session/llm.test.ts test/session/llm-retry.test.ts test/session/llm-system-prompt.test.ts test/session/llm-request-prefix.test.ts → 49 pass / 2 skip / 0 fail
  • bun run typecheck → clean

Feature doc: docs/compose/spec/opencode-go-session-header.md

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yanyihan-xiaomi added 4 commits October 13, 2026 13:17
@yanyihan-xiaomi
fix(session): send x-opencode-session on OpenCode Go requests
c7e6ae5
OpenCode Go (zen/go) hard-rejects inference without a stable
per-conversation x-opencode-session (400 MissingSessionID) since 09/05.
Reuse the existing sessionID — including ephemeral title/summary — but
only for Go targets so other providers stay unchanged.

Fixes #2317, #2477
@yanyihan-xiaomi
fix(provider): detect OpenCode Go via provider.options.baseURL
2448111
Review found the standard custom-provider setup (TUI / config sets only
provider.options.baseURL to zen/go) never lands on Provider.Model, so
model-only detection missed it. Hoist detection to provider/opencode-go.ts
and pass getProvider().options from stream().
@yanyihan-xiaomi
refactor(provider): judge OpenCode Go via effectiveBaseURL
bc0cfd9
Stop enumerating config fields. Export effectiveBaseURL with the same
precedence resolveSDK uses (provider.options.baseURL ?? model.api.url)
and have the Go detector ask that one helper.
@yanyihan-xiaomi
docs(spec): deliver opencode-go-session-header; drop unused Pick field
27212d4
Review 2 nits: rename stale isOpenCodeGoModel reference, mark tasks done,
narrow detection helpers to the fields they read.
@yanyihan-xiaomi
yanyihan-xiaomi marked this pull request as ready for review October 13, 2026 05:30
@yanyihan-xiaomi
yanyihan-xiaomi merged commit 597e710 into main Oct 13, 2026
6 checks passed

Uh oh!

There was an error while loading. Please reload this page.

onlyfeng added a commit to onlyfeng/MiMo-Code that referenced this pull request Oct 13, 2026
@onlyfeng
Merge upstream/main through 5f55525 into main
73f60ba
Adopt the history_fts kind classification with its dual-column search
index and two new migrations (XiaomiMiMo#2642), the x-opencode-session header on
OpenCode Go requests (XiaomiMiMo#2655), and the README MiMo Desktop GA wording
(XiaomiMiMo#2654). The merge is clean; FC-017's projection and media files are
untouched and its NUL, preview-budget and locator tests pass.
@VariableVince VariableVince mentioned this pull request Oct 23, 2026
Docs: incorrectly stating MiMo Code as "Problematic Client" anomalyco/opencode#58534
Closed
@chenyb999-zhcn chenyb999-zhcn mentioned this pull request Oct 24, 2026
docs(www): move MiMo Code to validated clients on the Go page anomalyco/opencode#58791
Closed
3 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Send x-opencode-session header on API requests (required by OpenCode Go from 09/05)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@yanyihan-xiaomi
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.