-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[Bug] Missing results limitation in IntelliJ getFileResults implementation causing context overflow #11999
Copy link
Copy link
Open
Labels
area:context-providersRelates to context providersRelates to context providerside:jetbrainsRelates specifically to JetBrains extensionRelates specifically to JetBrains extensionkind:bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
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
ipgrep\ 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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:context-providersRelates to context providersRelates to context providerside:jetbrainsRelates specifically to JetBrains extensionRelates specifically to JetBrains extensionkind:bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Type
Projects
Status
Todo