Merge pull request #764 from felix307253927/pr-main-320

fix: The command succeeded, yet the model keeps calling it repeatedly.
This commit is contained in:
Jaber Jaber
2026-03-27 05:34:55 +03:00
committed by GitHub
+5 -1
View File
@@ -1549,7 +1549,7 @@ async fn tool_shell_exec(
// Truncate very long outputs to prevent memory issues
let max_output = 100_000;
let stdout_str = if stdout.len() > max_output {
let mut stdout_str = if stdout.len() > max_output {
format!(
"{}...\n[truncated, {} total bytes]",
crate::str_utils::safe_truncate_str(&stdout, max_output),
@@ -1568,6 +1568,10 @@ async fn tool_shell_exec(
stderr.to_string()
};
if exit_code == 0 && stdout_str.is_empty() {
stdout_str = "Command executed successfully".to_string();
}
Ok(format!(
"Exit code: {exit_code}\n\nSTDOUT:\n{stdout_str}\nSTDERR:\n{stderr_str}"
))