github / github/copilot-cli

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

Open
#4,784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing copilot -i "Test of prompt." in PowerShell on Windows and inspect the debug log around the pending-request event and Registering foreground session entry. Done means the initial prompt executes as soon as the interactive session is ready, without requiring a second message.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.