You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: targeted write_file repair nudge and agent loop hardening
- repairLoop: inject specific write_file directive when TOOL_MISSING is
for write_file, rather than generic "call tools" nudge that Brain
interprets as permission to keep analyzing
- ReactAgentAdapter: fix needsFileWrite and task guards to check intent +
goals (repair tasks use intent="repair", file info lives in goals)
- ReactAgentAdapter: fix iteration-ceiling warning to fire 3 turns before
end instead of requiring 30 cumulative tool calls (never triggered)
- ReactAgentAdapter: add post-loop write rescue — if model produced a
FINAL ANSWER but refused to call write_file, rescue writes the file
- pappy evaluator: tool_event ACs now check filesChanged instead of
keyword-matching output text
- toolResults: write_file TOOL_MISSING is now HIGH severity (forces repair)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
messages.push({role: "user",content: "You have used many tools without producing a final answer. Do not call any more tools. Your next response must be your final answer."});
529
-
continue;// Skip tool execution, wait for model's final answer next iteration
530
-
}
531
-
532
-
// If warning was already injected and this is the next iteration, extract output as final
533
-
if(toolLimitWarningInjected&&!finalAnswerFound){
534
-
// This is the iteration after warning injection - extract whatever we have as final answer
? '\n\nCRITICAL: Your task requires saving a file. You MUST call write_file with the complete file content in your NEXT response — before writing your final answer.'
547
+
: '';
548
+
messages.push({
549
+
role: "user",
550
+
content: `You have 2 turns remaining.${writeFileReminder}\nAfter any required tool call (e.g. write_file), your next response MUST be your FINAL ANSWER using the FINAL ANSWER: marker.`,
541
551
});
542
-
break;
552
+
continue;// give the model a clean turn to act on this warning
543
553
}
544
554
545
555
if(toolCalls.length===0){
546
556
if(finalAnswer){
547
557
// Guard: if the task clearly requires file/repo investigation and no tools
548
558
// were called at all, the model skipped the work — reject the premature answer.
559
+
// Check both intent and goals — repair tasks use intent="repair", so file/tool
0 commit comments