generated from nhcarrigan/template
fix: prevent permission prompts for system tools
Fixed infinite permission loop when using ExitPlanMode and other system tools. These tools are now automatically allowed without requiring user approval. The issue occurred because all tool denials triggered permission prompts, including system tools like ExitPlanMode that should never require permission. This caused an infinite loop where: 1. Claude Code calls ExitPlanMode 2. Hikari shows permission modal 3. User approves 4. Claude Code retries ExitPlanMode 5. Loop repeats Solution: - Added is_system_tool helper function to identify system tools - System tools (ExitPlanMode, EnterPlanMode) are now skipped in permission denial processing - These tools execute immediately without user intervention Closes #113
This commit is contained in:
@@ -1225,7 +1225,17 @@ fn process_json_line(
|
||||
.map(|d| d.tool_use_id.clone())
|
||||
.collect();
|
||||
|
||||
// Helper function to check if a tool is a system tool that should never require permission
|
||||
let is_system_tool = |tool_name: &str| -> bool {
|
||||
matches!(tool_name, "ExitPlanMode" | "EnterPlanMode")
|
||||
};
|
||||
|
||||
for denial in denials {
|
||||
// Skip system tools that should never require permission
|
||||
if is_system_tool(&denial.tool_name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Special handling for AskUserQuestion tool
|
||||
if denial.tool_name == "AskUserQuestion" {
|
||||
if let Some(questions) = denial
|
||||
|
||||
Reference in New Issue
Block a user