From 4db6d9d1b99e5bc6644443119f1d0718c605c44f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 29 Apr 2026 18:20:59 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20solve=20#3862=20=E2=80=94=20Copilot=20CL?= =?UTF-8?q?I=20rejects=20prompt=20as=20positional=20arg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Copilot prompt-launch command was built as `copilot -i --allow-tool=write ""`. 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 --- packages/shared/src/agent-command.test.ts | 17 +++++++++++++++++ .../shared/src/agent-permissions-migration.ts | 2 +- packages/shared/src/builtin-terminal-agents.ts | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/agent-command.test.ts b/packages/shared/src/agent-command.test.ts index 6796358105d..8480d45baca 100644 --- a/packages/shared/src/agent-command.test.ts +++ b/packages/shared/src/agent-command.test.ts @@ -60,4 +60,21 @@ describe("buildAgentPromptCommand", () => { expect(command).toStartWith("pi \"$(cat <<'SUPERSET_PROMPT_pi1234'"); expect(command).not.toContain("pi -p"); }); + + it("passes copilot prompts via --prompt flag, not as positional", () => { + // Repro for #3862: `copilot -i ... ""` errors with + // "Expected 0 arguments but got 1." because interactive mode does + // not accept a positional prompt. The prompt must be passed via + // the --prompt flag. + const command = buildAgentPromptCommand({ + prompt: "hello", + randomId: "copilot-1234", + agent: "copilot", + }); + + expect(command).not.toMatch(/\bcopilot\b[^"]*\s-i\b/); + expect(command).toStartWith( + "copilot --allow-tool=write --prompt \"$(cat <<'SUPERSET_PROMPT_copilot1234'", + ); + }); }); diff --git a/packages/shared/src/agent-permissions-migration.ts b/packages/shared/src/agent-permissions-migration.ts index cda447361c9..89236644f4d 100644 --- a/packages/shared/src/agent-permissions-migration.ts +++ b/packages/shared/src/agent-permissions-migration.ts @@ -41,7 +41,7 @@ export const LEGACY_BUILTIN_TERMINAL_AGENT_OVERRIDES: Readonly< }, copilot: { command: "copilot --allow-all", - promptCommand: "copilot -i --allow-all", + promptCommand: "copilot --allow-all --prompt", promptCommandSuffix: "--yolo", }, "cursor-agent": { diff --git a/packages/shared/src/builtin-terminal-agents.ts b/packages/shared/src/builtin-terminal-agents.ts index 294098270ae..649822cfa68 100644 --- a/packages/shared/src/builtin-terminal-agents.ts +++ b/packages/shared/src/builtin-terminal-agents.ts @@ -121,7 +121,7 @@ export const BUILTIN_TERMINAL_AGENTS = [ description: "GitHub's coding agent for planning, editing, and building in your repo.", command: "copilot --allow-tool=write", - promptCommand: "copilot -i --allow-tool=write", + promptCommand: "copilot --allow-tool=write --prompt", includeInDefaultTerminalPresets: true, }), createBuiltinTerminalAgent({