Skip to content

fix(opencode): send conversation-scoped session headers - #3875

Draft
amitksingh1490 wants to merge 3 commits into
mainfrom
fix/3866-opencode-session
Draft

amitksingh1490 wants to merge 3 commits into
mainfrom
fix/3866-opencode-session

Conversation

@amitksingh1490

@amitksingh1490 amitksingh1490 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Refs #3866.

  • Send x-opencode-session using the existing Context.conversation_id for OpenCode Go and Zen. Attach it only to the provider clone for the current chat request, never to saved/shared provider configuration. Repeated turns, retries with the same context, and resumed conversations retain their ID; unrelated conversations do not share one.
  • Replace stale case-insensitive session overrides while preserving other custom headers. Standalone calls with no conversation ID get an independent UUID; auxiliary calls with existing context IDs retain those IDs.
  • Forward provider custom headers through the Anthropic, Google, and Responses adapters, matching Chat Completions behavior. Preserve the full OpenCode Go Responses endpoint path, like Zen, rather than rewriting it to the host's /v1/responses.
  • Add transport-boundary regressions for both OpenCode providers across all four adapters, interleaved/repeated conversations, independent standalone requests, source-provider immutability, and non-OpenCode isolation. The regression caught missing Responses header forwarding and Go endpoint-prefix loss during development; expectations were retained while fixing production paths.

Local verification

All Cargo commands use the debug/test profiles, with debug symbols and incremental compilation disabled to conserve disk, plus explicit local PROTOC/OpenSSL paths.

  • cargo test --locked -p forge_repo: 336 passed, 1 pre-existing ignored test.
  • cargo clippy --locked -p forge_repo --all-targets -- -D warnings.
  • cargo build --locked -p forge_main (debug).
  • cargo insta test --accept --test-runner cargo-test -p forge_repo; no snapshot changes.
  • Changed-file rustfmt --check and git diff --check.
  • Built forge --help, then safe noninteractive -p against a local HTTP/SSE fixture. Verified actual assistant output, captured nonempty session headers, same ID when resuming, and a different ID for a new conversation. Auxiliary title calls also carry nonempty session IDs. No user conversation was modified.

Draft: outstanding verification

  • Authenticated OpenCode Go verification is blocked. The isolated real-provider -p attempt exited 0 but printed Provider OpenCode Go is not available. Login again to configure it. There was no successful provider response; exit status alone is NOT considered a smoke-test pass. A valid subscribed OpenCode Go login is needed before this is ready for review.
  • The initial four-file implementation left pre-existing workspace formatting untouched. Repository autofix.ci subsequently added commits 2f0abbc38 and fd64798ca: comment/doc reflow across 140 files, plus an equivalent boolean-return simplification and its formatting in forge_services/src/fd.rs. These automated changes were reviewed and preserved with their bot attribution; no OpenCode behavior was changed by them.
  • Latest-head GitHub CI reviewed at fd64798ca (2026-09-16 03:35 UTC): Build and Test, Lint Fix, and Performance: zsh rprompt all passed. Release jobs are skipped as expected for the draft. After reviewing both autofix commits, local forge_repo tests (336 passed, 1 ignored), debug forge_main build, and the actual HTTP/SSE new/resume/new CLI smoke also passed again on this head. Only authenticated live OpenCode Go verification remains blocked; this is still a draft, not a live-provider compatibility claim.

Co-Authored-By: ForgeCode noreply@forgecode.dev

Forward request-local session headers across OpenCode adapters and preserve the Go Responses endpoint. Add transport-level coverage for stable, isolated conversation IDs.

Co-Authored-By: ForgeCode <noreply@forgecode.dev>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Sep 16, 2026
@amitksingh1490 amitksingh1490 changed the title fix: propagate conversation sessions across opencode adapters fix(opencode): send conversation-scoped session headers Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants