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
tui: compaction triggers around 30–35% with gpt-5.6-sol #38851
In the TUI, automatic compaction consistently triggers when the context indicator reaches only
approximately 30–35% while using openai/gpt-5.6-sol. This causes sessions to be
compacted while most of the reported context window remains available.
Launch the OpenCode 2 beta TUI with openai/gpt-5.6-sol as the active model.
Continue working in a session until the TUI context indicator reaches approximately 30–35%.
Observe that automatic compaction starts at that point.
Expected Behavior
Compaction should occur only when the session approaches the model's usable context
limit. A context indicator showing 30–35% should not cause automatic compaction unless
the displayed percentage or configured model limit is incorrect.
Actual Behavior
Automatic compaction consistently starts around 30–35% reported context usage in the TUI.
Additional Context
The behavior is consistent with openai/gpt-5.6-sol. Other models have not been tested.
No exact error is shown, and no workaround has been identified.
changed the title [-]compaction: triggers around 30–35% context usage with gpt-5.6-sol[/-][+]tui: compaction triggers around 30–35% with gpt-5.6-sol[/+]on Jul 25, 2026
This issue might be a duplicate of or closely related to existing issues. Please check:
context % under-reports for split-window models (divides by limit.context instead of limit.input) #32119: Context % under-reports for split-window models — for models like gpt-5.6-sol that have separate input/output windows, the TUI divides by the total context window instead of the input window, making the displayed percentage appear lower than the actual prompt fill. This could explain why compaction triggers at 30–35% (the real input utilization may be much higher).
19 completed automatic compactions in the affected GPT-5.6 Sol session
17/19 occurred while the TUI showed 33–36%
those turns consistently reported ~370k–375k tokens immediately before compaction
active connection was OpenAI chatgpt-browser OAuth
This fingerprints the ChatGPT Codex backend's ~372k GPT-5.6 input ceiling. V1 already overrides OAuth GPT-5.6 to 500k context / 372k input / 128k output; V2 omitted that transform and advertised Models.dev's public API limits (1.05M / 922k / 128k). The provider therefore overflowed near 372k, V2 correctly ran overflow-recovery compaction, and the TUI divided usage by the stale 1.05M catalog limit: ~35.4%.
#32119 only changes that display to ~40% (372k / 922k), so it does not explain or fix this case. #35863 is adjacent, but this is specifically credential-dependent catalog metadata.
The PR ports V1's OAuth limits into V2, leaves API-key users unchanged, reloads limits when connection changes, and avoids refreshing credentials during catalog inspection. Full core suite: 1081 pass; monorepo typecheck: 30 packages.
Separate secondary finding: V2 preflight estimates JSON.stringify(request).length / 4; two outlier compactions at 5.6% and 21.7% likely come from that heuristic. That should be tracked separately from this reproducible 35% OAuth ceiling.
Correction: #38987 is the existing maintainer-requested comprehensive fix and targets the actual v2 branch. It covers the credential-specific Codex catalog, preserves input limits through model resolution, budgets compaction against the input window, and fixes TUI reporting. I closed my narrower duplicate #39541 and added the empirical 370k–375k evidence to #38987.
Current clean fix: #39545. This supersedes stale/conflicting #38987 with the same Kit-authored implementation rebased onto latest v2; focused tests and all 33 monorepo typechecks pass.
Using a custom provider model with context max set to 500k , i am facing repeated reproducible scenarios that a single prompt ask it to read a lot of long files, upon reading multiple files with context filling up to around 50%, it auto compacts, which should be abnormal. Is this related? any fix?
opencode v 1.18.8
Activity
[-]compaction: triggers around 30–35% context usage with gpt-5.6-sol[/-][+]tui: compaction triggers around 30–35% with gpt-5.6-sol[/+]github-actions commentedon Jul 25, 2026
This issue might be a duplicate of or closely related to existing issues. Please check:
gpt-5.6-solthat have separate input/output windows, the TUI divides by the total context window instead of the input window, making the displayed percentage appear lower than the actual prompt fill. This could explain why compaction triggers at 30–35% (the real input utilization may be much higher).gpt-5.6-sol's effective input window is smaller than what OpenCode has catalogued, compaction would trigger at a lower percentage than expected.magoz commentedon Jul 29, 2026
Root cause confirmed and fix opened: #39541.
Diagnostics from a read-only DB backup:
chatgpt-browserOAuthThis fingerprints the ChatGPT Codex backend's ~372k GPT-5.6 input ceiling. V1 already overrides OAuth GPT-5.6 to
500k context / 372k input / 128k output; V2 omitted that transform and advertised Models.dev's public API limits (1.05M / 922k / 128k). The provider therefore overflowed near 372k, V2 correctly ran overflow-recovery compaction, and the TUI divided usage by the stale 1.05M catalog limit: ~35.4%.#32119 only changes that display to ~40% (
372k / 922k), so it does not explain or fix this case. #35863 is adjacent, but this is specifically credential-dependent catalog metadata.The PR ports V1's OAuth limits into V2, leaves API-key users unchanged, reloads limits when connection changes, and avoids refreshing credentials during catalog inspection. Full core suite: 1081 pass; monorepo typecheck: 30 packages.
Separate secondary finding: V2 preflight estimates
JSON.stringify(request).length / 4; two outlier compactions at 5.6% and 21.7% likely come from that heuristic. That should be tracked separately from this reproducible 35% OAuth ceiling.magoz commentedon Jul 29, 2026
Correction: #38987 is the existing maintainer-requested comprehensive fix and targets the actual
v2branch. It covers the credential-specific Codex catalog, preserves input limits through model resolution, budgets compaction against the input window, and fixes TUI reporting. I closed my narrower duplicate #39541 and added the empirical 370k–375k evidence to #38987.magoz commentedon Jul 29, 2026
Current clean fix: #39545. This supersedes stale/conflicting #38987 with the same Kit-authored implementation rebased onto latest
v2; focused tests and all 33 monorepo typechecks pass.CoderTom314 commentedon Jul 29, 2026
Using a custom provider model with context max set to 500k , i am facing repeated reproducible scenarios that a single prompt ask it to read a lot of long files, upon reading multiple files with context filling up to around 50%, it auto compacts, which should be abnormal. Is this related? any fix?
opencode v 1.18.8
github-actions commentedon Sep 28, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.