feat: handle PermissionDenied hook event and drive Permission character state (v2.1.89) #256

Closed
opened 2026-04-13 09:11:42 -07:00 by hikari · 1 comment
Owner

Context

Claude Code v2.1.89 added a new PermissionDenied hook event, emitted when a tool call or action is blocked because permission was not granted.

Why This Matters

We already have a Permission character state (confused shrug with question mark) that is presumably triggered when Claude Code is waiting for permission approval. The PermissionDenied hook gives us a precise signal for when a permission request was explicitly rejected, which is a distinct UX moment from "waiting for approval."

This could be used to:

  1. Trigger the Permission or Error character state on denial
  2. Display a UI notification that a tool was blocked
  3. Provide the user with context about what was denied

Tasks

  • Add PermissionDenied variant to the hook event enum in src-tauri/src/types.rs
  • Review the payload fields (likely includes tool name, reason, etc.)
  • Handle in src-tauri/src/wsl_bridge.rs — emit appropriate UI event
  • Decide whether denied → Permission state or Error state in CharacterState
  • Add tests for the new type variant and state transition

References

  • Claude Code v2.1.89 changelog
  • src-tauri/src/types.rsCharacterState enum
  • src-tauri/src/wsl_bridge.rs

This issue was created with help from Hikari~ 🌸

## Context Claude Code v2.1.89 added a new **`PermissionDenied`** hook event, emitted when a tool call or action is blocked because permission was not granted. ## Why This Matters We already have a `Permission` character state (confused shrug with question mark) that is presumably triggered when Claude Code is waiting for permission approval. The `PermissionDenied` hook gives us a precise signal for when a permission request was explicitly **rejected**, which is a distinct UX moment from "waiting for approval." This could be used to: 1. Trigger the `Permission` or `Error` character state on denial 2. Display a UI notification that a tool was blocked 3. Provide the user with context about *what* was denied ## Tasks - [ ] Add `PermissionDenied` variant to the hook event enum in `src-tauri/src/types.rs` - [ ] Review the payload fields (likely includes tool name, reason, etc.) - [ ] Handle in `src-tauri/src/wsl_bridge.rs` — emit appropriate UI event - [ ] Decide whether denied → `Permission` state or `Error` state in `CharacterState` - [ ] Add tests for the new type variant and state transition ## References - Claude Code v2.1.89 changelog - `src-tauri/src/types.rs` — `CharacterState` enum - `src-tauri/src/wsl_bridge.rs` ✨ This issue was created with help from Hikari~ 🌸
Author
Owner

Resolved in PR #261. Added PermissionDeniedEvent type in types.rs, parse function in wsl_bridge.rs, Tauri event claude:permission-denied, and a CharacterState::Permission state change on hook detection. Tests included.

Resolved in PR #261. Added `PermissionDeniedEvent` type in `types.rs`, parse function in `wsl_bridge.rs`, Tauri event `claude:permission-denied`, and a `CharacterState::Permission` state change on hook detection. Tests included. ✨
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#256