Skip to content

fix: remove overly conservative context length check for @file (#12165)#12916

Open
ChenXin-2009 wants to merge 1 commit into
continuedev:mainfrom
ChenXin-2009:fix-file-context-length
Open

fix: remove overly conservative context length check for @file (#12165)#12916
ChenXin-2009 wants to merge 1 commit into
continuedev:mainfrom
ChenXin-2009:fix-file-context-length

Conversation

@ChenXin-2009

@ChenXin-2009 ChenXin-2009 commented Jun 29, 2026

Copy link
Copy Markdown

Description

Fixes #12165

The @file\ context provider had an \isItemTooBig\ check that incorrectly rejected files larger than ~16kB when using Ollama with \model: AUTODETECT. This happened because AUTODETECT skips \ensureModelInfo()\ (see \core/llm/llms/Ollama.ts:178), so \contextLength\ defaults to 8192 tokens instead of the actual model context size.

The formula used: \ okens > contextLength - maxTokens\ → \ okens > 8192 - 4096 = 4096\ rejected files that produce >4096 tokens (~16kB of text).

Fix

Removed the frontend-side \isItemTooBig\ check entirely, making @file\ consistent with @CurrentFile\ and all other context providers. The core \compileChatMessages\ function already handles context overflow gracefully.

Changes

  • \gui/src/components/mainInput/AtMentionDropdown/index.tsx: Removed \isItemTooBig, \handleItemTooBig, \ ormatFileSize\ dead code (~107 lines) and unused imports. All non-action/non-submenu/non-query items now go through \props.command()\ uniformly.

Summary by cubic

Removed the overly conservative context-length check for @file mentions that blocked valid files (notably with Ollama model: AUTODETECT). @file now behaves like @CurrentFile, with overflow handled by core logic.

  • Bug Fixes
    • Removed the frontend isItemTooBig check in AtMentionDropdown; all non-action items now go through props.command(...).
    • Cleaned up dead code and unused imports.

Written for commit fff283d. Summary will update on new commits.

Review in cubic

@ChenXin-2009 ChenXin-2009 requested a review from a team as a code owner June 29, 2026 09:23
@ChenXin-2009 ChenXin-2009 requested review from sestinj and removed request for a team June 29, 2026 09:23
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

@ChenXin-2009

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@file applies the wrong context lenght limit but @CurrentFile works fine.

1 participant