[Bug] llm-pi-ai/opencode-go: missing x-opencode-session header and deepseek-v4.1-flash catalog entry #6224
Replies: 5 comments
|
Both defects verified against master (c291e79) and the vendored pi-ai 0.85.1 — they are exactly as you describe, and neither is fixed.
Workarounds without patching:
Your fork branch (fix/llm-pi-ai-opencode-go) is the correct upstream shape; with PRs closed on this repo, the discussion is the right channel, and I'll flag both defects for maintainer attention. |
|
Additional validation on Windows with DSH 0.1.5-rc.1 and @earendil-works/pi-ai 0.85.1:
This validates a local patch of the installed release, not a build of the linked reference branch. No credentials, local configuration, or session logs are attached. |
|
Independent confirmation from a Windows box, plus a user-level interim workaround that needs no fork or build. Nothing here contradicts the reference branch — it corroborates it and flags one gap that the two-patch fix pair does not close. Environment and validation
Live before/after (not just code inspection)Direct
Through the harness itself (
So the header is the sole discriminator, and any stable opaque per-conversation value is accepted — no particular format is required. Interim workaround for users on published buildsThe identity is already inside the adapter: Applied as a local patch to the bundled Honest costs: it is unsupported, it must be re-applied after every upgrade, and it cannot help with defect 2. A gap the fix pair does not coverDefect 2 is currently addressed by a pnpm patch that adds the flattened catalog entry. That works, but the reason a patch is needed at all is that model discovery never interrogates a route pi-ai ships a catalog for: For reference, my local patch skips that short-circuit for OpenCode routes only: query And even with live discovery there is a structural blocker to "discovered ⇒ usable": in Cross-referencing the discovery side in #5654. |
|
Thanks to both of you — two independent live validations (JTropy's Web UI smoke test, and the 3/3 before/after against the real gateway) plus the tarball check that 0.1.5-rc.2 still ships the unfixed adapter is exactly the evidence this thread needed. The header being the sole discriminator — any stable opaque per-conversation value accepted — also confirms the fix doesn't depend on a particular format. The gap you flagged is real; I verified both halves against source at c291e79:
Your local patch's shape (skip the short-circuit for OpenCode routes only, take the baseUrl from an openai-completions catalog entry, fall back to the catalog list when the endpoint is unreachable, leave other providers untouched) is the right scoped form of that. I also fetched GET https://opencode.ai/zen/go/v1/models just now: 37 ids, deepseek-v4.1-flash present — your count is exact. This thread now carries: verified defects, a reference branch (fix/llm-pi-ai-opencode-go), two independent user-level workarounds, and the discovery-side gap. That's a complete package for maintainers to pick up; I'll keep flagging it. |
|
Confirmed independently on Windows (dsh 1. llm-pi-ai:
providers:
opencode-go:
apiKeyEnv: OPENCODE_GO_API_KEY
headers:
x-opencode-session: <one stable uuid per install>
x-deepseek-harness-session-id: <same uuid> # DSH's native headerOne caveat for whoever applies this: 2. Missing
Status of the upstream data (good news): pi-ai regenerates that catalog from models.dev at publish time, and models.dev's Verified after applying both parts and restarting dsh: a single |
Uh oh!
There was an error while loading. Please reload this page.
Environment: dsh 0.1.5-rc.2,
llm-pi-aiwith theopencode-goprovider route (user settings), modeldeepseek-v4.1-flash.Two defects on the same provider route; both are fixed in a reference branch linked below.
1. Every opencode-go request is refused with 400
MissingSessionIDOpenCode Go routes and prompt-caches per conversation on a stable
x-opencode-sessionheader and answers requests without it with:@earendil-works/pi-ai0.85.1 never sends the header: itssessionIdoption maps only to the affinity headers that a model's compat flags name (sendSessionAffinityHeaders), and the opencode-go catalog entries set none of them. OpenCode's docs currently list DeepSeek Harness among clients whose session support is incomplete.Fix approach: derive
x-opencode-sessionfrom the seam'sGenerateOptions.sessionIdin the llm-pi-ai adapter. Main, compaction, and session-title calls all already stamp the session identity, so one conversation sends one stable value; a deployment-configured header wins case-insensitively, and a request without a session id sends none.2.
deepseek-v4.1-flashis not selectablemodels.dev registered
deepseek-v4.1-flash, but pi-ai 0.85.1's generated opencode-go catalog predates it, so the model is absent from every selector. Fix approach: a pnpm patch adds the flattened catalog entry (mirroringdeepseek-v4-flash-vision-exp) plus a guard test that fails, naming the patch, until a pi-ai release ships the model and the patch can be dropped.Reference implementation
Both fixes with tests are on a branch in my fork, two commits on top of current
master: archiforge/deepseek-harness@master...mohamed-bashir-dev:deepseek-harness:fix/llm-pi-ai-opencode-goThe adapter spec covers sending the derived header on
opencode-go, absence on another provider, the case-insensitive deployment override, and absence when the request names no session; the catalog guard spec covers the patched entry. Understood that external PRs are closed for now — happy to rework or hand this over in whatever form is useful.All reactions