bug(core): UI reporting for truncated read_file. (#5155)

Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
joshualitt
2025-07-31 09:31:14 -07:00
committed by GitHub
parent 65be9cab47
commit ae86c7ba05
3 changed files with 79 additions and 3 deletions

View File

@@ -310,9 +310,22 @@ export async function processSingleFileContent(
}
llmTextContent += formattedLines.join('\n');
// By default, return nothing to streamline the common case of a successful read_file.
let returnDisplay = '';
if (contentRangeTruncated) {
returnDisplay = `Read lines ${
actualStartLine + 1
}-${endLine} of ${originalLineCount} from ${relativePathForDisplay}`;
if (linesWereTruncatedInLength) {
returnDisplay += ' (some lines were shortened)';
}
} else if (linesWereTruncatedInLength) {
returnDisplay = `Read all ${originalLineCount} lines from ${relativePathForDisplay} (some lines were shortened)`;
}
return {
llmContent: llmTextContent,
returnDisplay: isTruncated ? '(truncated)' : '',
returnDisplay,
isTruncated,
originalLineCount,
linesShown: [actualStartLine + 1, endLine],