provider-llamacpp: context window falls back to 4096 on non-llama.cpp OpenAI-compatible servers (SGLang/vLLM) every turn fails with context/overflow
Environment
- iii CLI / engine 0.24.0
- llm-router 1.4.24
- provider-llamacpp 0.3.11
- provider-openai 1.2.15
- context-manager 1.1.11
- harness 1.8.27
- session-manager 1.0.22
- console (ade) 1.9.34
- shell (ide) 0.12.14Project: Linkly agentic tutorial scaffold (worker-compose.yaml), namespace default. Upstream model server: SGLang serving qwen3.8-27b-sglang via an OpenAI-compatible endpoint (http://192.168.1.55:8000/v1). The model has a 262144-token context window.
Problem
Every console session turn fails immediately with:
context::assemble: remote error (invocation_failed): handler error:
context/overflow: assembled context requires 8200 tokens but usable budget is 1639The console shows: "iii could not run this turn. This looks like a problem inside iii rather than with your provider or your request."
The assembled context needs only ~8.2k tokens, so the 1639-token usable budget looks wrong for a 262k-context model.
For reference, router::models::budget for this model returns:
input:
{
"_caller_worker_id": "7cc9ca60-869a-4bc8-8162-e6133ca1ea5e",
"id": "qwen3.8-27b-sglang",
"provider": "llamacpp"
}
output:
{
"effective_max_output_tokens": 2048,
"model": {
"context_window": 4096,
"id": "qwen3.8-27b-sglang",
"max_output_tokens": 2048,
"provider": "llamacpp",
"supports_structured_output": true,
"supports_tools": true
}
}The catalog says context_window 4096 and max_output_tokens 2048, which with the default 10% reserve explains the 1639 usable budget. I don't know why the catalog reports 4096 when the model actually has 262144.
I have tried to find the cause myself but so far no luck. I checked the llm-router and context-manager configs, the worker logs and the model catalog, but I cannot figure out where the wrong context window comes from or how to fix it.
My guess is that provider-llamacpp cannot detect the context window from SGLang (SGLang does not implement llama.cpp's /props endpoint) and silently falls back to a small default window, but I could not confirm this.
Any hints on what to check next would be appreciated.
Source: iii-hq/iii