fix: preserve tool failures under noisy output

This commit is contained in:
wuyang
2026-07-26 16:14:26 +08:00
parent af141845ed
commit 87689931b5
6 changed files with 110 additions and 4 deletions
+12
View File
@@ -77,6 +77,7 @@ VERIFICATION_TOOLS = {"read_file", "git_status", "git_diff", "exec", "poll_proce
EXECUTION_TOOLS = {"exec", "start_process", "poll_process"}
REPEAT_GUARDED_EXECUTION_TOOLS = {"exec", "start_process"}
MAX_CONSECUTIVE_CHECKPOINT_REJECTIONS = 3
MAX_TOOL_CALLS_PER_ITERATION = 8
CODE_FILE_SUFFIXES = {
".c",
".cc",
@@ -568,6 +569,17 @@ class AgentLoop:
)
return candidate
if len(tool_calls) > MAX_TOOL_CALLS_PER_ITERATION:
await recorder.emit(
"tool.batch_limited",
{
"requested": len(tool_calls),
"accepted": MAX_TOOL_CALLS_PER_ITERATION,
"iteration": iteration + 1,
"depth": depth,
},
)
tool_calls = tool_calls[:MAX_TOOL_CALLS_PER_ITERATION]
consecutive_checkpoint_rejections = 0
assistant_message = {
"role": "assistant",