Introduction¶
When using DeepSeek Harness (DSH) to invoke the OpenCode Go model, the x-opencode-session request header is required to handle session routing and prompt caching. DSH <= 0.1.2-rc.1 does not send this header under its default configuration, causing all OpenCode Go requests to return a 400 MissingSessionID error. Since the upstream fix has not yet been released, this plugin fills the gap for a local fix.
Plugin Overview¶
dsh-opencode-session-header is a plugin for DeepSeek Harness (DSH), maintained by beihzb. It fixes the OpenCode Go session validation error by injecting the x-opencode-session header, while preserving the existing routing and caching optimization mechanisms.
Core Features¶
- Single-session injection: Injects a separate
x-opencode-sessionheader for each DSH session. - Error fix: Resolves the
400 MissingSessionIDrejection issue. - Preserved optimizations: Maintains OpenCode’s per-session routing and prompt caching optimizations.
- Strict scope: Works only for the
opencode.aidomain and does not affect other providers. - No restart required: Can be switched on/off immediately through configuration without restarting DSH.
- Zero dependencies: Does not introduce additional third-party libraries.
Installation and Enablement¶
Run the following command in the terminal to install the plugin:
dsh plugin --profile web add dsh-opencode-session-header
After installation, restart the dsh web service once to load the plugin. The startup log should display plugin loading information.
Runtime Toggle¶
The plugin provides a runtime toggle feature, allowing changes to take effect without restarting the service.
The toggle file is located at:
<DSH_HOME>/plugins/dsh-opencode-session-header.json
The default content is:
{ "enabled": false }
false: Injection is disabled, and request headers remain unchanged.trueor missing file: Injection is enabled.- The plugin reads this file on every LLM request, and changes take effect immediately after modification.
Notes¶
- Version requirement: The plugin has been validated for DSH
0.1.2-rc.1. - Dependency environment: It relies on DSH using the process-global
fetchto forward LLM traffic. If DSH changes its network stack in the future, this plugin may become ineffective. - Retirement plan: When DSH officially supports native per-session header injection (discussion #5495), it is recommended to uninstall this plugin.
Summary¶
This plugin complements DSH’s OpenCode Go requests with the necessary session information by intercepting and modifying HTTP request headers, resolving the reported errors. It does not break existing features, has simple configuration, and is suitable for scenarios where OpenCode Go needs to be used with the current DSH version.
For more details, visit the plugin directory or GitHub repository:
- Plugin Directory
- GitHub Repository