diff --git a/src/providers/registry.ts b/src/providers/registry.ts index 91405ca8d70..a8cca878289 100644 --- a/src/providers/registry.ts +++ b/src/providers/registry.ts @@ -1442,6 +1442,10 @@ export const PROVIDER_REGISTRY: readonly ProviderRegistryEntry[] = [ // The DeepSeek vision preview id is metadata-only here: the Go roster is // discovered live, so it applies the moment the gateway serves the id. [DEEPSEEK_VISION_PREVIEW_MODEL]: 1_048_576, + // Muse Spark 1.2 Contributor serves a 1,048,576-token (1M) context window over + // /responses on Zen Go, matching its 1.1 sibling (Meta developer docs, verified 2026-08-28). + // Without this declaration the catalog falls back to 128k, capping real usable context. + "muse-spark-1.2-contributor": 1_048_576, }, modelInputModalities: { "kimi-k3": ["text", "image"], diff --git a/tests/opencode-go-muse-context.test.ts b/tests/opencode-go-muse-context.test.ts new file mode 100644 index 00000000000..a387696d71f --- /dev/null +++ b/tests/opencode-go-muse-context.test.ts @@ -0,0 +1,54 @@ +/** + * OpenCode Go Muse Spark 1.2 Contributor context window regression. + * + * Muse Spark serves a 1,048,576-token (1M) context window over /responses on Zen Go, + * matching its 1.1 sibling. The registry declared no modelContextWindows entry, so the + * catalog fell back to the 128k unknown-window default and the Codex app capped real + * usable context well below what the model supports. These tests lock the declaration + * in and prove the catalog advertises the full 1M window for Muse. + */ +import { describe, expect, test } from "bun:test"; +import { applyProviderConfigHints } from "../src/codex/catalog"; +import { getProviderRegistryEntry, PROVIDER_REGISTRY } from "../src/providers/registry"; +import { providerConfigSeed } from "../src/providers/derive"; +import type { OcxProviderConfig } from "../src/types"; + +const MUSE_MODEL = "muse-spark-1.2-contributor"; +const MUSE_CONTEXT = 1_048_576; + +/** Seeded OpenCode Go provider config for the Muse Spark context assertions. */ +function opencodeGo(): OcxProviderConfig { + const entry = getProviderRegistryEntry("opencode-go"); + if (!entry) throw new Error("missing opencode-go registry fixture"); + return { ...providerConfigSeed(entry), apiKey: "test-key" }; +} + +describe("OpenCode Go Muse Spark context window", () => { + test("registry declares the 1M context window for Muse", () => { + const entry = PROVIDER_REGISTRY.find(e => e.id === "opencode-go"); + expect(entry?.modelContextWindows?.[MUSE_MODEL]).toBe(MUSE_CONTEXT); + }); + + test("the registry seed carries the 1M context window for Muse", () => { + const prov = opencodeGo(); + expect(prov.modelContextWindows?.[MUSE_MODEL]).toBe(MUSE_CONTEXT); + }); + + test("applyProviderConfigHints exposes the 1M context window for Muse", () => { + const prov = opencodeGo(); + const hinted = applyProviderConfigHints("opencode-go", prov, { + id: MUSE_MODEL, + provider: "opencode-go", + }); + expect(hinted.contextWindow).toBe(MUSE_CONTEXT); + }); + + test("a discovered row with no window inherits the configured 1M window", () => { + const prov = opencodeGo(); + const hinted = applyProviderConfigHints("opencode-go", prov, { + id: MUSE_MODEL, + provider: "opencode-go", + }); + expect(hinted.contextWindow).toBe(MUSE_CONTEXT); + }); +});