()
| 551 | |
| 552 | #[tokio::test] |
| 553 | async fn test_agent_max_tool_rounds() { |
| 554 | // Create a mock that always returns tool calls (infinite loop) |
| 555 | let responses: Vec<LlmResponse> = (0..100) |
| 556 | .map(|i| { |
| 557 | MockLlmClient::tool_call_response( |
| 558 | &format!("tool-{}", i), |
| 559 | "bash", |
| 560 | serde_json::json!({"command": "echo loop"}), |
| 561 | ) |
| 562 | }) |
| 563 | .collect(); |
| 564 | |
| 565 | let mock_client = Arc::new(MockLlmClient::new(responses)); |
| 566 | let tool_executor = Arc::new(ToolExecutor::new("/tmp".to_string())); |
| 567 | |
| 568 | let config = AgentConfig { |
| 569 | max_tool_rounds: 3, |
| 570 | ..Default::default() |
| 571 | }; |
| 572 | |
| 573 | let agent = AgentLoop::new(mock_client, tool_executor, test_tool_context(), config); |
| 574 | let result = agent.execute(&[], "Loop forever", None).await; |
| 575 | |
| 576 | // Should fail due to max tool rounds exceeded |
| 577 | assert!(result.is_err()); |
| 578 | assert!(result.unwrap_err().to_string().contains("Max tool rounds")); |
| 579 | } |
| 580 | |
| 581 | #[tokio::test] |
| 582 | async fn test_agent_no_permission_policy_defaults_to_ask() { |
nothing calls this directly
no test coverage detected