Skip to content

[Provider compatibility] Pi native Chat requests still omit OpenCode Go session affinity in 2.46.0 #3857

Description

@makesomethingshit

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:

  1. 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.
  2. 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

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerProvider adapters, OpenAI-compat presets, upstream API quirksprovider-compatibilityProvider compatibility reports

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions