Client or integration
OpenAI-compatible SDK
Provider or upstream service
OpenCode Go (opencode-go), through Pi's generated opencodex provider.
OpenCodex version
2.46.0; also reproduced against dev at 6cf38b5 with a mocked upstream regression test.
Endpoint or capability
POST /v1/chat/completions; per-conversation session affinity.
Current behaviour
Pi 0.84.4 requests to opencode-go/omen-alpha fail with HTTP 400 even after updating and restarting OpenCodex. There are two gaps:
- Native Chat takes the shortcut into
handleNativeChatCompletions before the Responses pipeline's resolveOpenCodeGoTransport call, so no Go session header is generated even when a client sends session_id.
- The generated Pi provider is named
opencodex and points at the local proxy. Pi therefore does not apply its native OpenCode attribution, and session-affinity headers are disabled by default for this custom provider. The generated config does not opt in.
Expected behaviour
Generated Pi integrations should send a stable per-session identifier. Both native Chat and bridged requests to canonical Go destinations should derive a stable opaque x-opencode-session, preserving configured overrides and keeping distinct conversations separate.
Minimal redacted request or reproduction
# With an authenticated OpenCode Go provider configured in OpenCodex:
curl http://127.0.0.1:10100/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'session_id: example-conversation-a' \
-d '{"model":"opencode-go/omen-alpha","messages":[{"role":"user","content":"Coding connectivity check: reply OK."}],"stream":false}'
# This exercises native Chat and still omits the upstream Go header before the fix.
# A generated Pi provider additionally needs compat.sendSessionAffinityHeaders=true
# so that Pi sends session_id to the proxy in the first place.
Actual response or error
Provider error 400: Error from provider (Console Go): Request is missing x-opencode-session and cannot be routed efficiently. Please see https://opencode.ai/docs/go/#where-can-i-use-it
Upstream documentation
https://opencode.ai/docs/go/#where-can-i-use-it
Suggested mapping or implementation notes
Reuse resolveOpenCodeGoTransport before native Chat wire selection; enable Pi's supported compat.sendSessionAffinityHeaders in generated configs. Preserve inbound OpenCode session metadata through the internal Chat-to-Responses bridge, validate/hash it, and scope upstream injection to canonical Go destinations. Do not add a global static session ID.
Additional context and attachments
Related: #3344, #3378, #3405. Those addressed Responses-ingress normalization; this reports the remaining native Chat ingress and generated Pi configuration gaps. The regression test failed with a null session header before the fix. After patching and enabling Pi affinity, an actual Pi SDK request through the local proxy to Omen returned PI_GO_OK.
Checks
Client or integration
OpenAI-compatible SDK
Provider or upstream service
OpenCode Go (
opencode-go), through Pi's generatedopencodexprovider.OpenCodex version
2.46.0; also reproduced against dev at 6cf38b5 with a mocked upstream regression test.
Endpoint or capability
POST /v1/chat/completions; per-conversation session affinity.
Current behaviour
Pi 0.84.4 requests to
opencode-go/omen-alphafail with HTTP 400 even after updating and restarting OpenCodex. There are two gaps:handleNativeChatCompletionsbefore the Responses pipeline'sresolveOpenCodeGoTransportcall, so no Go session header is generated even when a client sendssession_id.opencodexand points at the local proxy. Pi therefore does not apply its native OpenCode attribution, and session-affinity headers are disabled by default for this custom provider. The generated config does not opt in.Expected behaviour
Generated Pi integrations should send a stable per-session identifier. Both native Chat and bridged requests to canonical Go destinations should derive a stable opaque
x-opencode-session, preserving configured overrides and keeping distinct conversations separate.Minimal redacted request or reproduction
Actual response or error
Upstream documentation
https://opencode.ai/docs/go/#where-can-i-use-it
Suggested mapping or implementation notes
Reuse
resolveOpenCodeGoTransportbefore native Chat wire selection; enable Pi's supportedcompat.sendSessionAffinityHeadersin generated configs. Preserve inbound OpenCode session metadata through the internal Chat-to-Responses bridge, validate/hash it, and scope upstream injection to canonical Go destinations. Do not add a global static session ID.Additional context and attachments
Related: #3344, #3378, #3405. Those addressed Responses-ingress normalization; this reports the remaining native Chat ingress and generated Pi configuration gaps. The regression test failed with a null session header before the fix. After patching and enabling Pi affinity, an actual Pi SDK request through the local proxy to Omen returned
PI_GO_OK.Checks