anomalyco / anomalyco/opencode

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

Open
#50,103 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, version, or reproduction steps are provided. Start by reproducing the problem after 6–7 consecutive compactions across the reported models, then trace context-compaction and history handling; done means identifying the cause of the hangs or degradation and verifying stable responses after repeated compactions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai-infra-agents, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.