Preface¶
When running opencode or opencode-go models in DeepSeek Harness (dsh), if the Console Go gateway requires a session header, a common error is 400 MissingSessionID: the request lacks x-opencode-session, preventing the gateway from routing traffic to the node holding the session cache. The pi coding agent includes this header at the provider layer; however, when dsh accesses the same route via @earendil-works/pi-ai, the library side has not yet implemented this header, so the issue often only appears on the dsh side. The following introduces the community plugin dsh-opencode-session (Maintainer: BrackRat, Category: Networking Tools), which automatically completes the session header for relevant requests within the dsh process, restoring behavior similar to the pi side.
What is this¶
dsh-opencode-session is a compatibility plugin bundle for dsh: it does not modify credentials or configuration files on disk. Instead, it wraps the Models prototype of pi-ai via an in-memory llm/stream middleware, injecting x-opencode-session and x-opencode-client: dsh into requests hitting the opencode route. The package version is 0.1.0, licensed under MIT, requiring dsh >= 0.1.5-rc.1 and Node >= 18. The README has been verified against dsh 0.1.5-rc.1 and @earendil-works/pi-ai 0.85.1 (including opencode-go and the openai-completions protocol).
Core Features¶
- Eliminates MissingSessionID: Addresses
400andMissingSessionIDerrors returned by the opencode.ai gateway by completing thex-opencode-sessionon requests initiated by dsh foropencode/opencode-go(and models with base URLs hosted onopencode.ai). - Header Priority: If you have already configured
x-opencode-sessionon the provider or model, your configuration takes precedence; the plugin only fills it in when it is missing. - Controllable Scope: Other providers such as official DeepSeek, Anthropic, and OpenAI are unaffected.
- In-process and Uninstallable: The plugin is normally installed into the profile; no residue remains after uninstallation. The in-memory wrapper is reinstalled at every startup, so dsh upgrades generally require no extra action. If pi-ai natively supports this header in the future, the plugin can be treated as a no-op and removed.
- Fail-Safe: If internal structures change, the plugin logs a warning and backs off without blocking requests.
Installation and Activation¶
Install from GitHub (the currently available method per the README):
dsh plugin --profile web add github:BrackRat/dsh-opencode-session
Available via npm after publication:
dsh plugin --profile web add dsh-opencode-session
Local directory or tarball:
dsh plugin --profile web add /path/to/dsh-opencode
dsh plugin --profile web add ./dsh-opencode-session-0.1.0.tgz
The package declares dsh.bundle. dsh plugin add writes the bundle to dsh.profile.bundles; manual profile editing is usually unnecessary. Restart the dsh process providing the UI (e.g., dsh web) after installation.
Typical Usage and Verification¶
Confirm the plugin is included in the composite configuration:
dsh --profile web --dump-config | grep -A 2 opencode-session-header
The plugin entry should be visible in the output. Then, initiate a conversation with the opencode-go model in the Web UI; it should reply normally instead of showing MissingSessionID.
Uninstallation:
dsh plugin --profile web remove dsh-opencode-session
Use Cases and Notes¶
- Suitable for: Developers using opencode / opencode-go under the dsh
webprofile who are blocked by the gateway’s session header requirement. - Permissions and Security: The plugin runs with the same permissions as the current dsh process and only hooks into the model stream in memory. It is recommended to review the GitHub repository source code and the MIT license before installation to ensure compliance with your requirements.
- Ecosystem Note: The DSH community plugin directory (such as the SkillHub entry) is an independent site and has no official affiliation with DeepSeek / Hithink RoyalFlush; the facts in this article are based on the repository README.
Conclusion¶
dsh-opencode-session uses a single installation command and an in-process middleware approach to patch the missing x-opencode-session when dsh accesses opencode.ai via pi-ai. It is ready to try for 400 MissingSessionID scenarios. Directory page: https://www.skillhub.cn/plugins/BrackRat/dsh-opencode-session; Source code and FAQ: https://github.com/BrackRat/dsh-opencode-session.