Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Jun 13, 2025

Summary

Closes #4601

This PR fixes issue #4601 by adding and directories to the checkpoint exclusion patterns, preventing these large cache directories from being included in snapshots and reducing disk space usage.

Changes Made

  • Added and to the function in
  • Updated tests in to verify the new exclusion patterns are included

Problem Solved

When working on Terraform/Terragrunt IaC projects, Roo Code's checkpoint system was including large cache directories in snapshots, consuming excessive disk space. Early in a project, these paths may not be included in .gitignore, so they were saved in every checkpoint, sometimes consuming 10x more disk space than needed.

Solution

The checkpoint system will now automatically exclude these directories from all checkpoints, just like other build artifacts (node_modules/, .gradle/, etc.). The checkpoint system writes these patterns to .git/info/exclude in the shadow repository, ensuring Git ignores them regardless of .gitignore.

Testing

  • All existing tests pass
  • Added test coverage for the new exclusion patterns
  • Verified that and are now included in the exclude patterns

Acceptance Criteria Met

✅ Given I'm working on an initialized Terraform|Terragrunt project with downloaded providers and without .terraform|.terragrunt-cache in .gitignore
✅ When I run work on a task and Roo Code creates checkpoints
✅ Then the .terraform|.terragrunt-cache directory is automatically excluded from checkpoints
✅ And checkpoint size remains small, comparable to projects without Terraform caches
✅ But my actual Terraform/Terragrunt configuration files (.tf, .hcl, etc.) are still included

Fixes #4601


Important

Adds .terraform/ and .terragrunt-cache/ to checkpoint exclusion patterns in excludes.ts to reduce disk space usage.

  • Behavior:
    • Adds .terraform/ and .terragrunt-cache/ to exclusion patterns in getBuildArtifactPatterns() in excludes.ts.
    • Updates getExcludePatterns() in excludes.ts to include new patterns.
  • Testing:
    • Updates tests in excludes.spec.ts to verify .terraform/ and .terragrunt-cache/ are excluded.
    • Ensures tests cover scenarios with and without .gitattributes file.

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

- Add .terraform/ and .terragrunt-cache/ to getBuildArtifactPatterns
- Update tests to verify the new exclusion patterns are included
- Fixes issue where Terraform/Terragrunt cache directories were consuming excessive disk space in checkpoints

Fixes #4601
@cte cte requested review from jr and mrubens as code owners June 13, 2025 19:56
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jun 13, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 13, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 13, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 13, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jun 13, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

This seems fine but I'm not sure if we want to make this list grow more, it might be better to just prevent the addition of directories with a very large amount of files to the checkpoints

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 13, 2025
@cte cte closed this Jun 16, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 16, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 16, 2025
@cte cte deleted the fix/exclude-terraform-cache-from-checkpoints branch June 16, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer PR - Needs Review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Exclude Terraform and Terragrunt cache directories from checkpoints to reduce storage usage

4 participants