Request to Copilot Cloud Agent via custom agent fails with 400 error if model selection does not align
- 主要語言
- 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
}
```
貢獻指南
研究方向
Start by reproducing the failure with a custom agent whose model differs from the selected session model, then inspect the Copilot pipeline's “Processing Request (Linux)” output and the reported CAPIError. Done means the cloud agent completes successfully when the selected model and custom-agent model do not align, without the 400 “Requested model not available for session” error.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- github
- 領域
- ai
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100