Skip to content

fix(llm): send Harness session headers through pi-ai - #329

Open
fzfz wants to merge 1 commit into
dataelement:mainfrom
fzfz:codex/upstream-opencode-session-headers
Open

fix(llm): send Harness session headers through pi-ai#329
fzfz wants to merge 1 commit into
dataelement:mainfrom
fzfz:codex/upstream-opencode-session-headers

Conversation

@fzfz

@fzfz fzfz commented Sep 7, 2026

Copy link
Copy Markdown

OpenCode Go rejects model calls with 400 MissingSessionID because the pi-ai adapter passes sessionId to the SDK without emitting a session header. Add the Harness-native x-deepseek-harness-session-id header from each call's session ID, matching the DeepSeek adapter and the header OpenCode Go recognizes.

The current session ID overrides any configured value for x-deepseek-harness-session-id, regardless of header-name casing. Unrelated request headers remain intact, and calls without a session ID do not receive a generated ID.

Validation:

  • All nine session-header and provider-error tests passed on this upstream branch. The seven session-header tests exercise the real PiAiAdapter across OpenAI Completions, Anthropic Messages, and OpenAI Responses.
  • Tests cover repeated/prepared calls, concurrent parent/child sessions, numeric IDs, conflicting configured session headers, and missing IDs.
  • Type checking and git diff --check passed; the patch reverse-application check passed against the installed package.
  • The upstream full suite passed 718 tests; two PPT suites could not load because the reused development dependencies do not contain dsh-ppt. On the fork baseline, the full suite passed all 724 tests.
  • A real OpenCode Go deepseek-v4-flash request returned OK with a successful stop after applying the patch.

Provider requirements: https://opencode.ai/docs/go/#where-can-i-use-it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant