Description
In long sessions on WSL, OpenCode shows:
Auto Compact Failed
All recovery attempts failed. Please start a new session.
Even though auto-compaction is enabled, the session exits instead of recovering.
In my logs, the original request is over the model limit, and then the recovery compaction request is also over the same limit, so compaction cannot succeed.
Environment
- OpenCode:
1.2.15
- OS: WSL2 Ubuntu 24.04 on Windows 11
- Terminal: Windows Terminal + tmux
- Model:
claude-opus-4-6
- Provider path: OpenCode -> CLIProxyAPI (
/v1/chat/completions) -> Claude
- CLIProxyAPI:
v6.8.39
Steps to reproduce
- Start a long OpenCode session with heavy agent/tool output.
- Keep iterating until context gets large.
- Send another request.
- Observe OpenCode attempting auto compact, then failing with
Auto Compact Failed and asking to start a new session.
Actual behavior
The request fails with prompt is too long, and automatic recovery compaction also fails because the compaction request itself is still too large.
Expected behavior
When compaction recovery would also exceed context window, OpenCode should still recover gracefully (e.g. harder pruning / partial-summary fallback / enforced handoff), instead of ending in unrecoverable state.
Evidence
From local proxy request dumps (sanitized):
- Main request too long:
error-v1-chat-completions-2026-03-03T221723-806d27cc.log
{"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 198817 tokens > 150000 maximum"}}
- Compaction recovery request also too long:
error-v1-chat-completions-2026-03-03T221724-26e0654d.log
{"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 156195 tokens > 150000 maximum"}}
Then additional retries continue failing (221734, 221736, 221748), and OpenCode surfaces Auto Compact Failed.
Related issues
This seems related to existing context/compaction overflow issues:
If needed I can share a minimal reproducible config and full redacted logs.
Description
In long sessions on WSL, OpenCode shows:
Auto Compact FailedAll recovery attempts failed. Please start a new session.Even though auto-compaction is enabled, the session exits instead of recovering.
In my logs, the original request is over the model limit, and then the recovery compaction request is also over the same limit, so compaction cannot succeed.
Environment
1.2.15claude-opus-4-6/v1/chat/completions) -> Claudev6.8.39Steps to reproduce
Auto Compact Failedand asking to start a new session.Actual behavior
The request fails with
prompt is too long, and automatic recovery compaction also fails because the compaction request itself is still too large.Expected behavior
When compaction recovery would also exceed context window, OpenCode should still recover gracefully (e.g. harder pruning / partial-summary fallback / enforced handoff), instead of ending in unrecoverable state.
Evidence
From local proxy request dumps (sanitized):
error-v1-chat-completions-2026-03-03T221723-806d27cc.log{"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 198817 tokens > 150000 maximum"}}error-v1-chat-completions-2026-03-03T221724-26e0654d.log{"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 156195 tokens > 150000 maximum"}}Then additional retries continue failing (
221734,221736,221748), and OpenCode surfacesAuto Compact Failed.Related issues
This seems related to existing context/compaction overflow issues:
If needed I can share a minimal reproducible config and full redacted logs.