github / github/copilot-sdk

The copilot CLI flashes the permission prompt UI, even though extension has approved.

Đang mở
#956 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
128

Mô tả

I'm working on an extension that would auto approve based on some rules.

```
// Deferred fire-and-forget logger — session isn't available until joinSession resolves
let _session = null;
const log = (msg) => { if (_session) _session.log(msg).catch(() => {}); };
...

onPermissionRequest: (request) => {
const toolName = request.toolName ?? "";
const toolArgs = {};
if (request.fullCommandText) toolArgs.command = request.fullCommandText;
if (request.fileName) toolArgs.path = request.fileName;

// 1. deny rules first
for (const rule of parsedDeny) {
if (matchRule(rule, toolName, toolArgs)) {
log(`DENY (permission) tool=${toolName} kind=${request.kind} rule="${rule.raw}"`);
return { kind: "denied-by-rules", rules: [rule.raw] };
}
}

// 2. allow rules — auto-approve
for (const rule of parsedAllow) {
if (matchRule(rule, toolName, toolArgs)) {
log(`APPROVE (permission) tool=${toolName} kind=${request.kind} rule="${rule.raw}"`);
return { kind: "approved" };
}
}

// 3. no match — let CLI handle (prompt user)
log(`NO MATCH (permission) tool=${toolName} kind=${request.kind}`);
return { kind: "no-result" };
},
```

In the cli i see the UI prompt none the less, if i do nothing, i see the tool call get approved and complete in the background.
If i'm fast enough or am on autopilot with limited permissions then the ui prompt rejects the tool call and fails it.

I do not think the CLI is correctly sequencing and waiting on extensions for permissions flow.

CLI Version : v1.0.13-1

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

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

Đánh giá

Issue này chưa được đánh giá.

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.