Custom agent frontmatter `model` field rejects array syntax — incompatibility between Copilot CLI and VS Code Copilot Chat
- Vorherrschende Sprache
- Shell
- Sterne
- 11.2k
- Forks
- 1.9k
- Ø Merge
- 14 Std. 16 Min.
- Gemergte PRs (30 T.)
- 6
Beschreibung
### Describe the bug
When a custom agent `.agent.md` file uses an **array** for the `model` frontmatter field (as supported by VS Code Copilot Chat), the GitHub Copilot CLI refuses to load the agent and throws a parse error.
**Error message from Copilot CLI:**
```
The following agents failed to load:
.github/agents/Coordinator.agent.md: custom agent markdown frontmatter is malformed: model: Expected string, received array
```
**Agent frontmatter that triggers the error:**
```yaml
---
name: Coordinator
description: Pure managerial agent that orchestrates implementation by delegating all technical work to specialized subagents.
argument-hint: Coordinate a plan, phase, feature, or code change
tools: [vscode, execute, read, agent, search, web, todo]
model: [GPT-5.4 (copilot), Claude Sonnet 4.6 (copilot)]
---
```
The `model` field being an array is intentional — it allows the agent to declare multiple model fallbacks or alternatives. VS Code Copilot Chat loads and uses this agent correctly. However, the Copilot CLI strictly expects `model` to be a **string**, causing a schema validation failure and preventing the agent from loading entirely.
### Affected version
_No response_
### Steps to reproduce the behavior
1. Create a custom agent file at `.github/agents/MyAgent.agent.md` with the following frontmatter:
```yaml
---
name: MyAgent
description: An agent with multiple model options
model: [GPT-5.4 (copilot), Claude Sonnet 4.6 (copilot)]
---
```
2. Run any `copilot` CLI command that triggers agent loading (e.g. `gh copilot suggest` or open a session that scans `.github/agents/`)
3. Observe the error output on checking /agent
### Expected behavior
The Copilot CLI should accept the `model` field as either a string **or** an array of strings, consistent with how VS Code Copilot Chat parses the same `.agent.md` frontmatter. When an array is provided, the CLI could use the first entry as the primary model, or support model fallback/selection semantics.
At minimum, the schema validation for `model` should align between Copilot CLI and VS Code Copilot Chat to avoid agents that work in one environment failing to load in the other.
### Additional context
_No response_
Beitragsleitfaden
Rechercherichtung
Beginne damit, das Problem mit .github/agents/MyAgent.agent.md zu reproduzieren und das Laden von Agents mit /agent oder einem anderen Befehl zu überprüfen, der .github/agents/ scannt. Verfolge die Frontmatter-Validierung für benutzerdefinierte Agents und vergleiche die akzeptierte Modellstruktur mit VS Code Copilot Chat. Die Aufgabe ist erledigt, wenn Frontmatter für das Modell mit einem Array-Wert ohne den gemeldeten Parse-Fehler geladen wird und vorhandene Agents mit einem Modell als String weiterhin funktionieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- shell, vscode
- Bereich
- cli
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100