From 3718b1c3a9491e150b06c105bcad91f1e3cff943 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 4 Dec 2025 20:59:49 +0000 Subject: [PATCH] fix: bypass maxReadFileLine for @ mentioned files When a user explicitly @ mentions a file, they expect to see the full content regardless of the maxReadFileLine setting. This change ensures that @ mentioned files always use -1 (unlimited) for maxReadFileLine, bypassing the auto-truncate threshold. Changes: - Modified getFileOrFolderContent to always pass -1 to extractTextFromFile - This applies to both individual file mentions and files in folder mentions - The maxReadFileLine setting continues to work for tool-based file reads --- src/core/mentions/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/mentions/index.ts b/src/core/mentions/index.ts index f038b5b783..5a6756d055 100644 --- a/src/core/mentions/index.ts +++ b/src/core/mentions/index.ts @@ -278,7 +278,8 @@ async function getFileOrFolderContent( return `(File ${mentionPath} is ignored by .rooignore)` } try { - const content = await extractTextFromFile(absPath, maxReadFileLine) + // Always read full file for @ mentions (bypass maxReadFileLine) + const content = await extractTextFromFile(absPath, -1) return content } catch (error) { return `(Failed to read contents of ${mentionPath}): ${error.message}` @@ -318,7 +319,8 @@ async function getFileOrFolderContent( if (isBinary) { return undefined } - const content = await extractTextFromFile(absoluteFilePath, maxReadFileLine) + // Always read full file for @ mentions (bypass maxReadFileLine) + const content = await extractTextFromFile(absoluteFilePath, -1) return `\n${content}\n` } catch (error) { return undefined