github / github/copilot-cli

[Bug] -i initial prompt can remain pending until a second user message on Windows

未关闭
#4,784 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

Starting Copilot CLI with -i/--interactive <prompt> can open the interactive session without executing the supplied initial prompt. The terminal remains responsive. After the user submits another message, the original initial prompt is then executed automatically.

Debug logging shows the pending request is emitted before the foreground session host is registered:

[WARNING] pending-request event was not delivered to the session host
GenericFailure, no session host is registered for session <redacted>
...
[INFO] Starting Copilot CLI: 1.0.84-3
...
[INFO] Registering foreground session: <redacted>

This appears to be a startup ordering/race issue rather than command-line quoting or CR/LF handling.

Affected version

GitHub Copilot CLI 1.0.84-3

Steps to reproduce the behavior
  1. On Windows, open PowerShell.
  2. Run copilot -i "Test of prompt.".
  3. Observe that the interactive UI launches but the supplied prompt may remain unexecuted.
  4. Submit any second message in the session.
  5. Observe that the original Test of prompt. request is then executed automatically.

The same diagnostic ordering occurs when invoking the WinGet executable directly:

& "$env:LOCALAPPDATA\Microsoft\WinGet\Links\copilot.exe" -i "Test of prompt."
Expected behavior

The prompt supplied through -i should execute automatically as soon as the interactive session is ready, without requiring another user message.

Additional context
  • Date reproduced: September 9, 2026
  • OS: Windows, x64
  • Shell: PowerShell 7.6.5
  • Terminal hosts tested: Windows Console Host and Windows Terminal
  • Copilot CLI: 1.0.84-3 (reported as latest)
  • Both the WindowsApps launch alias and direct WinGet executable were tested.
  • The WindowsApps package was repaired from 1.0.83.0 / NeedsRemediation to 1.0.84.0 / Ok; the pending-request warning still occurred afterward with both launch paths.
  • Fresh traces consistently recorded the warning about no registered session host roughly 1.2 seconds before Registering foreground session.
  • Full debug logs are not attached because they may contain environment/account metadata, but can be provided privately if requested.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,在 Windows 上的 PowerShell 中复现 copilot -i "Test of prompt.",并检查 pending-request 事件和 Registering foreground session 条目附近的调试日志。完成的标准是:交互式会话准备就绪后立即执行初始提示,而不需要发送第二条消息。

由索引模型根据 Issue 内容生成。

评估

技术栈
powershell, shell
领域
cli, operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。