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:
- The
MessageIde class in core/protocol/messenger/messageIde.ts fails to forward the maxResults argument to the internal request payload for getFileResults.
- The Kotlin-based
getFileResults implementation in the IntelliJ extension does not contain logic to truncate the output from the underlying ripgrep process based on the maxResults parameter.
Steps to Reproduce
- Open a project with a significant file count (tested on a repository with 10k+ files) using the IntelliJ IDEA extension.
- Trigger any functionality that utilizes glob search, such as the
@codebase provider with a broad pattern.
- 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)
Description
While the VS Code extension properly enforces a limit of 100 results for glob searches (consistent with the
MAX_AGENT_GLOB_RESULTSconstant 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:
MessageIdeclass incore/protocol/messenger/messageIde.tsfails to forward themaxResultsargument to the internal request payload forgetFileResults.getFileResultsimplementation in the IntelliJ extension does not contain logic to truncate the output from the underlyingripgrepprocess based on themaxResultsparameter.Steps to Reproduce
@codebaseprovider with a broad pattern.Expected Behavior
The glob search should strictly adhere to the
maxResultslimit 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