Skip to content

Conversation

@jr
Copy link
Collaborator

@jr jr commented Dec 12, 2025

Important

Implements token-budgeted file reading in ReadFileTool.ts using readFileWithTokenBudget, replacing previous validation methods.

  • Behavior:
    • Implements readFileWithTokenBudget in ReadFileTool.ts for token-budgeted file reading.
    • Replaces validateFileTokenBudget and truncateFileContent with readFileWithTokenBudget.
    • Handles both complete and truncated file reads based on token budget.
  • Testing:
    • Adds tests for readFileWithTokenBudget in read-file-with-budget.spec.ts.
    • Updates readFileTool.spec.ts to mock and test new file reading behavior.
  • Misc:
    • Removes fileTokenBudget.spec.ts as it's no longer needed.
    • Adjusts FILE_READ_BUDGET_PERCENT to 60% in fileTokenBudget.ts.

This description was created by Ellipsis for 23b306a. You can customize this summary. It will automatically update as commits are pushed.

@jr jr requested review from cte and mrubens as code owners December 12, 2025 18:01
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request labels Dec 12, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 12, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

This PR implements incremental token-budgeted file reading with a clean single-pass approach that replaces the previous two-step validate/truncate pattern. The implementation is correct and well-tested.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

let isProcessing = false
let shouldClose = false

const readStream = createReadStream(filePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider specifying an explicit encoding (e.g. utf8) when creating the read stream to ensure text is decoded correctly.

Suggested change
const readStream = createReadStream(filePath)
const readStream = createReadStream(filePath, { encoding: 'utf8' })

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 12, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 15, 2025
@jr jr merged commit bf81fa7 into main Dec 15, 2025
24 checks passed
@jr jr deleted the jr/read-file-tool-budget branch December 15, 2025 22:41
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Dec 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 15, 2025
@cte cte mentioned this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants