You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Context window size not handled correctly for Ollama models #411
Describe the bug
Copilot shows for my local model that the context window size is 256K, but Ollama reports 4K. Also after 4K Copilot runs out of context.
To Reproduce
Steps to reproduce the behavior:
Select local model, e.g. qwen3.5:latest
Start conversation with Copilot, context shows 256K in the UI.
Execute ollama ps in the console, which shows 4096 as CONTEXT.
Keep talking to Copilot until you have filled up the 4K.
Message appears:
I don't have context from a previous turn in this conversation. What were you working on? Please share the task or file you'd like me to continue with.
Expected behavior
I would expect one of the two following things:
Ideally: Copilot runs the Ollama model with its maximum context window size. Seemingly the plugin is already reading this information from the Ollama API Reference, as it already shows the 256K.
At least: Copilot shows the correct context window size, so the user knows that he / she has to change it in Ollama (e.g. via modelfile and setting the default context window size for the model).
Screenshots
The context which shows 256K (is 262,1K a rounding issue?) as well that I exceeded 4K.
And the message that we ran out of context, as Copilot cannot remember anything anymore:
Additional context
Add any other context about the problem here.
As I had some time about thinking this: Maybe Copilot should not overwrite / overrule the default context size set in the model. 🤔
People with weaker hardware might set a lower context size than the possible maximum of a model intentionally, either a) so it runs on their hardware or b) it doesn't overspill from GPU / VRAM to CPU / RAM and runs permanent.
Same applies for other parameters, as top_k, top_p, temperature and so on.
But Copilot still might read the value when working with a model, so it can display it correctly. Not sure if it also needs it for doing a compression of the context windows as well as other things.
After some testing, it seems without this bug being solved I cannot use Copilot with Ollama.
Reason is that Copilot always assume the maximum context window, as it fetches that value from the model, not the actual, currently configured context window size.
In my case that means I have to run Qwen3.8B-27B with 256K. And for that I don't have enough VRAM. I mean, I would have a (slight) overspill this or that way, but in this case it is too much and even the answer for the most simplest prompt takes ages.
In the meantime I tried to figure which value from /api/tags or /api/show is used for determine the context window size of the selected model. Putting a web proxy between Ollama and Copilot I tried to play around with some values, by intercepting the JSON payload and modifying it. But none of the values I touched seemed to have any effect. 😵💫
Activity
gerrit-hohl commentedon Aug 19, 2026
As I had some time about thinking this: Maybe Copilot should not overwrite / overrule the default context size set in the model. 🤔
People with weaker hardware might set a lower context size than the possible maximum of a model intentionally, either a) so it runs on their hardware or b) it doesn't overspill from GPU / VRAM to CPU / RAM and runs permanent.
Same applies for other parameters, as
top_k,top_p,temperatureand so on.But Copilot still might read the value when working with a model, so it can display it correctly. Not sure if it also needs it for doing a compression of the context windows as well as other things.
gerrit-hohl commentedon Aug 31, 2026
After some testing, it seems without this bug being solved I cannot use Copilot with Ollama.
Reason is that Copilot always assume the maximum context window, as it fetches that value from the model, not the actual, currently configured context window size.
In my case that means I have to run Qwen3.8B-27B with 256K. And for that I don't have enough VRAM. I mean, I would have a (slight) overspill this or that way, but in this case it is too much and even the answer for the most simplest prompt takes ages.
gerrit-hohl commentedon Sep 1, 2026
In the meantime I tried to figure which value from
/api/tagsor/api/showis used for determine the context window size of the selected model. Putting a web proxy between Ollama and Copilot I tried to play around with some values, by intercepting the JSON payload and modifying it. But none of the values I touched seemed to have any effect. 😵💫Can someone please shed some light on this? 🙏
vayshya commentedon Nov 11, 2026
I have same bug in IDEA.