Skip to content

[Bug] Missing results limitation in IntelliJ getFileResults implementation causing context overflow #11999

@xxsLuna

Description

@xxsLuna

Description

While the VS Code extension properly enforces a limit of 100 results for glob searches (consistent with the \MAX_AGENT_GLOB_RESULTS\ constant in core), the IntelliJ implementation currently neglects this parameter. This oversight results in the entire file list being returned when using broad glob patterns (e.g., */\ with @codebase), leading to immediate context window exhaustion in large repositories.

Technical Root Cause

The issue is twofold:

  1. The \MessageIde\ class in \core/protocol/messenger/messageIde.ts\ fails to forward the \maxResults\ argument to the internal request payload for \getFileResults.
  2. The Kotlin-based \getFileResults\ implementation in the IntelliJ extension does not contain logic to truncate the output from the underlying
    ipgrep\ process based on the \maxResults\ parameter.

Steps to Reproduce

  1. Open a project with a significant file count (tested on a repository with 10k+ files) using the IntelliJ IDEA extension.
  2. Trigger any functionality that utilizes glob search, such as the @codebase\ provider with a broad pattern.
  3. Observe the protocol logs or the resulting LLM error (e.g., 400 Bad Request due to context length).

Expected Behavior

The glob search should strictly adhere to the \maxResults\ limit provided by the core engine, ensuring system stability and consistent behavior across IDEs.

Actual Behavior

The search returns an unfiltered list of all matching files, often exceeding 10k items, which overwhelms the context window.

Environment

  • OS: Windows 11
  • IDE: IntelliJ IDEA
  • Extension Version: Latest (1.0.68)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:context-providersRelates to context providerside:jetbrainsRelates specifically to JetBrains extensionkind:bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions