Bug type
Crash (process/app exits or hangs)
Beta release blocker
No
Summary
Summary
When using OpenClaw with a local Ollama model, OpenClaw ignores the configured compaction reserve settings and still runs context-overflow precheck with reserveTokens=16384.
This causes immediate false context-overflow failures before generation, even though:
openclaw config get agents.defaults.compaction.reserveTokens returns 2048
openclaw config get agents.defaults.compaction.reserveTokensFloor returns 0
Environment
- OpenClaw:
2026.4.10
- Deployment: Docker
- Hardware: Raspberry Pi
- Provider: Ollama (local)
- Model:
qwen3.5:0.8b
Ollama setup
Direct Ollama works:
ollama run qwen3.5:0.8b works
- direct API calls to
http://ollama:11434/api/chat work
The issue only appears through OpenClaw.
Relevant config
json5
{
agents: {
defaults: {
llm: { idleTimeoutSeconds: 600 },
compaction: {
reserveTokens: 2048,
reserveTokensFloor: 0
}
}
},
models: {
providers: {
ollama: {
baseUrl: "http://ollama:11434/",
apiKey: "ollama-local",
api: "ollama",
models: [
{
id: "qwen3.5:0.8b",
name: "qwen",
contextWindow: 320192,
contextTokens: 16384,
maxTokens: 256,
compat: { supportsTools: false }
}
]
}
}
}
}
Verification
Inside the running environment:
bash
openclaw config get agents.defaults.compaction.reserveTokens
2048
openclaw config get agents.defaults.compaction.reserveTokensFloor
0
Repro steps
- Configure Ollama local provider as above.
- Restart OpenClaw.
- Run:
bash
openclaw infer model run --model ollama/qwen3.5:0.8b --prompt "hi" --json
- Observe logs.
Actual behavior
OpenClaw still uses reserveTokens=16384 during precheck:
16:32:35+00:00 [agent] low context window: ollama/qwen3.5:0.8b ctx=16384 (warn<32000) source=model
16:32:36+00:00 [agent] [context-overflow-precheck] sessionKey=agent:main:main provider=ollama/qwen3.5:0.8b route=compact_only estimatedPromptTokens=78 promptBudgetBeforeReserve=1 overflowTokens=77 toolResultReducibleChars=0 reserveTokens=16384 sessionFile=/home/node/.openclaw/agents/main/sessions/da60b568-2654-4d9c-9631-c9fb413bcc7f.jsonl
16:32:36+00:00 [agent] [context-overflow-diag] sessionKey=agent:main:main provider=ollama/qwen3.5:0.8b source=promptError messages=1 sessionFile=/home/node/.openclaw/agents/main/sessions/da60b568-2654-4d9c-9631-c9fb413bcc7f.jsonl diagId=ovf-mnvzfbc6-Gqk76Q compactionAttempts=0 observedTokens=unknown error=Context overflow: prompt too large for the model (precheck).
16:32:36+00:00 [agent] context overflow detected (attempt 1/3); attempting auto-compaction for ollama/qwen3.5:0.8b
16:32:37+00:00 [compaction-safeguard] Compaction safeguard: no real conversation messages to summarize; writing compaction boundary to suppress re-trigger loop.
16:32:37+00:00 [agent] auto-compaction succeeded for ollama/qwen3.5:0.8b; retrying prompt
16:32:37+00:00 [agent] [context-overflow-precheck] sessionKey=agent:main:main provider=ollama/qwen3.5:0.8b route=compact_only estimatedPromptTokens=122 promptBudgetBeforeReserve=1 overflowTokens=121 toolResultReducibleChars=0 reserveTokens=16384 sessionFile=/home/node/.openclaw/agents/main/sessions/da60b568-2654-4d9c-9631-c9fb413bcc7f.jsonl
And the command returns:
```json
{
"ok": true,
"capability": "model.run",
"transport": "local",
"provider": "ollama",
"model": "qwen3.5:0.8b",
"attempts": [],
"outputs": [
{
"text": "Context overflow: prompt too large for the model. Try /reset (or /new) to start a fresh session, or use a larger-context model.",
"mediaUrl": null
}
]
}
## Expected behavior
If `agents.defaults.compaction.reserveTokens=2048` and `reserveTokensFloor=0` are configured and visible via `openclaw config get`, the precheck should use those values instead of `16384`.
At minimum, the runtime should not hardcode or retain the old reserve value after config override + restart.
## Notes
Originally I also hit idle-timeout behavior with larger context settings, but the confirmed issue here is narrower and reproducible: the configured compaction reserve values are not honored in the runtime precheck path.
### Steps to reproduce
Start OpenClaw using a local ollama model on a Raspberry PI.
### Expected behavior
I can use the chat.
### Actual behavior
I get the following error:
Context overflow: prompt too large for the model. Try /reset (or /new) to start a fresh session, or use a larger-context model.
### OpenClaw version
2026.4.10`
### Operating system
Raspberry Pi OS
### Install method
docker
### Model
ollama --> `qwen3.5:0.8b`
### Provider / routing chain
openclaw -> ollama
### Additional provider/model setup details
_No response_
### Logs, screenshots, and evidence
```shell
Impact and severity
No response
Additional information
No response
Bug type
Crash (process/app exits or hangs)
Beta release blocker
No
Summary
Summary
When using OpenClaw with a local Ollama model, OpenClaw ignores the configured compaction reserve settings and still runs context-overflow precheck with
reserveTokens=16384.This causes immediate false context-overflow failures before generation, even though:
openclaw config get agents.defaults.compaction.reserveTokensreturns2048openclaw config get agents.defaults.compaction.reserveTokensFloorreturns0Environment
2026.4.10qwen3.5:0.8bOllama setup
Direct Ollama works:
ollama run qwen3.5:0.8bworkshttp://ollama:11434/api/chatworkThe issue only appears through OpenClaw.
Relevant config
json5
{
agents: {
defaults: {
llm: { idleTimeoutSeconds: 600 },
compaction: {
reserveTokens: 2048,
reserveTokensFloor: 0
}
}
},
models: {
providers: {
ollama: {
baseUrl: "http://ollama:11434/",
apiKey: "ollama-local",
api: "ollama",
models: [
{
id: "qwen3.5:0.8b",
name: "qwen",
contextWindow: 320192,
contextTokens: 16384,
maxTokens: 256,
compat: { supportsTools: false }
}
]
}
}
}
}
Verification
Inside the running environment:
bash
openclaw config get agents.defaults.compaction.reserveTokens
2048
openclaw config get agents.defaults.compaction.reserveTokensFloor
0
Repro steps
bash
openclaw infer model run --model ollama/qwen3.5:0.8b --prompt "hi" --json
Actual behavior
OpenClaw still uses
reserveTokens=16384during precheck:Impact and severity
No response
Additional information
No response