Skip to content

Infinite compaction loop on every response even with empty session #31152

Closed as not planned

Description

@GraveEaterMadison
recording_2026-06-07_08.25.46.mp4

Description

OpenCode enters an infinite compaction loop immediately after any message, even "hi" with zero config, no skills, no agents, no commands, and no AGENTS.md/CLAUDE.md files. Every response triggers Build → Compaction → Build → Compaction indefinitely.

Plugins

No response

OpenCode version

1.16.2

Steps to reproduce

  1. Fresh install with no config
  2. Open OpenCode
  3. Type "hi"
  4. Observe infinite Build/Compaction loop

Screenshot and/or share link

Image

Operating System

Arch linux

Terminal

kitty

Activity

  1. github-actions commented on Jun 6, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from all of the above, please add a comment explaining how it differs so maintainers can keep it open.

  2. jiten-core commented on Jun 7, 2026

    @jiten-core

    this is exaly same thing happend with me

  3. bfanger commented on Jun 18, 2026

    @bfanger

    I had this issue too when using a local modal, in my case I was able to solve it by specifing the input limit.

    "models": {
      "Qwen3.6-27B-Fast": {
        "name": "Qwen3.6 27B Fast (MTP 40K)",
        "limit": {
          "context": 40000,
          "input": 40000,
          "output": 32000
        }
      },

    Could be related to #13980

  4. tavurth commented on Jun 26, 2026

    @tavurth

    Interesting that this is happening to me too, but seems to be model dependant.

    MiMo V2.5 (openrouter/xiaomi/mimo-v2.5) started doing this, but swapping to another model still works.

    Uninstalling and reinstalling openrouter does not fix.

    Neither does removing the entire ~/.local/share/openrouter, ~/.config/openrouter and ~/.cache/opencode folders.

    (MiMo was previously working just fine)

    Fixed:

    ~/.config/opencode/config.json

    {
      "provider": {
        "openrouter": {
          "models": {
            "xiaomi/mimo-v2.5": {
              "limit": {
                "context": 1000000,
                "output": 1000000
              }
            }
          }
        }
      }
    }

    openrouter was returning incorrect context for that model. Upstream bug.

  5. SMohsenM commented on Jul 1, 2026

    @SMohsenM

    @tavurth I don’t think it’s an upstream bug. Here are the results from https://openrouter.ai/api/v1/model/xiaomi/mimo-v2.5 . The DigitalOcean provider has a 32K context limit and is currently the top provider.

    {
        "data": {
            "id": "xiaomi/mimo-v2.5",
            "canonical_slug": "xiaomi/mimo-v2.5-20260422",
            "hugging_face_id": "XiaomiMiMo/MiMo-V2.5",
            "name": "Xiaomi: MiMo-V2.5",
            "created": 1776874269,
            "description": "MiMo-V2.5 is a native omnimodal model by Xiaomi. It delivers Pro-level agentic performance at roughly half the inference cost, while surpassing MiMo-V2-Omni in multimodal perception across image and video understanding...",
            "context_length": 1048576,
            "architecture": {
                "modality": "text+image+audio+video->text",
                "input_modalities": [
                    "text",
                    "audio",
                    "image",
                    "video"
                ],
                "output_modalities": [
                    "text"
                ],
                "tokenizer": "Other",
                "instruct_type": null
            },
            "pricing": {
                "prompt": "0.000000105",
                "completion": "0.00000028"
            },
            "top_provider": {
                "context_length": 32000,
                "max_completion_tokens": null,
                "is_moderated": false
            },
            "per_request_limits": null,
            "supported_parameters": [
                "frequency_penalty",
                "include_reasoning",
                "logit_bias",
                "logprobs",
                "max_tokens",
                "presence_penalty",
                "reasoning",
                "repetition_penalty",
                "response_format",
                "seed",
                "stop",
                "structured_outputs",
                "temperature",
                "tool_choice",
                "tools",
                "top_k",
                "top_logprobs",
                "top_p"
            ],
            "default_parameters": {
                "temperature": 1,
                "top_p": 0.95,
                "top_k": null,
                "frequency_penalty": null,
                "presence_penalty": null,
                "repetition_penalty": null
            },
            "supported_voices": null,
            "knowledge_cutoff": null,
            "expiration_date": null,
            "links": {
                "details": "/api/v1/models/xiaomi/mimo-v2.5-20260422/endpoints"
            },
            "benchmarks": {
                "design_arena": [
                    {
                        "arena": "models",
                        "category": "3d",
                        "elo": 1301,
                        "win_rate": 54.3,
                        "rank": 18
                    },
                    {
                        "arena": "models",
                        "category": "asciiart",
                        "elo": 1194,
                        "win_rate": 48.3,
                        "rank": 25
                    },
                    {
                        "arena": "models",
                        "category": "codecategories",
                        "elo": 1304,
                        "win_rate": 55,
                        "rank": 14
                    },
                    {
                        "arena": "models",
                        "category": "dataviz",
                        "elo": 1280,
                        "win_rate": 53.8,
                        "rank": 16
                    },
                    {
                        "arena": "models",
                        "category": "gamedev",
                        "elo": 1301,
                        "win_rate": 55.8,
                        "rank": 16
                    },
                    {
                        "arena": "models",
                        "category": "svg",
                        "elo": 1219,
                        "win_rate": 52.3,
                        "rank": 21
                    },
                    {
                        "arena": "models",
                        "category": "uicomponent",
                        "elo": 1312,
                        "win_rate": 56.2,
                        "rank": 12
                    },
                    {
                        "arena": "models",
                        "category": "website",
                        "elo": 1304,
                        "win_rate": 55.2,
                        "rank": 12
                    }
                ]
            },
            "reasoning": {
                "mandatory": false
            }
        }
    }
    
  6. tavurth commented on Jul 1, 2026

    @tavurth

    @SMohsenM the MiMo V2.5 context limit is actually 1M tokens, and so it's an upstream issue.

    Specifically, it's an issue with the Output tokens limit vs the Context tokens limit.

    A second diagnostic utility here is that it stopped working without upgrading Opencode. So one day it worked, the next day not. I.e. upstream provider issue.

    I dug fairly deeply through the codebase, and there is a way to actively bypass this, but the config change recommended in #31152 (comment) is the better short term approach.

    However, I would suggest opencode show an error dialog in such cases as the passed JSON model config has some undefined values in this case, which could be caught, and then a human input box could be allowed.

  7. github-actions commented on Aug 31, 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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions