tweak: adjust task tool description/input to alleviate tool call failures that sometimes occured w/ gpt models (#12214)

This commit is contained in:
Aiden Cline
2026-02-05 00:04:03 -06:00
committed by GitHub
parent 556adad67b
commit 64e2bf8bf0
2 changed files with 18 additions and 7 deletions

View File

@@ -16,7 +16,12 @@ const parameters = z.object({
description: z.string().describe("A short (3-5 words) description of the task"),
prompt: z.string().describe("The task for the agent to perform"),
subagent_type: z.string().describe("The type of specialized agent to use for this task"),
session_id: z.string().describe("Existing Task session to continue").optional(),
task_id: z
.string()
.describe(
"This should only be set if you mean to resume a previous task (you can pass a prior task_id and the task will continue the same subagent session as before instead of creating a fresh one)",
)
.optional(),
command: z.string().describe("The command that triggered this task").optional(),
})
@@ -60,8 +65,8 @@ export const TaskTool = Tool.define("task", async (ctx) => {
const hasTaskPermission = agent.permission.some((rule) => rule.permission === "task")
const session = await iife(async () => {
if (params.session_id) {
const found = await Session.get(params.session_id).catch(() => {})
if (params.task_id) {
const found = await Session.get(params.task_id).catch(() => {})
if (found) return found
}
@@ -176,7 +181,13 @@ export const TaskTool = Tool.define("task", async (ctx) => {
}))
const text = result.parts.findLast((x) => x.type === "text")?.text ?? ""
const output = text + "\n\n" + ["<task_metadata>", `session_id: ${session.id}`, "</task_metadata>"].join("\n")
const output = [
`task_id: ${session.id} (for resuming to continue this task if needed)`,
"",
"<task_result>",
text,
"</task_result>",
].join("\n")
return {
title: params.description,