github / github/copilot-cli

Tool approvals sometimes silently lost when copilot CLI is used in parallel sessions

Đang mở
#3,563 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:configuration area:permissions
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### Describe the bug

When two or more `copilot` CLI sessions run simultaneously and each persists a tool approval (the "Always allow" prompt), one session's approval seems to sometimes silently overwrite the other's in `~/.copilot/permissions-config.json`. The loss is not limited to the same directory — approvals for *other* directories in the file can also be dropped, because the entire `locations` object appears to be replaced rather than merged.

This makes "Always allow" feel unreliable: user repeatedly re-approves the same commands, MCP tools, and extensions after seemingly random sessions.

The same read-modify-write pattern appears to be reused for other config files, so we suspect (but did not isolate repros for) related races affecting:

- `config.json` → `trustedFolders` (re-prompted to trust folders that were previously trusted)

Filing this against the most reproducible case; if the team confirms a shared root cause, fixing the underlying config store should resolve the others.

### Affected version

1.0.55-7

### Steps to reproduce the behavior

Seems intermittent but, variations of:

1. Open two terminals.
2. In Terminal A: `cd `, run `copilot`, trigger a tool that prompts for approval (e.g., any shell command), choose **Always allow**. Leave the session running.
3. In Terminal B: `cd ` (a *different* directory), run `copilot`, trigger a tool that prompts for approval, choose **Always allow**. Exit the session.
4. Back in Terminal A: trigger another tool that prompts for approval, choose **Always allow**. Exit the session.
5. Inspect `~/.copilot/permissions-config.json`.

Observed: `locations[]` is missing entirely. Only Terminal A's view of the world survives, because Terminal A's final write replaced the on-disk `locations` object with its in-memory copy — which never knew about ``.

### Expected behavior

`locations` in `permissions-config.json` should contain entries for both `` and ``, with the approvals granted in each session preserved. Concurrent sessions should merge their changes, not overwrite each other.

### Additional context

## Environment

- OS: Windows 11
- CPU architecture: x86_64
- Terminal emulator: Windows Terminal
- Shell: PowerShell 7
- Multiple parallel CLI sessions across different cwds (worktrees, separate projects) is the normal workflow that triggers this.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Reproduce the race with two parallel copilot sessions using different directories, then trace the read-modify-write path for ~/.copilot/permissions-config.json and its locations object. Check whether the same pattern reaches config.json trustedFolders; done means concurrent approvals are merged and preserved rather than silently overwritten.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.