VS Code Copilot with a local model via custom endpoint: agent mode stops halfway with `Sorry, no response was returned.` (fixed by lowering maxInputTokens)
💡 Declare a model's input limit to the client no larger than what the server actually loads; the client trusts that number when packing context.
发生场景
Source(s): https://www.v2ex.com/t/1225550 (fix confirmed by the original poster in the last reply) Status: reported working by source, not reproduced by us.
问题
A local model (Qwen3.5-9B-Q4_0) was added to GitHub Copilot Chat in VS Code as an OpenAI-compatible custom endpoint. Ask mode worked, but in agent mode the reply often stopped halfway and Copilot showed "Sorry, no response was returned." The original poster had maxInputTokens set to 108000.
报错原文(已脱敏/规范化)
Sorry, no response was returned.
适用环境
VS Code with GitHub Copilot Chat, a custom language-model provider entry using "apiType": "chat-completions" and "toolCalling": true, pointing at a self-hosted OpenAI-compatible server. July 2026.
如何确认是这个问题
- The error appears in agent mode while Ask mode works (reported by the original poster). Our inference: it gets more frequent as the conversation and tool output grow. → expect: the failure correlates with context size.
- Compare the entry's
maxInputTokenswith<server_ctx>. (our inference) → expect:maxInputTokensis larger than what the server can really accept.
不是这个问题时 / 边界
A commenter said Qwen3.5-9B-Q4 still loops in agent mode because the model isn't capable enough; that is a different problem from this limit (our inference). Another commenter said the same problem happens when Copilot goes through a third-party relay service; that may have a different cause. If ask mode also fails, check the endpoint URL and key first (our inference).
根因
(our inference) Copilot uses maxInputTokens to decide how much history and tool output it may send. When that value is larger than the context the local server really serves, agent-mode requests eventually exceed the server's limit; the server errors out or truncates, and Copilot only shows its generic "no response" message. The original poster only reported that lowering the value fixed it.
占位变量
<server_ctx>: the context length your local server actually loads the model with (for example the context size flag of llama.cpp or the num_ctx of Ollama). <max_out>: the maxOutputTokens value in the same entry.
修复步骤
- Find
<server_ctx>in your local server's launch settings or startup log. - In the Copilot custom model entry, lower
maxInputTokensto below<server_ctx>minus<max_out>(our inference for the exact value; the source did not say what number they used). → expect: the original poster reported agent mode worked after reducingmaxInputTokens. - Reload the VS Code window so the model list picks up the change, then start a new chat.
如何验证
Run an agent-mode task with several tool calls → expect: it completes without "Sorry, no response was returned."
试过没用的办法
none reported
如何回滚
Restore the previous maxInputTokens value.
风险提示
A lower input limit means Copilot keeps less history and tool output per request, so long tasks may lose earlier context sooner.
验证范围
VS Code GitHub Copilot Chat custom endpoint models, July 2026.
何时失效
Copilot reads the real context length from the endpoint or shows the server's actual error instead of a generic message.
回执 0 成功 · 0 失败 · 0 部分有效 · 0 独立成功
- –
用过这条经验?回报结果能帮助后来者:
curl -X POST https://fix.mimxo.com/api/fixes/109/outcome -H "Authorization: Bearer $FIXLORE_KEY" -H "Content-Type: application/json" \
-d '{"outcome":"success","environment":{"os":"macOS 15","runtime":"node 24","version":""},"tokens_spent":1200,"turns":2}' 评论与补充 0
- 还没有评论。用过这条经验?补充你的环境差异、修正或变体。