Skip to content

Auto Compact Failed when recovery compaction request is also over context limit (WSL + Claude Opus 4.6 via CLIProxyAPI) #15849

Closed as not planned

Description

@oinani0721

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

  1. Start a long OpenCode session with heavy agent/tool output.
  2. Keep iterating until context gets large.
  3. Send another request.
  4. 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):

  1. 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"}}
  1. 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.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 3, 2026
  2. github-actions commented on Mar 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    You may also want to follow #10634 and #10220 which you already referenced, as fixes there could address this as well.

  3. github-actions commented on May 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions