You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--agent <name> selection is dropped ~1s after startup (race with sign-in / MCP reload) #5124
When starting the CLI with --agent <name>, the custom agent is selected and then silently deselected ~1 s later, before any user input. The banner shows Selected custom agent: my-agent, then MCP Servers reloaded: 1 server connected, and the agent disappears from the status bar; the session falls back to the default agent.
It looks like a race between the startup agent selection and the agent/MCP refresh after sign-in. events.jsonl of an affected session (no user input in between):
14:59:11.603 subagent.selected {"agentName":"my-agent"}
14:59:11.765 subagent.selected {"agentName":"my-agent"}
14:59:11.717 subagent.selected {"agentName":"my-agent"} <- out of order, concurrent re-selection
14:59:12.400 subagent.deselected {}
The deselect follows Signed in to https://github.com and the MCP client re-init in the process log (Service initialized as client -> task cancelled -> Service initialized as client).
Affected version
1.0.95
Steps to reproduce the behavior
Have a custom agent available (user-level ~/.copilot/agents/my-agent.md, or plugin-provided).
Start interactively: copilot --agent my-agent
Don't type anything; watch the banner and status bar for ~2 s.
Agent is gone from the status bar; events.jsonl shows subagent.deselected.
Expected behavior
The agent passed via --agent stays selected for the whole session.
Additional context
Frequency (automated pty launches, no input, 15 s each): dropped 5/6 with a user-level agent (--agent my-agent), 4/6 with a plugin agent (--agent myplugin:my-agent).
When MCP startup failed (Failed to start MCP Servers: session not found), the agent was never dropped, which points to the MCP reload / agent-list refresh path clearing the selection.
Workaround: run /agent my-agent after startup.
macOS (Apple Silicon, arm64), zsh, launched via shell alias with --allow-all and several --deny-tool flags.
Activity