github / github/copilot-cli

Request to Copilot Cloud Agent via custom agent fails with 400 error if model selection does not align

未关闭
#2,695 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:agents area:models
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

When assigning a Copilot Cloud custom agent to an issue, any model selection (including `auto`) that does not align with the `model:` field in the custom agent specification crashes the agent with the error `CAPIError: 400 Requested model not available for session`, even after logs indicate that the model has correctly been overridden from the agent definition for that session.

### Affected version

N/A - Github Copilot Cloud Agent

### Steps to reproduce the behavior

1. Create a custom agent definition on a repo with a model definition (e.g. `model: Claude Opus 4.6`)
2. Assign an issue to Copilot (cloud agent) on the repo
3. In the "Assign agent to issue" modal, select the custom agent AND select a mis-matching model (e.g. `Auto` or `Claude Sonnet 4.6`)
4. Observe how the agent session fails with error `CAPIError: 400 Requested model not available for session`

### Expected behavior

Copilot correctly overrides the chosen session model and completes without errors.

### Additional context

Truncated output of `Processing Request (Linux)` step of Copilot pipeline (in this case with `auto` model selected):
```
Custom agent "procedure-agent" specifies model "Claude Opus 4.6" (resolved to "claude-opus-4.6"), overriding session model "sweagent-capi:claude-sonnet-4.6"

[...]

CAPIError 400 Requested model not available for session
ERROR: {
"name": "CAPIError",
"text": "Copilot has encountered an internal error. If the problem persists, please contact GitHub Support, including the request ID `9408:185805:9A4587:A75A6B:69DE0218`. To retry, leave a comment on this pull request asking Copilot to try again.",
"stack": "CAPIError: 400 Requested model not available for session\n at _0x54111a.fromAPIError (file:///home/runner/work/_temp/***-action-main/dist/index.js:28:8030557)\n at WLe.getCompletionWithTools (file:///home/runner/work/_temp/***-action-main/dist/index.js:28:8048929)\n at process.processTicksAndRejections (node:internal/process/task_queues:104:5)\n at async mce.getCompletionWithTools (file:///home/runner/work/_temp/***-action-main/dist/index.js:28:8187000)\n at async _We.runCompletionWithTools (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:36193)\n at async _0x1879ec (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:33944)\n at async _We.agent (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:34283)\n at async _We.runAgentLoop (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:44134)\n at async _We.runAgentLoopAndEvaluate (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:45005)\n at async _We.runAgent (file:///home/runner/work/_temp/***-action-main/dist/index.js:152:65753)",
"message": "400 Requested model not available for session",
"request_id": "00000-eede4b63-803d-4177-bcd9-2ea6893ffbc2",
"ghRequestId": "9408:185805:9A4587:A75A6B:69DE0218",
"service": "capi",
"code": "400",
"skipReport": false,
"isVisionFlow": false
}
```

贡献指南

打开贡献指南

调研方向

首先,使用模型不同于所选会话模型的 custom agent 复现该故障,然后检查 Copilot pipeline 的“Processing Request (Linux)”输出以及报告的 CAPIError。当所选模型与 custom agent 的模型不一致时,cloud agent 仍能成功完成,且不会出现 400“Requested model not available for session”错误,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
github
领域
ai
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。