fix: enforce sequential subtask ID numbering in AI prompts

Fixed issue where AI was generating inconsistent subtask IDs (101-105, 601-603)
instead of sequential numbering (1, 2, 3...) after the generateObject migration.

Changes:
- Updated all expand-task prompt variants with forceful "CRITICAL" instructions
- Made ID requirements explicit with examples: id={{nextSubtaskId}}, id={{nextSubtaskId}}+1
- Added warning not to use parent task ID in subtask numbering
- Removed parseSubtasksFromText post-processing that was overwriting AI-generated IDs

This ensures subtasks display correctly as X.1, X.2, X.3 format and the
`tm show X.Y` command works as expected.
This commit is contained in:
Ben Vargas
2025-07-22 17:23:09 -06:00
committed by Ralph Khreish
parent b16023ab2f
commit b0504a00d5
2 changed files with 11 additions and 7 deletions

View File

@@ -199,6 +199,10 @@ async function expandTask(
}
// Determine prompt content AND system prompt
// Calculate the next subtask ID to match current behavior:
// - Start from the number of existing subtasks + 1
// - This creates sequential IDs: 1, 2, 3, 4...
// - Display format shows as parentTaskId.subtaskId (e.g., "1.1", "1.2", "2.1")
const nextSubtaskId = (task.subtasks?.length || 0) + 1;
// Load prompts using PromptManager
@@ -259,7 +263,6 @@ async function expandTask(
hasCodebaseAnalysis: hasCodebaseAnalysisCapability,
projectRoot: projectRoot || ''
};
let variantKey = 'default';
if (expansionPromptText) {
variantKey = 'complexity-report';