fix(providers): correct opencode-zen muse-spark context length and Responses auth header (#12681, #12633) - #13247
Merged
Conversation
…sponses auth header (#12681, #12633) - Declare the real ~1M contextLength/maxOutputTokens on the muse-spark-1.2 / muse-spark-1.2-contributor-free registry entries (opencode + opencode-zen) instead of silently falling back to the 200000 provider default (#12681). - Send x-api-key instead of Authorization: Bearer for the openai-responses format on the main OpenCode Zen host, fixing a 401 on Muse Spark Contributor's /v1/responses route; scoped by baseUrl so opencode-go (a different upstream) keeps Bearer (#12633).
4 of 5 tasks
This was referenced Sep 15, 2026
Githab-capibara
added a commit
to Githab-capibara/OmniRoute
that referenced
this pull request
Sep 17, 2026
…sponses auth header (diegosouzapw#12681, diegosouzapw#12633) (diegosouzapw#13247) Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit. Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them. - ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on diegosouzapw#13243) - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK - complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline - 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs - `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for diegosouzapw#13278 and diegosouzapw#13276, annotated and landed on diegosouzapw#13243⚠️ base-red inherited: diegosouzapw#12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…sponses auth header (diegosouzapw#12681, diegosouzapw#12633) (diegosouzapw#13247) Merged as part of the 39-PR owner batch of 2026-09-11, validated as a unit. Boarded into one consolidated worktree cut from `release/v3.8.51` with the other 38 — zero conflicts between them. - ESLint over every changed file: no errors (the only finding was one suppression entry the batch emptied, pruned on diegosouzapw#13243) - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK - complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 — both under baseline - 256 assertions green: 246 under node:test and 10 under vitest, which is where `tests/unit/**/*.test.tsx` actually runs - `check-file-size`: `chatCore.ts` rebaselined 6144 → 6146 for diegosouzapw#13278 and diegosouzapw#13276, annotated and landed on diegosouzapw#13243⚠️ base-red inherited: diegosouzapw#12732 — the provider count (356 in the docs vs the 358 the modules define) and `open-sse/utils/stream.ts` at 3115 > frozen 3098 both reproduce on the pure tip with zero contribution from this batch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related, small OpenCode Zen registry/executor bugs fixed together (both files:
open-sse/config/providers/registry/opencode/zen/index.ts/open-sse/config/providers/registry/opencode/index.tsfor #12681,open-sse/executors/opencode.tsfor #12633):Closes #12681
Closes #12633
#12681 — wrong context_length for Muse Spark 1.2 (200000 vs real ~1M)
Root cause:
muse-spark-1.2andmuse-spark-1.2-contributor-freewere declared in theopencodeandopencode-zenregistry entries without their owncontextLength— unlike sibling models in the same list. With no per-model window,contextManager.resolveTokenLimit()fell back to the provider-widedefaultContextLength: 200000.Fix: declared the real window (
contextLength: 1048576,maxOutputTokens: 131072) on both Muse Spark 1.2 entries in both files. This value is not invented — it mirrors the same model family already declared correctly onopencode-go'smuse-spark-1.2-contributor*entries (open-sse/config/providers/registry/opencode/go/index.ts), which are exercised by existing tests (tests/unit/opencode-go-catalog-alignment.test.ts).Regression test:
tests/unit/issue-12681-opencode-muse-spark-context.test.tsmuse-spark-1.2/-contributor-freehadcontextLength === undefinedin both registries;getTokenLimit("opencode", "muse-spark-1.2-contributor-free")resolved to200000.contextLength: 1048576;getTokenLimit()resolves to1048576on bothopencodeandopencode-zen.Note: the plan-file also flagged a second, architecturally larger bug — vendor-prefixed passthrough ids reached through
nous-research/kilocode(e.g.poolside/laguna-s-2.1) not cross-referencing the vendor's own registry entry incontextManager.resolveTokenLimit(). That is a separate, larger design change (a new cross-reference resolution step) that is out of scope for this small, TDD-scoped fix and is not addressed here.#12633 — OpenCode Zen Responses models reject the OmniRoute auth header
Root cause:
OpencodeExecutor.buildHeaders()only special-casedx-api-keyfor_requestFormat === "claude"; every other format — including"openai-responses", used by Muse Spark Contributor models routed to/v1/responses— fell through toAuthorization: Bearer <key>. OpenCode Zen's/v1/responsesendpoint actually requiresx-api-key, matching the reporter's live upstream 401.Fix: added a
usesZenApiKeyAuth()helper that also emitsx-api-keywhen_requestFormat === "openai-responses"and the executor'sbaseUrlis the main Zen host (https://opencode.ai/zen/v1, shared by theopencodeandopencode-zenregistry entries). Scoped bybaseUrlrather than provider id/alias soopencode-go— a separate upstream (https://opencode.ai/zen/go/v1) that already works withBearerfor its own Responses-routed models (grok-4.5, deepseek-v4-pro, muse-spark-1.2-contributor) — is unaffected.Regression test:
tests/unit/issue-12633-opencode-zen-responses-auth.test.tsopenai-responsesformat onopencode/opencode-zensentAuthorization: Bearer, nox-api-key.x-api-key, noAuthorization;opencode-go(negative control, different upstream) still correctly sendsAuthorization: Bearer;claudeformat behavior unchanged.Scope note: the plan-file's open "Scope Question" (is
x-api-keyrequired only for Muse Contributor, or every Zen Responses model?) is answered by scoping to the whole Zen host rather than guessing per-model — any current or future model routed toopenai-responseson the main Zen host now gets the correct header, without touchingopencode-go. The plan-file's secondary checkbox (addingmuse-spark-1.3/muse-spark-1.3-contributor-freeregistry entries) is not included here — that model's real capability metadata is unconfirmed and is already the subject of a separate open contributor PR (#12675, opencode-go's 1.3 registration), so adding it here as well would risk a conflicting/duplicate registration.Gates run
node --import tsx/esm --test tests/unit/issue-12681-opencode-muse-spark-context.test.ts tests/unit/issue-12633-opencode-zen-responses-auth.test.ts— 7/7 passnode scripts/check/check-file-size.mjs— OKnode scripts/check/check-complexity.mjs— OK (2798 vs baseline 3218)node scripts/check/check-cognitive-complexity.mjs— OK (1265 vs baseline 1437)npm run typecheck:core— exit 0npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files>— exit 0node scripts/check/check-changelog-integrity.mjs— OK