Skip to content

fix(executors): synthesize x-opencode-request for custom-named OpenCode providers (#4465) - #4476

Merged
diegosouzapw merged 1 commit into
release/v3.8.32from
fix/4465-opencode-headers
Jun 21, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.32from
fix/4465-opencode-headers

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #4465

Problem

The OpenCode CLI only emits the x-opencode-* header set when the provider id starts with opencode. For a custom-named provider (e.g. omniroute) it instead sends x-session-affinity / x-session-id — which #4022 already maps onto x-opencode-session — but it sends no equivalent for x-opencode-request, so that request-correlation id was silently dropped, putting custom-named-provider users at a disadvantage on the opencode.ai upstream.

Fix

OpencodeExecutor.buildHeaders now synthesizes a fresh x-opencode-request (via randomUUID()) only on the session-affinity fallback path (i.e. exactly the custom-named-provider case), and only when the client did not already send one.

Intentionally scoped

  • x-opencode-client / x-opencode-project are not fabricated. There is no client source to forward for custom-named providers, and their valid values are opencode-internal — inventing them risks upstream rejection (and is unverifiable by a unit test, per Hard Rule fix(ci): add environment for npm token access #18). They remain forward-only (preserved when the client does send them).
  • The direct OpenCode CLI path (provider id starts with opencode, which controls its own request id) is untouched.
  • DefaultExecutor is untouched (avoids leaking synthesized metadata to arbitrary third-party upstreams).

Tests (TDD, RED→GREEN)

Added 6 cases to tests/unit/opencode-executor.test.ts (opencode request-id synthesis for custom-named providers (#4465)):

  • synthesizes x-opencode-request when only session-affinity is present (RED before fix)
  • synthesizes a unique id per call (RED before fix)
  • prefers a client-sent x-opencode-request over the synthesized one
  • does not fabricate x-opencode-client / x-opencode-project
  • does not synthesize on the direct x-opencode-session path
  • opencode-go executor also synthesizes on the fallback path (RED before fix)

node --test opencode-executor.test.ts → 45/45 pass. typecheck:core clean. ESLint 0 errors (no new warnings).

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw
diegosouzapw merged commit b4dbf7b into release/v3.8.32 Jun 21, 2026
4 checks passed
@diegosouzapw
diegosouzapw deleted the fix/4465-opencode-headers branch June 21, 2026 12:33
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
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