Performance degradation and long "Thinking" timeouts after multiple context compactions · Issue #50103 · anomalyco/opencode · GitHub
Skip to content

Performance degradation and long "Thinking" timeouts after multiple context compactions #50103

Open

Description

@PrEvAl85

Description

I've noticed a consistent performance issue during long sessions. After performing around 6–7 consecutive compaction operations, the following symptoms occur:

Stuck in "Thinking" state: The model hangs in the thinking phase indefinitely (in some cases for up to an hour before timing out or disconnecting).

Dropped responses: The model either stops generating output entirely or requires repeating the same prompt multiple times to get a response.

Cumulative degradation: The more compaction cycles the context undergoes within a single session, the worse the stability and response times become.

Additional Context:

This behavior reproduces regardless of the selected model (tested across various LLMs via API / OpenRouter).

The issue is directly tied to the accumulation of history and the number of compaction cycles.

Questions:

Is this a known issue, and could it be related to how context compaction is implemented in OpenCode?

Could this be caused by the compacted context/system prompt becoming too noisy or degraded for the model's attention mechanism as the context window fills up, or is it an issue with sending a massive history payload from the client side?

Are there recommended configuration settings for clearing or limiting system history to prevent this degradation without losing critical session context?

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. GangstaVik commented on Sep 20, 2026

    @GangstaVik

    +1 I've noticed this as well

    Also related to the infinite thinking thing, I noticed that it could sometimes trigger and infinite compaction loop as well w/o producing results no matter the endpoint being used so this must be a client-side bug / issue to fix because it burns tokens asf repeating the same stuff over and over again w/o getting anywhere at all T_T

  2. opencodejr commented on Oct 28, 2026

    @opencodejr

    Thanks for the report! To look into this we need a few more details:

    • OpenCode version (opencode --version)
    • OS and install method, plus whether you use the TUI, desktop app or web app (and which terminal, for the TUI)
    • One specific provider/model where it happens, e.g. openrouter/<model>
    • Rough steps: what kind of session it was (lots of tool calls, file reads, subagents?), and whether compaction was automatic or triggered by /compact
    • What you see while it's stuck: any error, whether tokens/cost are still updating, and whether aborting and resending recovers it
    • If you can, logs from a session where it got stuck (run with --print-logs --log-level DEBUG or check the log directory), and/or a share link

    You can reply here with the details or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

    These existing issues look related, ordered from most to least likely. Please check whether one of them already covers your problem:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions