Agent Host ignores the selected custom agent: picker resets to "Agent" and the agent prompt is never applied
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.138.0 (commit 7debcd0e2acdea1c52de81bf9ee1620444407dda, x64), Remote-SSH
- OS Version: Linux 6.8.0-124-generic x86_64
Steps to Reproduce:
1. Create `~/.copilot/agents/probe-minimal.agent.md` containing only schema-supported frontmatter fields:
```markdown
---
name: probe-minimal
description: Diagnostic probe. Selection-persistence test only — not for real work.
tools: [view]
---
You are a diagnostic probe agent.
When asked anything, reply with exactly this line and nothing else:
PROBE-MINIMAL ACTIVE — the custom agent prompt reached the model.
```
2. Open an Agent Host session and select **probe-minimal** in the agent picker.
3. Send any prompt, e.g. `hello`.
4. Observe the agent picker, and observe the reply.
**Expected:** the picker keeps showing `probe-minimal`, and the reply is exactly `PROBE-MINIMAL ACTIVE — the custom agent prompt reached the model.`
**Actual:** the picker flips back to `Agent` as soon as the prompt is sent, and the reply is an ordinary assistant reply. The probe sentence never appears, because the agent's prompt was never applied.
---
### Why this is more than a picker glitch
The reset picker is the visible symptom; the actual defect is that the custom agent's prompt never reaches the model, so the agent is silently inert. Session state confirms it.
`~/.copilot/session-state//workspace.yaml` → `client_name: vscode-agent-host`
`~/.copilot/session-state//events.jsonl`, `system.message` event:
| session | system.message length | contains agent text |
| --- | --- | --- |
| `245ce5f1-…` (probe-minimal selected) | 56,840 | `PROBE-MINIMAL` → **false** |
| `2ab9d913-…` (a large custom agent selected) | 56,870 | agent name / distinctive body text → **false** |
The system message instead begins with the stock prompt:
> You are an AI assistant using Copilot SDK in VS Code.
Two further observations consistent with the selection being dropped rather than applied:
- `session.start` carries no agent field at all.
- On send, a deselection event fires and the accompanying model change is a no-op.
The near-identical lengths across a 7-line probe and a large multi-section agent show that nothing from the agent file is being concatenated into the prompt.
### Ruled out before filing
- **Not malformed frontmatter.** The probe uses only fields the loader's schema accepts (`name`, `description`, `tools`, `mcp-servers`, `infer`). A malformed file produces a distinct "custom agent markdown frontmatter is malformed" error, which never appeared.
- **Not agent discovery.** The agents appear in the picker and are selectable, so they are found and parsed.
- **Not a pending migration.** The migrations pane reports "1 of 1 complete — no remaining migrations".
- **Not size- or content-specific.** The minimal probe behaves exactly like a large agent.
### Possibly related
#317944 — "Agent Picker is not pre-selected when creating a new Agent Host session with specific Agent in Agent Window" (`agent-host`, `bug`, `verified`; closed in milestone 1.125.0). That issue concerns picker *pre-selection*. This is broader: an explicitly, manually selected agent is also dropped, and its prompt is not applied. It may be a regression of the same wiring.
### Impact
Custom agents are unusable in the Agent Host. Nothing errors — the picker quietly resets and the model answers normally — so it is easy to believe a custom agent is active when it is not.
Contributor guide
Assessment
This issue has not been assessed yet.