From 0f112abf55e71f0201d713361a24e9763694343e Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Tue, 17 Mar 2026 20:31:17 -0400 Subject: [PATCH] fix: remove model:inherit from OpenCode agent conversion (#1156) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenCode does not recognize 'model: inherit' as a valid model identifier — it throws ProviderModelNotFoundError when spawning any GSD subagent. Changes: - Remove 'model: inherit' injection for OpenCode agents in install.js - Strip 'model:' field entirely during OpenCode frontmatter conversion (OpenCode uses its configured default model when no model is specified) - Update tests to verify model: inherit is NOT added This fixes all 15 GSD agent definitions and the gsd-set-profile command for OpenCode users. Fixes #1156 --- bin/install.js | 11 ++++++++++- tests/runtime-converters.test.cjs | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bin/install.js b/bin/install.js index c79642a02..819e531e5 100755 --- a/bin/install.js +++ b/bin/install.js @@ -1228,6 +1228,13 @@ function convertClaudeToOpencodeFrontmatter(content, { isAgent = false } = {}) { continue; } + // Strip model: field — OpenCode doesn't support Claude Code model aliases + // like 'haiku', 'sonnet', 'opus', or 'inherit'. Omitting lets OpenCode use + // its configured default model. See #1156. + if (trimmed.startsWith('model:')) { + continue; + } + // Convert color names to hex for opencode (commands only; agents strip color above) if (trimmed.startsWith('color:')) { const colorValue = trimmed.substring(6).trim().toLowerCase(); @@ -1264,8 +1271,10 @@ function convertClaudeToOpencodeFrontmatter(content, { isAgent = false } = {}) { } // For agents: add required OpenCode agent fields + // Note: Do NOT add 'model: inherit' — OpenCode does not recognize the 'inherit' + // keyword and throws ProviderModelNotFoundError. Omitting model: lets OpenCode + // use its default model for subagents. See #1156. if (isAgent) { - newLines.push('model: inherit'); newLines.push('mode: subagent'); } diff --git a/tests/runtime-converters.test.cjs b/tests/runtime-converters.test.cjs index 6491d9376..5da337310 100644 --- a/tests/runtime-converters.test.cjs +++ b/tests/runtime-converters.test.cjs @@ -5,6 +5,8 @@ * Larger runtime test suites (Copilot, Codex, Antigravity) have their own files. * * OpenCode: convertClaudeToOpencodeFrontmatter (agent + command modes) + * model: inherit is NOT added (OpenCode doesn't support it — see #1156) + * but mode: subagent IS added (required by OpenCode agents). * Gemini: convertClaudeToGeminiAgent (frontmatter + tool mapping + body escaping) */ @@ -56,10 +58,10 @@ describe('OpenCode agent conversion (isAgent: true)', () => { assert.ok(frontmatter.includes('name: gsd-executor'), 'name: should be preserved for agents'); }); - test('adds model: inherit', () => { + test('does not add model: inherit (OpenCode does not support it)', () => { const result = convertClaudeToOpencodeFrontmatter(SAMPLE_AGENT, { isAgent: true }); const frontmatter = result.split('---')[1]; - assert.ok(frontmatter.includes('model: inherit'), 'model: inherit should be added'); + assert.ok(!frontmatter.includes('model: inherit'), 'model: inherit should NOT be added — OpenCode throws ProviderModelNotFoundError'); }); test('adds mode: subagent', () => {