Skip to content

OpenCode immediately triggers “Input exceeds context window” and auto-compaction in empty sessions after latest update #27315

Closed as duplicate

Description

@evscott

Description

Since updating to the latest version, every new session immediately reports “Input exceeds context window of this model” and then automatically begins compacting the session, even when launched in a completely empty directory with no files or context loaded.

This happens consistently across multiple OpenAI models, including GPT-5.5.

The issue appears before any meaningful prompt or conversation history exists, even in an empty directory.

Plugins

None

OpenCode version

1.14.48

Steps to reproduce

  1. Update OpenCode to the latest version
  2. Open a completely empty directory
  3. Launch OpenCode
  4. Type a very short prompt (e.g. "hi")
  5. Observe immediate “Input exceeds context window of this model” automatic compaction process

Screenshot and/or share link

Image

Operating System

macOS 15.6.1

Terminal

Ghostty

Activity

  1. github-actions commented on May 13, 2026

    @github-actions
    Contributor

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

  2. evscott commented on May 13, 2026

    @evscott
    Author

    I think I narrowed this down to having something to do with the Posthog MCP. Removing it from my config resolves the issue.

    For example, this is my config which results in Input exceeds context window of the model

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "posthog": {
          "type": "remote",
          "url": "https://mcp.posthog.com/mcp",
          "enabled": true
        },
        "sentry": {
          "type": "remote",
          "url": "https://mcp.sentry.dev/mcp",
          "oauth": {},
          "enabled": true
        },
      },
      "agent": {
        "plan": {
          "model": "openai/gpt-5.5",
          "tools": {
            "write": false,
            "edit": false,
            "bash": true,
            "webfetch": true
          }
        },
        "build": {
          "model": "openai/gpt-5.5",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "webfetch": true
          }
        },
      }
    }
    

    Whereas this works fine

    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "sentry": {
          "type": "remote",
          "url": "https://mcp.sentry.dev/mcp",
          "oauth": {},
          "enabled": true
        },
      },
      "agent": {
        "plan": {
          "model": "openai/gpt-5.5",
          "tools": {
            "write": false,
            "edit": false,
            "bash": true,
            "webfetch": true
          }
        },
        "build": {
          "model": "openai/gpt-5.5",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "webfetch": true
          }
        },
      }
    }
    

    I'll leave open the issue incase you want to do something about this (not sure what). But, feel free to close it otherwise. I'm unblocked at least.

  3. antonlvovych commented on May 13, 2026

    @antonlvovych

    same for me - also just after installed posthog mcp. endless auto compaction loop starting with any session, including completely new ones

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