github / github/copilot-cli

Feature Request: Allow interactive `ask_user` prompts in `-p` (piped prompt) mode

Đang mở
#2,929 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:non-interactive
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ả

## Problem

When using `copilot -p "prompt"`, the CLI runs in fully non-interactive mode. If the agent encounters ambiguity and calls the `ask_user` tool, the prompt is **never shown to the user on the terminal**. Instead, the agent adapts by using whatever output channel is available (e.g., replying with a question in a PR review comment thread), which breaks the intended workflow.

### Real-world example

When using a skill like `fix-pr-review-comments` via `copilot -p "fix PR review comments"`, the agent sometimes needs clarification on ambiguous review comments. Rather than prompting the user on the terminal, it posts its question as a PR comment reply — which the user never sees in real-time, defeating the purpose of the interactive `ask_user` tool.

## Desired Behavior

A **semi-interactive mode** where:
- The agent runs autonomously by default (no unnecessary prompts)
- When the agent genuinely needs user input (via `ask_user`), the CLI renders the prompt on the terminal and waits for a response
- Once the user responds, the agent continues autonomously

This would enable a "fire and mostly forget" workflow that still handles edge cases gracefully.

## Proposed Solution

Add a flag like `--allow-interactive` (or `--semi-interactive`) that enables `ask_user` terminal prompts even when a prompt is provided via `-p`:

```bash
copilot -p "fix PR review comments" --allow-interactive
```

Alternatively, this could be the default behavior for `-p` when the process has a controlling TTY (i.e., when it is not piped into another process or running in a CI environment). The fully non-interactive behavior could be preserved when there is no TTY.

## Current Workarounds

1. Use interactive mode and paste the prompt manually (loses the convenience of `-p`)
2. Pre-empt ambiguity in the prompt with instructions like "skip unclear comments"
3. Use autopilot mode interactively (`copilot --experimental` + Shift+Tab)

None of these match the ergonomics of a semi-interactive `-p` mode.

## Additional Context

The `-p` flag is commonly used in scripted/aliased workflows (e.g., `alias fixpr="copilot -p \"fix PR review comments\""`). These workflows benefit from non-interactive execution but occasionally need human judgment. The current all-or-nothing approach forces users to choose between convenience and correctness.

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

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

Hướng nghiên cứu

The issue names no files, tests, or entry points. Start by locating the `-p` option handling and the `ask_user` terminal interaction path, then trace how non-interactive mode is selected. Done means a supported semi-interactive option lets `ask_user` prompts appear and resume execution while preserving non-interactive behavior without a TTY.

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

Đánh giá

Lĩnh vực
cli
Loại issue
Tính năng
Độ 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.