anomalyco / anomalyco/opencode
Compaction request exceeds context window on high-output models (v2)
@rekram1-node is already working on this.
Since Aug 14, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
A V2 session using a custom OpenAI-compatible model reached about 236k of its 299,964-token context window (79%). Automatic compaction did not run, and /compact failed because the provider reported that the prompt plus requested output exceeded the context limit.
The model advertises a 131,072-token output limit. SessionCompaction.required() caps its reserved output budget at 32,000, but the compaction LLM.request() does not set generation.maxTokens. OpenAI-compatible lowering therefore leaves max_tokens unset, allowing the provider to use 131,072 instead.
Expected: the compaction request should use the same bounded output budget used to calculate the automatic-compaction threshold.
Before /compact, the model also returned finish=stop with no text or tool calls several times, leaving the TUI with no visible response. This may be a separate empty-response issue.
Plugins
No response
OpenCode version
0.0.0-next-17403
Steps to reproduce
- Configure a custom OpenAI-compatible model with context limit 299964 and output limit 131072.
- Grow a V2 session to approximately 236k tokens, displayed as 79% context usage.
- Observe that automatic compaction does not run.
- Run
/compact. - Observe that the provider rejects the request because the prompt plus requested output exceeds the context window.
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.