dsh-opencode-go-session
Manifest validSends a stable per-conversation x-opencode-session header on every pi-ai call to OpenCode through the harness header hook, so routing and prompt caching stay per conversation. Its HTTP routes have no
dsh-opencode-go-session
OpenCode's Console gateway asks every client to send one stable session id per conversation in the x-opencode-session header, so the gateway can route that conversation consistently and reuse its prompt cache. A hardcoded value makes every conversation look like the same one; no value means no affinity at all.
This DeepSeek Harness plugin makes the value dynamic: every inference call over the pi-ai adapter sends the DSH session id of the conversation that made it. One conversation keeps one value for its whole life, a new conversation gets a new one, and each subagent speaks for its own session.
It has no interface of its own: enabling the plugin is the whole setup.
What it does
- Listens on the
llm-pi-ai/request-headerswaterfall and sets the header on each call that carries a DSH session id. - Covers OpenCode endpoints only by default (
*.opencode.ai); one config field widens it to every pi-ai provider. - Wins over a static
x-opencode-sessionleft in the provider'sheaders, so a profile can keep that line while this plugin overrides it per conversation. - Never breaks a call: a header problem is counted and reported on the status endpoint instead of failing the request.
Install
- Plugin Market / Plugin Manager: add the package.
- Local directory: Plugins → Add plugin → select this directory.
The plugin adds one row, opencode-go-session. No configuration is required. It is published on npm as dsh-opencode-go-session.
Configuration
Change the row's config in cordis.patch.yml (the loader restarts the plugin when it changes):
| Key | Default | Meaning |
|---|---|---|
headerName | x-opencode-session | Header that carries the conversation id. |
endpoints | opencode | opencode sends it only to *.opencode.ai; all sends it to every pi-ai provider route. |
fallbackValue | (empty) | Value for calls with no DSH session id, such as a helper request from outside a conversation. Empty omits the header on those calls. |
- id: opencode-go-session
name: 'dsh-opencode-go-session'
config:
endpoints: opencode
Verify
The plugin reports what it sent on a read-only endpoint of the Host:
curl http://127.0.0.1:3080/plugins/opencode-go-session/api/status
{
"ok": true,
"value": {
"version": "0.1.1",
"headerName": "x-opencode-session",
"endpoints": "opencode",
"fallbackValue": "",
"stats": { "requests": 34, "injected": 34, "errors": 0, "lastAt": "2026-11-16T13:35:17.549Z", "lastError": null },
"sessions": [
{ "sessionId": "session-b53b6603-…", "provider": "opencode-deepseek-v4-1-flash", "model": "deepseek-v4.1-flash", "count": 34, "firstAt": "…", "lastAt": "…" }
]
}
}
A conversation appears the first time it reaches an OpenCode endpoint after the plugin loads. requests counts every pi-ai call the plugin saw, injected the ones that received the header.
Limitations
- Only routes served by
@deepseek-ai/dsh-llm-pi-aiare covered, which is where OpenCode providers are configured. A provider on another adapter (for example@deepseek-ai/dsh-llm-deepseek) receives nothing from this plugin. - Model discovery is outside the hook's contract, so it sends no session header.
- Values and counters live in the Host process: they reset on restart, and only the latest 30 conversations are reported.
Compatibility
Needs a Harness release that emits llm-pi-ai/request-headers (verified on 0.2.2-rc.3). On older releases the plugin loads and the status endpoint reports that nothing has been sent.
License
MIT
Comments
Loading…
Similar plugins
by nobu121
Attaches a stable per-conversation x-opencode-session header to OpenCode / OpenCode Go provider requests, fixing 400 MissingSessionID errors and keeping session affinity and prompt-cache routing intac
★ 16
↓ 379/wk
JavaScript
Sep 11, 2026
dsh plugin --profile web add dsh-opencode-sessionby FFFengMJL
[Deprecated] Superseded by @earendil-works/pi-ai >= 1.5.0, which injects x-opencode-session for any provider whose baseURL host is opencode.ai.
★ 0
MIT
JavaScript
Nov 10, 2026
dsh plugin --profile web add dsh-opencode-sessionby beihzb
Per-conversation x-opencode-session injection for OpenCode Go in DeepSeek Harness - fixes 400 MissingSessionID without breaking other providers
★ 16
↓ 173/wk
MIT
JavaScript
Sep 7, 2026
dsh plugin --profile web add dsh-opencode-session-headerby itchenshi
Declares the OpenCode Go and Command Code route wire protocol and endpoint (so the API address never has to be typed), adds the DeepSeek V4.1 models to the OpenCode Go route and puts them first, compl
★ 1
MIT
JavaScript
Oct 5, 2026
dsh plugin --profile web add dsh-gateway-modelsby itchenshi
DeepSeek Harness plugin: declares the OpenCode Go route wire protocol, auto-adds DeepSeek V4.1 models, and attaches the x-opencode-session header
★ 0
MIT
JavaScript
Sep 24, 2026
dsh plugin --profile web add dsh-opencode-go-pathby wobushiyoushen0214
Pin an OpenCode Go upstream route in DeepSeek Harness by keeping one stable x-opencode-session key, with an in-GUI route picker and drift checks.
★ 0
NOASSERTION
JavaScript
Oct 14, 2026
dsh plugin --profile web add dsh-opencode-pin