Skip to content

[Bug] Interactive mode activates 0 plugin custom agents while --prompt activates 4 #4592

Description

@peterbax117

Describe the bug

Copilot CLI interactive mode discovers installed plugins but activates zero plugin-contributed custom agents. The same installation and working directory successfully activate four custom agents in non-interactive --prompt mode.

When started interactively with a selected plugin agent, the UI briefly shows the selected agent, then clears it and reports:

Custom agent "<plugin>:<agent>" not found. Available agents: none

/agent then displays:

No custom agents found in this workspace yet.

The session continues as the default agent.

This has a secondary MCP impact: because the selected agent never loads, its mcp-servers: scoping block never applies. All user-global MCP servers start instead of the two bundled by the agent. In the reproduced environment this changed startup from 2 scoped servers to 20 enabled servers, producing authentication prompts and unrelated server failures.

Affected version

Reproduced on:

  • 1.0.81-6
  • 1.0.81-7
  • 1.0.81-8
  • 1.0.81-9

Primary evidence below is from 1.0.81-9 on Windows 11, x86_64, Windows Terminal, PowerShell 7.

Steps to reproduce the behavior

  1. Install or load a Copilot CLI plugin that contributes a custom agent.

  2. Confirm the agent works in prompt mode:

    copilot --allow-all --agent <plugin>:<agent> --model claude-opus-5 --prompt "Reply OK"
  3. Start the same agent interactively from the same working directory:

    copilot --allow-all --agent <plugin>:<agent> --model claude-opus-5
  4. Observe that the agent is initially shown as selected, then clears within about one second.

  5. Run /agent. It reports no custom agents.

  6. Run /mcp. User-global MCP servers are active rather than the selected agent's scoped MCP bundle.

Deterministic A/B from debug logs

Successful non-interactive process:

20:09:45.892 [INFO] Starting Copilot CLI: 1.0.81-9
20:09:46.658 [DEBUG] Plugin activation [agents]: ... plugins=6, loaded=4

Failed interactive process:

20:15:53.416 [INFO] Starting Copilot CLI: 1.0.81-9
20:15:53.628 [DEBUG] ... cli_ready
20:15:53.633 [INFO] Login status unknown
20:15:53.827 [DEBUG] Plugin activation [agents]: ... plugins=6, loaded=0

The interactive process declares ready and activates agents about 0.4 seconds after process start. The prompt process activates agents about 0.8 seconds after process start and loads all four.

Repeated interactive launches consistently produced:

Plugin activation [agents]: ... plugins=6, loaded=0

Repeated --prompt launches consistently produced:

Plugin activation [agents]: ... plugins=6, loaded=4

Expected behavior

Interactive and --prompt modes should activate the same installed plugin custom agents. --agent <plugin>:<agent> should remain selected in interactive mode, and the agent's mcp-servers: scoping should apply before MCP startup.

If agent activation must wait for model/backend initialization, interactive mode should delay activation or retry after initialization rather than permanently caching an empty agent list.

Additional context

The following variables were tested and did not change interactive loaded=0:

  • Trusted versus untrusted working directory
  • Main repository versus linked Git worktree
  • Existing credential versus copilot login --with-token refresh
  • COPILOT_GITHUB_TOKEN present before child-process launch
  • --plugin-dir <plugin-root>
  • Repository-local .github/agents/<agent>.agent.md
  • --add-dir <repository>
  • Removing the enabledPlugins setting
  • CLI versions 1.0.81-6 through 1.0.81-9

A repository-local agent and --add-dir still hit the same early log line and then loaded no agents:

No model backend (auth, legacy provider, or BYOK registry) available, skipping custom agents load
Plugin activation [agents]: ... plugins=6, loaded=0

Refreshing the supported Copilot credential succeeded:

Signed in successfully as <user>

but the next interactive launch still emitted Login status unknown and loaded=0.

This does not appear to be the filename/frontmatter mismatch described in #2475. In this case the filename and frontmatter name match, and /agent lists zero custom agents rather than retaining filename-based entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agentsarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions