From 9ff5ba6098a252e3956b9a35d18fd73dac734957 Mon Sep 17 00:00:00 2001 From: "Dhanji R. Prasanna" Date: Thu, 25 Dec 2025 17:55:13 +1100 Subject: [PATCH] Fix auto-continue false positives from tool-call-like content When the LLM outputs text containing tool call patterns (e.g., reading log files, showing examples, or discussing tool calls), the parser's has_unexecuted_tool_call() would detect these as real tool calls and trigger auto-continue, leading to repeated empty responses. The fix: mark the parser buffer as consumed when content is displayed. This prevents tool-call-like patterns in displayed text from triggering false positives later. The fix is safe because: 1. Only runs when no tool was detected (inside 'if !tool_executed') 2. Legitimate tool calls are detected first by process_chunk() 3. Matches existing pattern of calling mark_tool_calls_consumed() after tool execution --- crates/g3-core/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/g3-core/src/lib.rs b/crates/g3-core/src/lib.rs index 6ff44f1..f6df224 100644 --- a/crates/g3-core/src/lib.rs +++ b/crates/g3-core/src/lib.rs @@ -4206,6 +4206,11 @@ impl Agent { self.ui_writer.print_agent_response(&filtered_content); self.ui_writer.flush(); current_response.push_str(&filtered_content); + + // Mark parser buffer as consumed up to current position + // This prevents tool-call-like patterns in displayed text + // from triggering false positives in has_unexecuted_tool_call() + parser.mark_tool_calls_consumed(); } } }