fix(opencode-go): route every responses-only model (incl. thinking variants) to /responses

Derive responses-only routing from the model registry's targetFormat instead of hardcoding model checks, and strip thinking suffixes when looking up models in providerModels so variants like gpt-5.6-luna(high) are routed correctly to /responses.
This commit is contained in:
Ridho Perdana
2026-09-17 17:59:45 +07:00
parent 912ed295db
commit 702b57c30d
4 changed files with 41 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { PROVIDER_MODELS, getModelSupportedFormats } from "../../open-sse/config/providerModels.js";
import { PROVIDER_MODELS, getModelSupportedFormats, getModelTargetFormat } from "../../open-sse/config/providerModels.js";
import { PROVIDERS } from "../../open-sse/config/providers.js";
import { resolveTransport } from "../../open-sse/services/provider.js";
@@ -37,6 +37,18 @@ describe("OpenCode Go model catalog", () => {
});
});
describe("OpenCode Go thinking-suffix model lookup", () => {
it("preserves Responses routing for gpt-5.6-luna thinking variants", () => {
expect(getModelSupportedFormats("opencode-go", "gpt-5.6-luna(high)")).toEqual(["openai-responses"]);
expect(getModelTargetFormat("opencode-go", "gpt-5.6-luna(high)")).toBe("openai-responses");
});
it("preserves Responses routing for grok-4.6 thinking variants", () => {
expect(getModelSupportedFormats("opencode-go", "grok-4.6(high)")).toEqual(["openai-responses"]);
expect(getModelTargetFormat("opencode-go", "grok-4.6(high)")).toBe("openai-responses");
});
});
describe("OpenCode Go per-model supportedFormats", () => {
it("declares [openai, claude] for MiniMax + Qwen models", () => {
for (const m of CLAUDE_CAPABLE) {

View File

@@ -48,6 +48,22 @@ describe("ocg/muse-spark-1.3-contributor catalog", () => {
});
describe("OpenCodeGoExecutor routing + sanitization", () => {
it("routes gpt-5.6-luna to /responses", () => {
const ex = new OpenCodeGoExecutor();
expect(ex.buildUrl("gpt-5.6-luna")).toBe("https://opencode.ai/zen/go/v1/responses");
expect(ex.buildUrl("gpt-5.6-luna(high)", true, 0, {
runtimeTransport: { baseUrl: "https://opencode.ai/zen/go/v1/chat/completions" },
})).toBe("https://opencode.ai/zen/go/v1/responses");
});
it("routes every responses-only registry model (grok-4.6) to /responses", () => {
const ex = new OpenCodeGoExecutor();
expect(ex.buildUrl("grok-4.6")).toBe("https://opencode.ai/zen/go/v1/responses");
expect(ex.buildUrl("grok-4.6(high)", true, 0, {
runtimeTransport: { baseUrl: "https://opencode.ai/zen/go/v1/chat/completions" },
})).toBe("https://opencode.ai/zen/go/v1/responses");
});
it("is wired for opencode-go and routes muse-spark to /responses", () => {
expect(getExecutor("opencode-go")).toBeInstanceOf(OpenCodeGoExecutor);
const ex = new OpenCodeGoExecutor();