refactor(task): align continuation ids with task_id
This commit is contained in:
@@ -3,6 +3,8 @@ import type { ExecutorContext, ParentContext } from "./executor-types"
|
||||
import { publishToolMetadata } from "../../features/tool-metadata-store"
|
||||
import { formatDetailedError } from "./error-formatting"
|
||||
import { getSessionTools } from "../../shared/session-tools-store"
|
||||
import { buildTaskMetadataBlock } from "../../features/tool-metadata-store/task-metadata-contract"
|
||||
import { getTaskID } from "./task-id"
|
||||
|
||||
export async function executeBackgroundContinuation(
|
||||
args: DelegateTaskArgs,
|
||||
@@ -13,8 +15,13 @@ export async function executeBackgroundContinuation(
|
||||
const { manager } = executorCtx
|
||||
|
||||
try {
|
||||
const taskID = getTaskID(args)
|
||||
if (!taskID) {
|
||||
throw new Error("task_id is required to continue a background task")
|
||||
}
|
||||
|
||||
const task = await manager.resume({
|
||||
sessionId: args.session_id!,
|
||||
sessionId: taskID,
|
||||
prompt: args.prompt,
|
||||
parentSessionID: parentContext.sessionID,
|
||||
parentMessageID: parentContext.messageID,
|
||||
@@ -31,6 +38,8 @@ export async function executeBackgroundContinuation(
|
||||
load_skills: args.load_skills,
|
||||
description: args.description,
|
||||
run_in_background: args.run_in_background,
|
||||
taskId: task.sessionID,
|
||||
backgroundTaskId: task.id,
|
||||
sessionId: task.sessionID,
|
||||
command: args.command,
|
||||
model: task.model ? { providerID: task.model.providerID, modelID: task.model.modelID } : undefined,
|
||||
@@ -50,14 +59,17 @@ System notifies on completion. Use \`background_output\` with task_id="${task.id
|
||||
|
||||
Do NOT call background_output now. Wait for <system-reminder> notification first.
|
||||
|
||||
<task_metadata>
|
||||
session_id: ${task.sessionID}
|
||||
${task.agent ? `subagent: ${task.agent}\n` : ""}</task_metadata>`
|
||||
${buildTaskMetadataBlock({
|
||||
sessionId: task.sessionID,
|
||||
taskId: task.sessionID,
|
||||
backgroundTaskId: task.id,
|
||||
agent: task.agent,
|
||||
})}`
|
||||
} catch (error) {
|
||||
return formatDetailedError(error, {
|
||||
operation: "Continue background task",
|
||||
args,
|
||||
sessionID: args.session_id,
|
||||
sessionID: getTaskID(args),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user