Skip to content

fix(copilot): use --additional-mcp-config so Copilot does not exit before prompt#188

Merged
johannesjo merged 1 commit into
johannesjo:mainfrom
anxkhn:fix/copilot-exits-before-prompt
Jun 29, 2026
Merged

fix(copilot): use --additional-mcp-config so Copilot does not exit before prompt#188
johannesjo merged 1 commit into
johannesjo:mainfrom
anxkhn:fix/copilot-exits-before-prompt

Conversation

@anxkhn

@anxkhn anxkhn commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #146

Problem

Parallel Code runs agents as interactive PTY REPLs and types the queued prompt once the TUI is ready. With Copilot, the process exits on launch before the prompt is sent, surfacing as "Agent exited before prompt was sent".

Root cause: when the MCP coordinator is wired in, Copilot was grouped with the Claude-compatible agents and launched with --mcp-config <path>. Copilot has no such flag and exits immediately:

$ copilot --mcp-config /tmp/x.json
error: unknown option '--mcp-config'

This happens whenever Copilot runs as a coordinator agent or a coordinated sub-agent (the core multi-agent workflow).

Fix

Use Copilot's real flag. Copilot reads MCP config from --additional-mcp-config <@file|json> and auto-discovers the workspace .mcp.json that Parallel Code already writes; both take the same { "mcpServers": {...} } shape. Map Copilot to --additional-mcp-config @<configPath> in both the backend launch-arg builder (electron/mcp/agent-args.ts) and the renderer fallback (src/lib/agent-args.ts), mirroring the existing Codex and Antigravity special cases. Also wire Copilot session resume via --continue.

Testing (on this machine, copilot v1.0.65, real PTY)

  • Before: copilot --mcp-config @file exits with "unknown option". After: copilot --additional-mcp-config @file launches and stays interactive.
  • copilot mcp list confirms it auto-discovers the app's .mcp.json (parallel-code (local)).
  • copilot --continue with no prior session starts fresh without error.
  • npm run typecheck, npm run lint (eslint, max-warnings 0), npm run format:check, npm run lint:arch (dependency-cruiser), and the full npm test (vitest, 1433 tests) pass. Added unit tests for the Copilot command detection, the --additional-mcp-config mapping, and the resume arg ordering.

…fore prompt

Copilot was launched with `--mcp-config <path>`, a flag it does not
support. Copilot rejects it with "error: unknown option '--mcp-config'"
and exits immediately, before Parallel Code can send the queued prompt.
That surfaces in the UI as "Agent exited before prompt was sent". It
happens whenever the Parallel Code MCP coordinator is wired into Copilot
(running Copilot as a coordinator agent or as a coordinated sub-agent).

Copilot has no `--mcp-config` flag. It accepts `--additional-mcp-config
<@file|json>` (the same config shape) and also auto-discovers the
workspace `.mcp.json` that Parallel Code already writes. Map Copilot to
`--additional-mcp-config @<configPath>` in both the backend launch-arg
builder (electron/mcp/agent-args.ts) and the renderer fallback
(src/lib/agent-args.ts), mirroring the existing Codex and Antigravity
special cases.

Also wire Copilot session resume via `--continue` (resume the most recent
session, like Claude), which previously had no resume args.

Fixes johannesjo#146
@johannesjo

Copy link
Copy Markdown
Owner

Thank you very much! <3

@johannesjo johannesjo merged commit 21c59b1 into johannesjo:main Jun 29, 2026
2 checks passed
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.

Copilot CLI Agent Exits Before Prompt Sent

2 participants