Skip to content

fix: solve #3862 — Copilot CLI rejects prompt as positional arg#3863

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-3862-25126027962
Draft

fix: solve #3862 — Copilot CLI rejects prompt as positional arg#3863
github-actions[bot] wants to merge 1 commit into
mainfrom
triage/issue-3862-25126027962

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 29, 2026

Root cause

The Copilot prompt-launch command was being built as:

copilot -i --allow-tool=write "$(cat <<'SUPERSET_PROMPT_…'
<prompt>
SUPERSET_PROMPT_…
)"

The GitHub Copilot CLI treats -i as interactive mode, which accepts no positional arguments. Passing the heredoc-quoted prompt as a positional therefore fails with:

error: too many arguments. Expected 0 arguments but got 1.

This blocks launching Copilot from the new workspace modal whenever a prompt is supplied.

The fix

Replace -i with the --prompt flag in Copilot's promptCommand, placing the flag last so the existing prompt-builder (${command} "$(cat <<EOF…)") emits the heredoc as the value of --prompt:

copilot --allow-tool=write --prompt "$(cat <<'SUPERSET_PROMPT_…' … )"

The same change is applied to LEGACY_BUILTIN_TERMINAL_AGENT_OVERRIDES.copilot.promptCommand in agent-permissions-migration.ts so pre-#3546 users running the YOLO migration are not migrated into the broken shape.

The non-prompt command (copilot --allow-tool=write) is unchanged — Copilot starts in interactive mode by default when no flags are supplied.

Tests

  • Added passes copilot prompts via --prompt flag, not as positional in packages/shared/src/agent-command.test.ts — fails on the buggy copilot -i … shape and passes on the fix.
  • All 614 tests in packages/shared/ pass.

Closes #3862


Summary by cubic

Fixes #3862 by passing Copilot prompts via the --prompt flag instead of a positional arg, so launching from the new workspace modal works again. Interactive mode -i no longer rejects prompts.

  • Bug Fixes
    • Updated copilot promptCommand to copilot --allow-tool=write --prompt "$(cat <<'…')"; removed -i.
    • Applied the same change in LEGACY_BUILTIN_TERMINAL_AGENT_OVERRIDES.copilot.promptCommand to avoid migrating users into the broken command shape.

Written for commit 4db6d9d. Summary will update on new commits. Review in cubic

The Copilot prompt-launch command was built as
`copilot -i --allow-tool=write "<prompt>"`. The Copilot CLI treats
`-i` as interactive mode, which accepts no positional arguments, so
launching from the new workspace modal failed with:

  error: too many arguments. Expected 0 arguments but got 1.

Pass the prompt through Copilot's `--prompt` flag instead, with the
flag placed last so the heredoc-quoted value becomes its argument.
The same fix is applied to the legacy permissions migration so
pre-#3546 users are not migrated into the broken command shape.

Closes #3862
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] GitHub Copilot CLI: error: too many arguments. Expected 0 arguments but got 1.

1 participant