Request to Copilot Cloud Agent via custom agent fails with 400 error if model selection does not align
- 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 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
}
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với một custom agent có model khác với model của session đã chọn, sau đó kiểm tra đầu ra “Processing Request (Linux)” của pipeline Copilot và CAPIError được báo cáo. Được xem là hoàn tất khi cloud agent hoàn tất thành công dù model đã chọn và model của custom agent không khớp nhau, mà không gặp lỗi 400 “Requested model not available for session”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- github
- Lĩnh vực
- ai
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100