aboutsummaryrefslogtreecommitdiffstats
path: root/src/agent.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/agent.rs')
-rw-r--r--src/agent.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/agent.rs b/src/agent.rs
index f0e1292..7d4c4ef 100644
--- a/src/agent.rs
+++ b/src/agent.rs
@@ -217,6 +217,16 @@ pub fn run_turn(
217 Err(error) => return Err(error), 217 Err(error) => return Err(error),
218 }; 218 };
219 219
220 // Placeholders are dropped before the assistant message is written:
221 // recording a call we refuse to run would leave it unanswered.
222 let before = outcome.tool_calls.len();
223 outcome
224 .tool_calls
225 .retain(|call| !tools::is_placeholder(&call.arguments));
226 if outcome.tool_calls.len() < before {
227 eprintln!("agent686: ignored {} empty tool call(s) from the model", before - outcome.tool_calls.len());
228 }
229
220 // A missing id would make the tool result unattachable. 230 // A missing id would make the tool result unattachable.
221 for (index, call) in outcome.tool_calls.iter_mut().enumerate() { 231 for (index, call) in outcome.tool_calls.iter_mut().enumerate() {
222 if call.id.is_empty() { 232 if call.id.is_empty() {
@@ -351,7 +361,10 @@ fn execute(
351 )) 361 ))
352 } 362 }
353 }; 363 };
354 ui::tool_line(step, &call.name, &args); 364 // The bash approval prompt prints the command; do not print it here too.
365 let repeat_detail = !(tools::approval(&call.name) == Approval::EveryCall
366 && approver.will_prompt_bash());
367 ui::tool_line(step, &call.name, &args, repeat_detail);
355 if let Err(error) = tools::validate(&call.name, &args) { 368 if let Err(error) = tools::validate(&call.name, &args) {
356 return ToolOutcome::Failed(format!("{error}; the call was not run")); 369 return ToolOutcome::Failed(format!("{error}; the call was not run"));
357 } 370 }