fix: restore smart-approve mode (#7690)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Adrian Cole
2026-03-06 23:45:23 +08:00
committed by GitHub
parent 6b6018c207
commit b4546f62d9
11 changed files with 327 additions and 179 deletions
+11 -3
View File
@@ -245,7 +245,10 @@ impl Agent {
tool_result_tx: tool_tx,
tool_result_rx: Arc::new(Mutex::new(tool_rx)),
retry_manager: RetryManager::new(),
tool_inspection_manager: Self::create_tool_inspection_manager(permission_manager),
tool_inspection_manager: Self::create_tool_inspection_manager(
permission_manager,
provider.clone(),
),
container: Mutex::new(None),
}
}
@@ -253,6 +256,7 @@ impl Agent {
/// Create a tool inspection manager with default inspectors
fn create_tool_inspection_manager(
permission_manager: Arc<PermissionManager>,
provider: SharedProvider,
) -> ToolInspectionManager {
let mut tool_inspection_manager = ToolInspectionManager::new();
@@ -261,9 +265,8 @@ impl Agent {
// Add permission inspector (medium-high priority)
tool_inspection_manager.add_inspector(Box::new(PermissionInspector::new(
std::collections::HashSet::new(), // readonly tools - will be populated from extension manager
std::collections::HashSet::new(), // regular tools - will be populated from extension manager
permission_manager,
provider,
)));
// Add repetition inspector (lower priority - basic repetition checking)
@@ -350,6 +353,10 @@ impl Agent {
.prepare_tools_and_prompt(session_id, working_dir)
.await?;
if self.config.goose_mode == GooseMode::SmartApprove {
self.tool_inspection_manager.apply_tool_annotations(&tools);
}
Ok(ReplyContext {
conversation,
tools,
@@ -1261,6 +1268,7 @@ impl Agent {
// Run all tool inspectors
let inspection_results = self.tool_inspection_manager
.inspect_tools(
&session_config.id,
&remaining_requests,
conversation.messages(),
goose_mode,