From be8ac25f0e4da63dbb9c6409c8c5fba0ffe30749 Mon Sep 17 00:00:00 2001 From: 4ndreello <4ndreello@users.noreply.github.com> Date: Sat, 19 Sep 2026 13:00:57 -0300 Subject: [PATCH] fix(opencode): Accept nested provider model paths buildArgs rejected any model carrying more than two segments, so opening a session on openrouter/meta/muse-spark-1.3-contributor died before spawn with "must be provider/model". Allow extra slash-separated segments, and keep rejecting empty segments, whitespace and names with no slash at all. Co-Authored-By: Claude --- src/open/launchers/opencode.ts | 2 +- tests/open-opencode.test.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/open/launchers/opencode.ts b/src/open/launchers/opencode.ts index 944fea7..084c924 100644 --- a/src/open/launchers/opencode.ts +++ b/src/open/launchers/opencode.ts @@ -118,7 +118,7 @@ export function buildInlineConfig( }); } -const MODEL_SHAPE = /^[^/\s]+\/[^/\s]+$/; +const MODEL_SHAPE = /^[^/\s]+\/[^/\s]+(?:\/[^/\s]+)*$/; export function buildArgs( role: Role, diff --git a/tests/open-opencode.test.ts b/tests/open-opencode.test.ts index 3be94f5..daa4790 100644 --- a/tests/open-opencode.test.ts +++ b/tests/open-opencode.test.ts @@ -264,6 +264,20 @@ describe("buildArgs", () => { expect(() => buildArgs("general", { model: bad }, [])).toThrow(/must be provider\/model/); } }); + + it.each([ + ["an empty middle segment", "a//b"], + ["a trailing slash after nesting", "a/b/"], + ["whitespace after nesting", "a/b c/d"], + ] as const)("rejects a model with %s before spawn", (_name, model) => { + expect(() => buildArgs("general", { model }, [])).toThrow(/must be provider\/model/); + }); + + it("accepts provider models with nested model paths", () => { + for (const model of ["openrouter/meta/muse-spark-1.3-contributor", "a/b/c/d"]) { + expect(() => buildArgs("general", { model }, [])).not.toThrow(); + } + }); }); describe("opencode theme", () => {