()
| 2099 | |
| 2100 | #[tokio::test] |
| 2101 | async fn task_child_run_confirmation_auto_approve() { |
| 2102 | let workspace = tempfile::tempdir().unwrap(); |
| 2103 | let registry = AgentRegistry::new(); |
| 2104 | // Agent with allow("read(*)") — write is not in allow list, so it returns Ask. |
| 2105 | // With AutoApproveConfirmation (default for agents with permissions), Ask → approve. |
| 2106 | let spec = crate::subagent::WorkerAgentSpec::custom("reader-writer", "Read and write") |
| 2107 | .with_permissions(PermissionPolicy::new().allow("read(*)")) |
| 2108 | .with_max_steps(3); |
| 2109 | registry.register(spec.into_agent_definition()); |
| 2110 | |
| 2111 | let mock = Arc::new(MockLlmClient::new(vec![ |
| 2112 | MockLlmClient::tool_call_response( |
| 2113 | "t1", |
| 2114 | "write", |
| 2115 | serde_json::json!({ |
| 2116 | "file_path": workspace.path().join("auto.txt").to_string_lossy(), |
| 2117 | "content": "AUTO_APPROVED" |
| 2118 | }), |
| 2119 | ), |
| 2120 | MockLlmClient::text_response("Written."), |
| 2121 | ])); |
| 2122 | |
| 2123 | let executor = TaskExecutor::new( |
| 2124 | Arc::new(registry), |
| 2125 | mock, |
| 2126 | workspace.path().to_string_lossy().to_string(), |
| 2127 | ); |
| 2128 | |
| 2129 | let result = executor |
| 2130 | .execute( |
| 2131 | TaskParams { |
| 2132 | agent: "reader-writer".to_string(), |
| 2133 | description: "Write via auto-approve".to_string(), |
| 2134 | prompt: "Write auto.txt".to_string(), |
| 2135 | background: false, |
| 2136 | max_steps: Some(3), |
| 2137 | }, |
| 2138 | None, |
| 2139 | None, |
| 2140 | ) |
| 2141 | .await |
| 2142 | .unwrap(); |
| 2143 | |
| 2144 | assert!( |
| 2145 | result.success, |
| 2146 | "Ask should be auto-approved: {}", |
| 2147 | result.output |
| 2148 | ); |
| 2149 | assert!( |
| 2150 | !result.output.contains("MissingConfirmationManager"), |
| 2151 | "no MissingConfirmationManager: {}", |
| 2152 | result.output |
| 2153 | ); |
| 2154 | } |
| 2155 | |
| 2156 | #[tokio::test] |
| 2157 | async fn task_child_run_step_budget_enforced() { |
nothing calls this directly
no test coverage detected