Compare commits

..

4 Commits

Author SHA1 Message Date
Ralph Khreish
ee2d9921c2 chore: fix format 2025-07-11 14:13:00 +03:00
Ralph Khreish
fff2172a30 chore: fix unit tests 2025-07-11 14:06:22 +03:00
Ralph Khreish
5fa7d2ecaa chore: fix format 2025-07-11 13:43:13 +03:00
Ralph Khreish
8e9d00e03d fix: more regression bugs 2025-07-11 07:25:29 +03:00

View File

@@ -461,44 +461,19 @@ async function expandTask(
`${combinedAdditionalContext}\n\n# Project Context\n\n${gatheredContext}`.trim();
}
// Ensure expansionPrompt is a string (handle both string and object formats)
let expansionPromptText = undefined;
if (taskAnalysis?.expansionPrompt) {
if (typeof taskAnalysis.expansionPrompt === 'string') {
expansionPromptText = taskAnalysis.expansionPrompt;
} else if (
typeof taskAnalysis.expansionPrompt === 'object' &&
taskAnalysis.expansionPrompt.text
) {
expansionPromptText = taskAnalysis.expansionPrompt.text;
}
}
// Ensure gatheredContext is a string (handle both string and object formats)
let gatheredContextText = gatheredContext;
if (typeof gatheredContext === 'object' && gatheredContext !== null) {
if (gatheredContext.data) {
gatheredContextText = gatheredContext.data;
} else if (gatheredContext.text) {
gatheredContextText = gatheredContext.text;
} else {
gatheredContextText = JSON.stringify(gatheredContext);
}
}
const promptParams = {
task: task,
subtaskCount: finalSubtaskCount,
nextSubtaskId: nextSubtaskId,
additionalContext: additionalContext,
complexityReasoningContext: complexityReasoningContext,
gatheredContext: gatheredContextText || '',
gatheredContext: gatheredContext,
useResearch: useResearch,
expansionPrompt: expansionPromptText || undefined
expansionPrompt: taskAnalysis?.expansionPrompt || undefined
};
let variantKey = 'default';
if (expansionPromptText) {
if (taskAnalysis?.expansionPrompt) {
variantKey = 'complexity-report';
logger.info(
`Using expansion prompt from complexity report for task ${task.id}.`