github / github/copilot-cli

Feature Request: Allow sub-agents to use the model specified in frontmatter/task() — add opt-out for the cost-multiplier guard

Aberta
#2,758 6 comentários 5 reações 0 responsáveis Ver no GitHub
area:agents area:models
Linguagem predominante
Shell
Estrelas
11.2k
Forks
1.9k
Merge médio
14h 16min
PRs com merge (30d)
6

Descrição

### Describe the feature or problem you'd like to solve

Allow sub-agents to use the model specified in their `.agent.md` frontmatter or `task()` call's `model` parameter, by adding an opt-out flag for the cost-multiplier guard that currently silently downgrades sub-agent models to the cheapest available model.

### Proposed solution

Add a configuration flag (e.g., `allowSubagentModelUpgrade: true` in `~/.copilot/config.json` or `--allow-subagent-model-upgrade` CLI flag) that lets users opt out of the cost-multiplier guard that silently downgrades sub-agent models.

Currently, when a session runs on a 0× model (e.g., GPT-4.1), every sub-agent model override — whether via `model:` frontmatter in `.agent.md` or the `model` parameter in `task()` calls — is silently downgraded to the session default. Process logs confirm:

```
Downgrading subagent model from "claude-sonnet-4.6" (1x) to session model "gpt-4.1" (0x).
```

This prevents a common and valuable pattern: **tiered multi-agent orchestration** — using a free model for routine tasks (reads, searches, navigation) while delegating complex work to premium models (Sonnet for code, Opus for architecture). Users who are aware of the cost implications and willing to spend their premium request budget should be able to opt in.

### Example prompts or workflows

1. **Tiered delegation (primary use case):**
Session on GPT-4.1 (0×). User says "Review the architecture of this service." GPT-4.1 gathers context (free) then delegates to an `advisor` agent with `model: claude-opus-4.6` (3×). Today: advisor runs on GPT-4.1. Expected: advisor runs on Opus.

2. **Custom agent model enforcement:**
`.agent.md` with `model: claude-sonnet-4.6` in frontmatter. When invoked as a sub-agent from a free session, the frontmatter model should be honored. Today: silently downgraded.

3. **Cost-conscious exploration + quality implementation:**
User navigates codebase with GPT-4.1 (free), then delegates "Write tests for this component" to a specialist agent with `model: claude-sonnet-4.6`. Today: tests written by GPT-4.1. Expected: tests written by Sonnet.

4. **Plugin agents with model requirements:**
A plugin author distributes agents that require specific models for quality (e.g., a code reviewer that needs Opus). Today: the model requirement is ignored. Expected: honored when the user opts in.

5. **Budget-aware workflows:**
Combined with `/usage`, users can monitor spend and make informed decisions about when to invoke premium sub-agents vs. stay on the free tier.

### Additional context

### Evidence

- **Confirmed behavior via process logs:** `Downgrading subagent model from "claude-sonnet-4.6" (1x) to session model "gpt-4.1" (0x)` — tested on v1.0.28
- **Workaround exists but loses features:** Spawning separate `copilot --agent X --model Y -p "..."` processes bypasses the guard (each is a top-level session), but loses session integration: shared context, multi-turn refinement, streaming, `/tasks`, `/diff` tracking
- **Sonnet session workaround is partial:** Setting session to Sonnet (1×) avoids the guard for ≤1× sub-agents, but costs 1× for every prompt including simple reads

### Related issues

- #1354 — Model routing, per-agent model selection, and global hooks support
- #2564 — Does `model:` in agent frontmatter and `task()` calls control model selection? (closed, fix shipped in v1.0.22 but cost guard still applies)
- #2492 — Plugin agents ignore `model:` frontmatter (closed)

### Suggested configuration shapes

```json
// ~/.copilot/config.json
{ "allowSubagentModelUpgrade": true }
```

```bash
# CLI flag
copilot --allow-subagent-model-upgrade
```

```yaml
# Per-agent frontmatter (most granular)
---
model: claude-opus-4.6
force-model: true
---
```

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start by tracing sub-agent model selection from `.agent.md` frontmatter and the `task()` model parameter, then inspect `~/.copilot/config.json` and CLI option handling. Reproduce the logged downgrade from GPT-4.1 to the requested model and verify that an opt-out allows the upgrade while the default guard remains unchanged.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
shell
Domínio
cli, developer-experience
Tipo de issue
Funcionalidade
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
43/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.