fix(agent): always keep agent when model is explicitly configured

Previously, when an explicit model was configured, the agent name was
omitted to prevent opencode's built-in agent fallback chain from
overriding the user-specified model. This removes that conditional logic
and always passes the agent name alongside the model. Tests are updated
to reflect this behavior change.

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
YeonGyu-Kim
2026-03-25 11:44:01 +09:00
parent bff74f4237
commit 42fb2548d6
6 changed files with 207 additions and 18 deletions
+2 -6
View File
@@ -135,9 +135,7 @@ export async function startTask(
promptWithModelSuggestionRetry(client, {
path: { id: sessionID },
body: {
// When a model is explicitly provided, omit the agent name so opencode's
// built-in agent fallback chain does not override the user-specified model.
...(launchModel ? {} : { agent: input.agent }),
agent: input.agent,
...(launchModel ? { model: launchModel } : {}),
...(launchVariant ? { variant: launchVariant } : {}),
system: input.skillContent,
@@ -222,9 +220,7 @@ export async function resumeTask(
client.session.promptAsync({
path: { id: task.sessionID },
body: {
// When a model is explicitly provided, omit the agent name so opencode's
// built-in agent fallback chain does not override the user-specified model.
...(resumeModel ? {} : { agent: task.agent }),
agent: task.agent,
...(resumeModel ? { model: resumeModel } : {}),
...(resumeVariant ? { variant: resumeVariant } : {}),
tools: {