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

Đang mở
#2,758 6 bình luận 5 reaction 0 người được giao Xem trên GitHub
area:agents area:models
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### 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
---
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.