generated from nhcarrigan/template
fix: resolve permission modal issues with successful operations
Fixes #113 - EnterPlanMode/ExitPlanMode infinite permission loops This commit addresses multiple related issues with the permission system: 1. Added system tool filtering to sibling tools loop to prevent EnterPlanMode/ExitPlanMode from appearing in permission modals 2. Skip permission modal processing entirely when operations succeed (subtype == "success"), since tools were already approved and executed 3. Emit proper state change before early return to prevent Hikari from getting stuck in "typing" state The early return happens after all stats, costs, and achievements are processed, so no data tracking is affected. ✨ This issue was fixed with help from Hikari~ 🌸
This commit is contained in:
@@ -1218,6 +1218,12 @@ fn process_json_line(
|
|||||||
if let Some(denials) = permission_denials {
|
if let Some(denials) = permission_denials {
|
||||||
// Only process if there are actually denials
|
// Only process if there are actually denials
|
||||||
if !denials.is_empty() {
|
if !denials.is_empty() {
|
||||||
|
// Skip permission prompts if the result was successful - tools were already approved
|
||||||
|
if subtype == "success" {
|
||||||
|
emit_state_change(app, state, None, conversation_id.clone());
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut regular_permission_requests = Vec::new();
|
let mut regular_permission_requests = Vec::new();
|
||||||
|
|
||||||
// Get denied tool IDs for later comparison
|
// Get denied tool IDs for later comparison
|
||||||
@@ -1310,6 +1316,10 @@ fn process_json_line(
|
|||||||
// Check for sibling tools that may have been cancelled
|
// Check for sibling tools that may have been cancelled
|
||||||
// Add them to the permission batch so they can be approved together
|
// Add them to the permission batch so they can be approved together
|
||||||
for tool_use in captured_pending_tools.iter() {
|
for tool_use in captured_pending_tools.iter() {
|
||||||
|
// Skip system tools that should never require permission
|
||||||
|
if is_system_tool(&tool_use.tool_name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Only add tools that weren't explicitly denied (these are likely cancelled siblings)
|
// Only add tools that weren't explicitly denied (these are likely cancelled siblings)
|
||||||
if !denied_tool_ids.contains(&tool_use.tool_use_id) {
|
if !denied_tool_ids.contains(&tool_use.tool_use_id) {
|
||||||
let description = format_tool_description(&tool_use.tool_name, &tool_use.tool_input);
|
let description = format_tool_description(&tool_use.tool_name, &tool_use.tool_input);
|
||||||
|
|||||||
Reference in New Issue
Block a user