fix(app): add doom loop detector to prevent repetitive tool calls#2368
fix(app): add doom loop detector to prevent repetitive tool calls#2368tusharmath merged 31 commits intomainfrom
Conversation
| Err(err) => ToolResult::new(tool_call.name.as_str()) | ||
| .call_id(tool_call.call_id.clone()) | ||
| .failure(err), | ||
| }; |
There was a problem hiding this comment.
There are errors that we want to propagate back to the agent, and sometimes there are errors that we want to show to the user. In this case that nuance is getting missed.
|
Action required: PR inactive for 5 days. |
|
PR closed after 10 days of inactivity. |
| forge_domain::HandleOperation::AgentError(err) => { | ||
| vec![anyhow::anyhow!("{}", err)] | ||
| } |
There was a problem hiding this comment.
Converting Arc<anyhow::Error> to string and back loses the original error type, backtrace, and error chain. This makes debugging difficult in production when doom loop errors occur. The conversion anyhow::anyhow!("{}", err) only preserves the Display output.
Fix by cloning the Arc or using anyhow::Error::msg:
forge_domain::HandleOperation::AgentError(err) => {
vec![(*err).clone()]
}This preserves the full error context for proper error reporting.
| forge_domain::HandleOperation::AgentError(err) => { | |
| vec![anyhow::anyhow!("{}", err)] | |
| } | |
| forge_domain::HandleOperation::AgentError(err) => { | |
| vec![(*err).clone()] | |
| } | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
this suggestion won't compile
… Arc instead of converting to string Co-Authored-By: ForgeCode <noreply@forgecode.dev>
| Some((tool_name, count)) | ||
| } | ||
|
|
||
| fn extract_tool_signatures(&self, conversation: &Conversation) -> Vec<(ToolName, String)> { |
There was a problem hiding this comment.
| fn extract_tool_signatures(&self, conversation: &Conversation) -> Vec<(ToolName, String)> { | |
| fn extract_tool_signatures(&self, conversation: &Conversation) -> Vec<(ToolName, ToolCallArguments)> { |
| pub fn detect_from_conversation( | ||
| &self, | ||
| conversation: &Conversation, | ||
| ) -> Option<(ToolName, usize)> { |
There was a problem hiding this comment.
| ) -> Option<(ToolName, usize)> { | |
| ) -> Option<usize> { |
Can just return the index.
…2368) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: ForgeCode <noreply@forgecode.dev> Co-authored-by: Tushar Mathur <tusharmath@gmail.com>
Here is a conversation. dump demonstrating dooms loop detection
2026-02-08_19-36-42-dump.html