fix(delegate-task): apply load_skills content to continuation prompts
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -11,7 +11,8 @@ export async function executeBackgroundContinuation(
|
||||
args: DelegateTaskArgs,
|
||||
ctx: ToolContextWithMetadata,
|
||||
executorCtx: ExecutorContext,
|
||||
parentContext: ParentContext
|
||||
parentContext: ParentContext,
|
||||
systemContent?: string
|
||||
): Promise<string> {
|
||||
const { manager } = executorCtx
|
||||
const taskID = getTaskID(args)
|
||||
@@ -21,9 +22,13 @@ export async function executeBackgroundContinuation(
|
||||
throw new Error("task_id is required to continue a background task")
|
||||
}
|
||||
|
||||
const effectivePrompt = systemContent
|
||||
? `${systemContent}\n\n${args.prompt}`
|
||||
: args.prompt
|
||||
|
||||
const task = await manager.resume({
|
||||
sessionId: taskID,
|
||||
prompt: args.prompt,
|
||||
prompt: effectivePrompt,
|
||||
parentSessionID: parentContext.sessionID,
|
||||
parentMessageID: parentContext.messageID,
|
||||
parentModel: parentContext.model,
|
||||
@@ -70,12 +75,12 @@ ${buildTaskMetadataBlock({
|
||||
taskId: sessionId,
|
||||
backgroundTaskId,
|
||||
agent: task.agent,
|
||||
category: task.category,
|
||||
})}`
|
||||
} catch (error) {
|
||||
return formatDetailedError(error, {
|
||||
operation: "Continue background task",
|
||||
args,
|
||||
category: task.category,
|
||||
sessionID: taskID,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ export async function executeSyncContinuation(
|
||||
ctx: ToolContextWithMetadata,
|
||||
executorCtx: ExecutorContext,
|
||||
parentContext: ParentContext,
|
||||
deps: SyncContinuationDeps = syncContinuationDeps
|
||||
deps: SyncContinuationDeps = syncContinuationDeps,
|
||||
systemContent?: string
|
||||
): Promise<string> {
|
||||
const { client, syncPollTimeoutMs, sisyphusAgentConfig } = executorCtx
|
||||
const toastManager = getTaskToastManager()
|
||||
@@ -73,11 +74,11 @@ export async function executeSyncContinuation(
|
||||
resumeVariant = resumeMessageModel?.variant
|
||||
}
|
||||
|
||||
const syncContMeta = {
|
||||
const resumeModelForMetadata = resumeModel && resumeVariant !== undefined
|
||||
? { ...resumeModel, variant: resumeVariant }
|
||||
: resumeModel
|
||||
|
||||
const syncContMeta = {
|
||||
title: `Continue: ${args.description}`,
|
||||
metadata: {
|
||||
prompt: args.prompt,
|
||||
@@ -113,6 +114,7 @@ export async function executeSyncContinuation(
|
||||
...(resumeAgent !== undefined ? { agent: resumeAgent } : {}),
|
||||
...(resumeModel !== undefined ? { model: resumeModel } : {}),
|
||||
...(resumeVariant !== undefined ? { variant: resumeVariant } : {}),
|
||||
system: systemContent,
|
||||
tools,
|
||||
parts: [{ type: "text", text: effectivePrompt }],
|
||||
},
|
||||
@@ -154,9 +156,9 @@ ${buildTaskMetadataBlock({
|
||||
sessionId: continuationID,
|
||||
taskId: continuationID,
|
||||
agent: resumeAgent,
|
||||
category: args.category,
|
||||
})}`
|
||||
} finally {
|
||||
category: args.category,
|
||||
if (toastManager) {
|
||||
toastManager.removeTask(taskId)
|
||||
}
|
||||
|
||||
@@ -53,13 +53,20 @@ export function createDelegateTask(options: DelegateTaskToolOptions): ToolDefini
|
||||
return skillError
|
||||
}
|
||||
|
||||
const continuationSystemContent = buildSystemContent({
|
||||
skillContent,
|
||||
skillContents,
|
||||
availableCategories,
|
||||
availableSkills,
|
||||
})
|
||||
|
||||
const parentContext = await resolveParentContext(ctx, options.client)
|
||||
|
||||
if (delegateTaskArgs.task_id) {
|
||||
if (runInBackground) {
|
||||
return executeBackgroundContinuation(delegateTaskArgs, ctx, options, parentContext)
|
||||
return executeBackgroundContinuation(delegateTaskArgs, ctx, options, parentContext, continuationSystemContent)
|
||||
}
|
||||
return executeSyncContinuation(delegateTaskArgs, ctx, options, parentContext)
|
||||
return executeSyncContinuation(delegateTaskArgs, ctx, options, parentContext, undefined, continuationSystemContent)
|
||||
}
|
||||
|
||||
if (!delegateTaskArgs.category && !delegateTaskArgs.subagent_type) {
|
||||
|
||||
Reference in New Issue
Block a user