From f38abd68436ea5d093b2e22c2b8520b6e6906251 Mon Sep 17 00:00:00 2001 From: Shandy Hermawan Date: Wed, 2 Jul 2025 12:16:09 +0700 Subject: [PATCH] fix: Subtask generation fails on gemini-2.5-pro (#852) * fix: clarify details format in task expansion prompt * chore: add changeset --- .changeset/tame-vans-throw.md | 5 +++++ scripts/modules/task-manager/expand-task.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/tame-vans-throw.md diff --git a/.changeset/tame-vans-throw.md b/.changeset/tame-vans-throw.md new file mode 100644 index 00000000..53c6ccfc --- /dev/null +++ b/.changeset/tame-vans-throw.md @@ -0,0 +1,5 @@ +--- +"task-master-ai": patch +--- + +fixes a critical issue where subtask generation fails on gemini-2.5-pro unless explicitly prompted to return 'details' field as a string not an object diff --git a/scripts/modules/task-manager/expand-task.js b/scripts/modules/task-manager/expand-task.js index eb928578..397e4781 100644 --- a/scripts/modules/task-manager/expand-task.js +++ b/scripts/modules/task-manager/expand-task.js @@ -76,7 +76,7 @@ For each subtask, provide: - title: Clear, specific title - description: Detailed description - dependencies: Array of prerequisite subtask IDs (use the new sequential IDs) -- details: Implementation details +- details: Implementation details, the output should be in string - testStrategy: Optional testing approach @@ -566,7 +566,7 @@ async function expandTask( } // --- Use Simplified System Prompt for Report Prompts --- - systemPrompt = `You are an AI assistant helping with task breakdown. Generate exactly ${finalSubtaskCount} subtasks based on the provided prompt and context. Respond ONLY with a valid JSON object containing a single key "subtasks" whose value is an array of the generated subtask objects. Each subtask object in the array must have keys: "id", "title", "description", "dependencies", "details", "status". Ensure the 'id' starts from ${nextSubtaskId} and is sequential. Ensure 'dependencies' only reference valid prior subtask IDs generated in this response (starting from ${nextSubtaskId}). Ensure 'status' is 'pending'. Do not include any other text or explanation.`; + systemPrompt = `You are an AI assistant helping with task breakdown. Generate exactly ${finalSubtaskCount} subtasks based on the provided prompt and context. Respond ONLY with a valid JSON object containing a single key "subtasks" whose value is an array of the generated subtask objects. Each subtask object in the array must have keys: "id", "title", "description", "dependencies", "details", "status". Ensure the 'id' starts from ${nextSubtaskId} and is sequential. Ensure 'dependencies' only reference valid prior subtask IDs generated in this response (starting from ${nextSubtaskId}). Ensure 'details' is a string. Ensure 'status' is 'pending'. Do not include any other text or explanation.`; logger.info( `Using expansion prompt from complexity report and simplified system prompt for task ${task.id}.` );