fix(runner): raise SUB_MAX_TURNS to 40 and inject Surgical Healing Protocol into subtasks

This commit is contained in:
2026-06-03 14:15:37 -07:00
parent fa8a919214
commit fa0e460c1c
2 changed files with 32 additions and 6 deletions

View File

@@ -294,7 +294,7 @@ File: "${path.relative(opts.repoRoot ?? ctx.workspaceRoot, task.filePath)}" (lin
const userPrompt = `Please implement the following task: "${task.text}" and then check it off in the task list.`;
const history = [{ role: "user", content: userPrompt }];
let subTurn = 0;
const SUB_MAX_TURNS = 18;
const SUB_MAX_TURNS = 40;
let toolCallsSinceText = 0;
let roundsSinceText = 0;
const toolFingerprints = [];
@@ -388,11 +388,24 @@ File: "${path.relative(opts.repoRoot ?? ctx.workspaceRoot, task.filePath)}" (lin
history.push({
role: "user",
content: `Your previous edits completed, but the project's build check failed with compilation errors.
Please fix these errors immediately so the build compiles clean:
=========================================
🚨 SURGICAL HEALING PROTOCOL ACTIVE 🚨
=========================================
The project's compilation/build has failed. You are currently in an autonomous, auto-correcting healing loop and must fix this compilation error immediately.
To prevent cognitive loop spirals and command limits, you MUST follow this strict, non-negotiable troubleshooting protocol:
1. 🚫 STRICTLY BLOCK EXPLORATION: DO NOT execute general directory exploration or orientation commands such as 'ls', 'find', 'pwd', 'grep', 'git status', 'git diff', or other search commands. You do not need to look around.
2. 🎯 SURGICAL TARGETING: Scan the compiler error logs below to locate the EXACT filename, line number, and column where the compilation failed.
3. 🛠️ IMMEDIATE CORRECTION: Read that file immediately using your specific file-reading tool (using precise start/end lines if it is large) and apply a targeted, surgical edit to correct the exact syntax or type error. Do not write a placeholder or partial fix.
Here are the precise compilation errors from the compiler:
\`\`\`text
${verification.error}
\`\`\``,
\`\`\`
Implement the exact fix directly in the code now.`,
});
continue;
}

View File

@@ -396,7 +396,7 @@ File: "${path.relative(opts.repoRoot ?? ctx.workspaceRoot, task.filePath)}" (lin
const history: ChatMessage[] = [{ role: "user", content: userPrompt }];
let subTurn = 0;
const SUB_MAX_TURNS = 18;
const SUB_MAX_TURNS = 40;
let toolCallsSinceText = 0;
let roundsSinceText = 0;
const toolFingerprints: string[] = [];
@@ -503,11 +503,24 @@ File: "${path.relative(opts.repoRoot ?? ctx.workspaceRoot, task.filePath)}" (lin
history.push({
role: "user",
content: `Your previous edits completed, but the project's build check failed with compilation errors.
Please fix these errors immediately so the build compiles clean:
=========================================
🚨 SURGICAL HEALING PROTOCOL ACTIVE 🚨
=========================================
The project's compilation/build has failed. You are currently in an autonomous, auto-correcting healing loop and must fix this compilation error immediately.
To prevent cognitive loop spirals and command limits, you MUST follow this strict, non-negotiable troubleshooting protocol:
1. 🚫 STRICTLY BLOCK EXPLORATION: DO NOT execute general directory exploration or orientation commands such as 'ls', 'find', 'pwd', 'grep', 'git status', 'git diff', or other search commands. You do not need to look around.
2. 🎯 SURGICAL TARGETING: Scan the compiler error logs below to locate the EXACT filename, line number, and column where the compilation failed.
3. 🛠️ IMMEDIATE CORRECTION: Read that file immediately using your specific file-reading tool (using precise start/end lines if it is large) and apply a targeted, surgical edit to correct the exact syntax or type error. Do not write a placeholder or partial fix.
Here are the precise compilation errors from the compiler:
\`\`\`text
${verification.error}
\`\`\``,
\`\`\`
Implement the exact fix directly in the code now.`,
});
continue;
} else {