fix(background-agent): switch session.prompt to promptAsync

This commit is contained in:
Peïo Thibault 2026-02-07 13:42:20 +01:00
parent 108e860ddd
commit 5f21ddf473
3 changed files with 6 additions and 6 deletions

View File

@ -310,7 +310,7 @@ export class BackgroundManager {
promptLength: input.prompt.length, promptLength: input.prompt.length,
}) })
// Use prompt() instead of promptAsync() to properly initialize agent loop (fire-and-forget) // Fire-and-forget prompt via promptAsync (no response body needed)
// Include model if caller provided one (e.g., from Sisyphus category configs) // 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 // 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" } // OpenCode's PromptInput schema expects: { model: { providerID, modelID }, variant: "max" }
@ -571,7 +571,7 @@ export class BackgroundManager {
promptLength: input.prompt.length, promptLength: input.prompt.length,
}) })
// Use prompt() instead of promptAsync() to properly initialize agent loop // Fire-and-forget prompt via promptAsync (no response body needed)
// Include model if task has one (preserved from original launch with category config) // 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) // variant must be top-level in body, not nested inside model (OpenCode PromptInput schema)
const resumeModel = existingTask.model const resumeModel = existingTask.model
@ -579,7 +579,7 @@ export class BackgroundManager {
: undefined : undefined
const resumeVariant = existingTask.model?.variant const resumeVariant = existingTask.model?.variant
this.client.session.prompt({ this.client.session.promptAsync({
path: { id: existingTask.sessionID }, path: { id: existingTask.sessionID },
body: { body: {
agent: existingTask.agent, agent: existingTask.agent,
@ -1198,7 +1198,7 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
}) })
try { try {
await this.client.session.prompt({ await this.client.session.promptAsync({
path: { id: task.parentSessionID }, path: { id: task.parentSessionID },
body: { body: {
noReply: !allComplete, noReply: !allComplete,

View File

@ -240,7 +240,7 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
}) })
try { try {
await client.session.prompt({ await client.session.promptAsync({
path: { id: task.parentSessionID }, path: { id: task.parentSessionID },
body: { body: {
noReply: !allComplete, noReply: !allComplete,

View File

@ -221,7 +221,7 @@ export async function resumeTask(
: undefined : undefined
const resumeVariant = task.model?.variant const resumeVariant = task.model?.variant
client.session.prompt({ client.session.promptAsync({
path: { id: task.sessionID }, path: { id: task.sessionID },
body: { body: {
agent: task.agent, agent: task.agent,