From baf6358736c732b80227a528ea08f21865a9f812 Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Tue, 27 Jan 2026 16:49:03 +0900 Subject: [PATCH] fix(background-agent): pass variant as top-level field in prompt body --- src/features/background-agent/manager.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/features/background-agent/manager.ts b/src/features/background-agent/manager.ts index 9ff7f254..4545050f 100644 --- a/src/features/background-agent/manager.ts +++ b/src/features/background-agent/manager.ts @@ -297,11 +297,19 @@ export class BackgroundManager { // Use prompt() instead of promptAsync() to properly initialize agent loop (fire-and-forget) // Include model if caller provided one (e.g., from Sisyphus category configs) + // IMPORTANT: variant must be a top-level field in the body, NOT nested inside model + // OpenCode's PromptInput schema expects: { model: { providerID, modelID }, variant: "max" } + const launchModel = input.model + ? { providerID: input.model.providerID, modelID: input.model.modelID } + : undefined + const launchVariant = input.model?.variant + this.client.session.prompt({ path: { id: sessionID }, body: { agent: input.agent, - ...(input.model ? { model: input.model } : {}), + ...(launchModel ? { model: launchModel } : {}), + ...(launchVariant ? { variant: launchVariant } : {}), system: input.skillContent, tools: { ...getAgentToolRestrictions(input.agent), @@ -545,11 +553,18 @@ export class BackgroundManager { // Use prompt() instead of promptAsync() to properly initialize agent loop // Include model if task has one (preserved from original launch with category config) + // variant must be top-level in body, not nested inside model (OpenCode PromptInput schema) + const resumeModel = existingTask.model + ? { providerID: existingTask.model.providerID, modelID: existingTask.model.modelID } + : undefined + const resumeVariant = existingTask.model?.variant + this.client.session.prompt({ path: { id: existingTask.sessionID }, body: { agent: existingTask.agent, - ...(existingTask.model ? { model: existingTask.model } : {}), + ...(resumeModel ? { model: resumeModel } : {}), + ...(resumeVariant ? { variant: resumeVariant } : {}), tools: { ...getAgentToolRestrictions(existingTask.agent), task: false,