pengpenglele/dsh-opencode-go-x-session-code ↗★ 0

dsh-opencode-go-x-session

Adds OpenCode Go's required x-opencode-session header to model requests of the configured OpenCode routes (including auto-review and hand-declared routes), with a live on/off switch. 适合使用OpenCode Go并需要保持会话一致性与缓存亲和性的开发者。

Package
dsh-opencode-go-x-session
Compatibility
Unverified
Version
1.2.1
License
MIT
Last updated
Oct 26, 2026

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pengpenglele/dsh-opencode-go-x-session-code

Usage

It works with no configuration

After installation and a restart, requests on opencode-go and every opencode-go-* route to opencode.ai receive the header automatically. The value is the DSH session id, so it is stable across the turns of one conversation and distinct between concurrent conversations.

For auto-review, the reviewer request runs inside the reviewed agent's driver chain, so the plugin resolves that conversation's id through ctx.agents.currentInitiator() — the review keeps its prompt-cache affinity instead of falling back to a shared id.

Settings

Settings → Plugins → OpenCode Session Header. All fields are optional and every field is live (volatile()): a settings save applies to the next request without a restart.

FieldDefaultMeaning
enabledtrueMaster switch; false removes the fetch patch immediately and every request passes through untouched
providers['opencode-go*']Provider routes served by the plugin; entries may be exact ids or trailing-* prefix patterns. The default covers the opencode-go catalog route and every opencode-go-* variant. An empty list disables injection
hosts['opencode.ai']Host allowlist; each entry also covers its subdomains. An empty list removes the host check (for a proxy endpoint)
fallbackSessionIddsh-auto-reviewStable id used only when neither the request, the enclosing scope, nor an initiator session id exists
debugfalseLog every injection through the host logger

Custom routes and proxy endpoints

  • A new opencode-go-something route is covered automatically — no config change.
  • The plain opencode (non-Go) route is not covered by the default pattern; add opencode to providers if you use it.
  • If your OpenCode endpoint is a proxy with another hostname, either add that hostname to hosts or set hosts to [] to disable the host check. The provider list still scopes injection.

Check that it is working

  1. The DSH startup log shows:

    opencode-session-header: active (providers opencode-go*, hosts opencode.ai)
    
  2. Turn on debug and start a conversation on an OpenCode Go route; every injected request logs:

    [opencode-session-header] x-opencode-session:  -> 
    
  3. The original symptom disappears: no more 400 MissingSessionID, and auto-review on an OpenCode Go model no longer fails with Auto review of tool "..." failed.

It works with no configuration

After installation and a restart, requests on opencode-go and every opencode-go-* route to opencode.ai receive the header automatically. The value is the DSH session id, so it is stable across the turns of one conversation and distinct between concurrent conversations.

For auto-review, the reviewer request runs inside the reviewed agent's driver chain, so the plugin resolves that conversation's id through ctx.agents.currentInitiator() — the review keeps its prompt-cache affinity instead of falling back to a shared id.