Skip to content

Commit af68856

Browse files
humbertoyustaMarcMcIntosh
authored andcommitted
fix: don't fail on confirmation to send error to the model
1 parent 9c12530 commit af68856

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

refact-agent/engine/src/http/routers/v1/at_tools.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ pub async fn handle_v1_tools_check_if_confirmation_needed(
153153
let tool = match all_tools.get(&tool_call.function.name) {
154154
Some(x) => x,
155155
None => {
156-
return Err(ScratchError::new(StatusCode::UNPROCESSABLE_ENTITY, format!("Unknown tool: {}", tool_call.function.name)))
156+
tracing::error!("Unknown tool: {}", tool_call.function.name);
157+
// Not returning error here, because we don't want to stop the chat, it will fail later
158+
// in `/chat` and provide error to the model
159+
continue;
157160
}
158161
};
159162

@@ -172,8 +175,15 @@ pub async fn handle_v1_tools_check_if_confirmation_needed(
172175
}
173176
};
174177

175-
let should_confirm = tool.match_against_confirm_deny(ccx.clone(), &args).await
176-
.map_err(|e| { ScratchError::new(StatusCode::UNPROCESSABLE_ENTITY, e)})?;
178+
let should_confirm = match tool.match_against_confirm_deny(ccx.clone(), &args).await {
179+
Ok(should_confirm) => should_confirm,
180+
Err(e) => {
181+
tracing::error!("Error getting tool command to match: {e}");
182+
// Not returning error here, because we don't want to stop the chat, it will fail later
183+
// in `/chat` and provide error to the model
184+
continue;
185+
}
186+
};
177187

178188
match should_confirm.result {
179189
MatchConfirmDenyResult::DENY => {

0 commit comments

Comments
 (0)