Skip subagents for gemini (#5257)
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -473,56 +473,4 @@ mod tests {
|
||||
assert!(result.needs_approval.iter().any(|req| req.id == "tool_3"));
|
||||
assert!(enable_extension_request_ids.iter().any(|id| id == "tool_3"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_check_tool_permissions_auto() {
|
||||
// Setup mocks
|
||||
let temp_file = NamedTempFile::new().unwrap();
|
||||
let temp_path = temp_file.path();
|
||||
let mut permission_manager = PermissionManager::new(temp_path);
|
||||
let provider = create_mock_provider();
|
||||
|
||||
let tools_with_readonly_annotation: HashSet<String> =
|
||||
vec!["file_reader".to_string()].into_iter().collect();
|
||||
let tools_without_annotation: HashSet<String> =
|
||||
vec!["data_fetcher".to_string()].into_iter().collect();
|
||||
|
||||
permission_manager.update_user_permission("file_reader", PermissionLevel::AlwaysAllow);
|
||||
permission_manager
|
||||
.update_smart_approve_permission("data_fetcher", PermissionLevel::AskBefore);
|
||||
|
||||
let tool_request_1 = ToolRequest {
|
||||
id: "tool_1".to_string(),
|
||||
tool_call: Ok(CallToolRequestParam {
|
||||
name: "file_reader".into(),
|
||||
arguments: Some(object!({"path": "/path/to/file"})),
|
||||
}),
|
||||
};
|
||||
|
||||
let tool_request_2 = ToolRequest {
|
||||
id: "tool_2".to_string(),
|
||||
tool_call: Ok(CallToolRequestParam {
|
||||
name: "data_fetcher".into(),
|
||||
arguments: Some(object!({"url": "http://example.com"})),
|
||||
}),
|
||||
};
|
||||
|
||||
let candidate_requests: Vec<ToolRequest> = vec![tool_request_1, tool_request_2];
|
||||
|
||||
// Call the function under test
|
||||
let (result, _) = check_tool_permissions(
|
||||
&candidate_requests,
|
||||
"auto",
|
||||
tools_with_readonly_annotation,
|
||||
tools_without_annotation,
|
||||
&mut permission_manager,
|
||||
provider,
|
||||
)
|
||||
.await;
|
||||
|
||||
// Validate the result
|
||||
assert_eq!(result.approved.len(), 2); // file_reader should be approved
|
||||
assert_eq!(result.needs_approval.len(), 0); // data_fetcher should need approval
|
||||
assert_eq!(result.denied.len(), 0); // No tool should be denied in this test
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user