Request to Copilot Cloud Agent via custom agent fails with 400 error if model selection does not align
- Lenguaje dominante
- Shell
- Estrellas
- 11.2k
- Forks
- 1.9k
- Merge medio
- 14 h 16 min
- PR fusionados (30 d)
- 6
Descripción
### 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
}
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.