github / github/copilot-cli

PreToolUse hook permissionDecision: "ask" auto-approved by TUI since v1.0.53

Open
#3,590 1 comment 1 reaction 0 assignees View on GitHub
area:permissions area:plugins
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the bug

When a `PreToolUse` hook returns `permissionDecision: "ask"`, the TUI permission dialog flashes on screen for milliseconds and is **immediately auto-approved** without user interaction. The hook fires correctly, the `permission.requested` event is emitted with `kind=hook`, but the prompt is resolved as `"approved"` before the user can interact with it.

**This is a regression introduced in v1.0.53 and persists in v1.0.56.** Version 1.0.52 works correctly — the permission dialog stays visible and waits for user input.

Additionally, since v1.0.53, **selection highlight colors** and **user question background colors** in the TUI appear broken (likely same root cause — a TUI rendering change).

### Affected version

- **Broken:** 1.0.53, 1.0.54, 1.0.55, 1.0.56 (all tested, all broken)
- - **Working:** 1.0.52 (prompts stay visible and wait for user interaction)

### Steps to reproduce the behavior

### Steps to reproduce

**1. Create a minimal hook (e.g. `~/.copilot/hooks/hooks.json`):**

```json
{
"hooks": {
"PreToolUse": [
{
"hooks": [
{
"type": "command",
"command": "python3 -c \"import json,sys; d=json.load(sys.stdin); print(json.dumps({'permissionDecision':'ask','permissionDecisionReason':'Testing hook prompt'}) if d.get('toolName')=='bash' else json.dumps({}))\"",
"timeout": 5
}
]
}
]
}
}
```

**2. Start a new session:**

```bash
COPILOT_AUTO_UPDATE=false copilot
```

**3. Ask the agent to run any shell command:**

```
ls -l ~/
```

**4. Observe:** The permission dialog flashes on screen for ~50 ms and disappears. The command executes immediately without user approval.

### Expected behavior

The permission dialog should remain visible and wait for the user to select "Yes" or "No" before proceeding — exactly as it does on v1.0.52.

### Additional context

### Evidence from events.jsonl

Timing from a v1.0.56 session shows the prompt is resolved in 79ms:

```json
permission.requested → timestamp T
permission.completed → timestamp T + 79ms (result: "approved")
```

For comparison, in a session created under v1.0.51 , the same hook waits 3–5 seconds for user interaction:

```json
permission.requested → timestamp T
permission.completed → timestamp T + 4200ms (result: "approved" after user clicks Yes)
```

### Key observation

Sessions **created** under v1.0.52 or earlier continue to show prompts correctly, even when the binary has been auto-updated to v1.0.56. This suggests the regression is in the TUI session initialization or component mounting code, not in the hook execution pipeline itself.
### Additional context

- Tested with both **global hooks** (`~/.copilot/hooks/hooks.json`) and **plugin hooks** — same behavior
- The hook itself executes correctly — stdout returns valid JSON with `permissionDecision: "ask"`
- The `permission.requested` event shows `kind=hook` and `resolvedByHook=N/A` (correct)
- Non-hook permission prompts (e.g., native trust prompts for new directories) are NOT affected — they still wait for user input

### Environment

- OS: Linux (Ubuntu)
- Terminal: Standard terminal (no tmux)
- Shell: bash

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.