Description
Summary
When using github-copilot/claude-opus-4.7-1m (1M token context window), OpenCode reports context usage against what appears to be a ~200K denominator. Once real usage crosses ~200K, the TUI shows >100% (e.g. 236.9K (118%)) and auto-compaction fires repeatedly in a loop — compact runs, post-compact context is still "over limit" per the same wrong denominator, compact fires again. Burns Copilot tokens and blocks all work in the session.
Environment
- OpenCode
1.14.40
- Windows (pwsh)
- Provider: GitHub Copilot (built-in)
- Model:
github-copilot/claude-opus-4.7-1m (1,000,000 token context)
- Small model:
github-copilot/claude-sonnet-4.6
Expected
- OpenCode reads the actual model context window (1M for this model) and computes the percentage against it. At 236.9K usage the display should be ~24%, not 118%.
- Auto-compact should not fire (well under threshold), and even if a model's limit is genuinely unknown, auto-compact must not re-fire immediately after a no-op compaction.
Actual
- Context window for
claude-opus-4.7-1m-internal is misread as roughly 200K.
- Auto-compact loops indefinitely once real usage crosses that wrong threshold.
Workaround
Disable auto-compaction in ~/.config/opencode/opencode.json:
```json
{
"compaction": { "auto": false }
}
```
This breaks the loop but leaves the wrong percentage display.
Suggested fixes
- Map
claude-opus-4.7-1m-internal (and any other *-1m-* Copilot variants) to a 1M context window in the github-copilot provider definition. Or pull the real limit from the Copilot API where possible.
- Add a loop guard to auto-compact: if a compaction run does not reduce token count below the threshold, do not fire again in the same session without user action.
Plugins
No response
OpenCode version
1.14.40
Steps to reproduce
- Configure OpenCode with
model: github-copilot/claude-opus-4.7-1m.
- Leave
compaction.auto at its default (true).
- Make a long conversation and let it hit auto-compaction.
- Use the session until real token usage exceeds ~200K (well below the model's real 1M limit).
- TUI shows context as e.g.
236.9K (118%).
- Auto-compact fires. After it completes, the percentage is still >100% against the wrong denominator, so it fires again. Loop.
Screenshot and/or share link
Operating System
windows 11
Terminal
Windows Terminal
Description
Summary
When using
github-copilot/claude-opus-4.7-1m(1M token context window), OpenCode reports context usage against what appears to be a ~200K denominator. Once real usage crosses ~200K, the TUI shows >100% (e.g.236.9K (118%)) and auto-compaction fires repeatedly in a loop — compact runs, post-compact context is still "over limit" per the same wrong denominator, compact fires again. Burns Copilot tokens and blocks all work in the session.Environment
1.14.40github-copilot/claude-opus-4.7-1m(1,000,000 token context)github-copilot/claude-sonnet-4.6Expected
Actual
claude-opus-4.7-1m-internalis misread as roughly 200K.Workaround
Disable auto-compaction in
~/.config/opencode/opencode.json:```json
{
"compaction": { "auto": false }
}
```
This breaks the loop but leaves the wrong percentage display.
Suggested fixes
claude-opus-4.7-1m-internal(and any other*-1m-*Copilot variants) to a 1M context window in the github-copilot provider definition. Or pull the real limit from the Copilot API where possible.Plugins
No response
OpenCode version
1.14.40
Steps to reproduce
model: github-copilot/claude-opus-4.7-1m.compaction.autoat its default (true).236.9K (118%).Screenshot and/or share link
Operating System
windows 11
Terminal
Windows Terminal