Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Sep 18, 2025

Description

This PR fixes issue #8164 where checkpointing was incorrectly disabled when the workspace root was not a Git repository but contained cloned repositories as subdirectories.

Problem

When users had a workspace folder that wasn't a Git repository but contained cloned Git repositories as child folders, RooCode would incorrectly flag these as "nested" repositories and disable checkpointing. This was a false positive since these repositories weren't actually nested (a Git repo inside another Git repo), but rather legitimate repositories within a non-Git workspace.

Solution

Modified the getNestedGitRepository() method in ShadowCheckpointService.ts to:

  1. First check if the workspace root itself is a Git repository
  2. If the workspace is NOT a Git repository, allow any Git repositories in subdirectories (they're not "nested")
  3. Only flag repositories as "nested" if the workspace itself is a Git repository AND contains other Git repositories

Changes

Testing

  • ✅ All existing tests pass
  • ✅ Added new test case allows git repositories in non-git workspace (issue #8164) that validates the fix
  • ✅ Ran full checkpoint test suite successfully

Checklist

  • Code follows project conventions
  • Tests have been added/updated
  • All tests pass
  • No security vulnerabilities introduced
  • Documentation/comments updated where necessary

Fixes #8164


Important

Fixes issue #8164 by allowing checkpointing in non-Git workspaces with Git subdirectories, updating logic in ShadowCheckpointService.ts.

  • Behavior:
  • Testing:
    • Adds test allows git repositories in non-git workspace (issue #8164) in ShadowCheckpointService.spec.ts to validate the fix.
    • All existing tests pass, and a full checkpoint test suite was run successfully.

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

- Modified getNestedGitRepository() to first check if workspace is a Git repo
- Only flag repositories as nested if workspace itself is a Git repository
- Added test case for the specific scenario in issue #8164
- This fixes the false positive where legitimate Git repos in non-Git workspaces were incorrectly flagged as nested

Fixes #8164
@roomote roomote bot requested review from mrubens, cte and jr as code owners September 18, 2025 20:32
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working documentation Improvements or additions to documentation labels Sep 18, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like debugging in a mirror - everything looks backward but somehow still broken.

private async getNestedGitRepository(): Promise<string | null> {
try {
// First check if the workspace root itself is a Git repository
const workspaceIsGitRepo = await fileExistsAtPath(path.join(this.workspaceDir, ".git"))
Copy link
Author

Choose a reason for hiding this comment

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

Is this check robust enough? The .git path could also be a file (in the case of Git worktrees or submodules pointing to .git/worktrees/...). Should we consider checking if it's actually a directory?

Or perhaps we could use the simpleGit library to check if it's a valid repo?

// that happen to be in the workspace. This is a valid use case.
if (!workspaceIsGitRepo) {
this.log(
`[${this.constructor.name}#getNestedGitRepository] workspace is not a git repository, allowing child repositories`,
Copy link
Author

Choose a reason for hiding this comment

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

Minor suggestion: Could this log message be more descriptive? Something like:

workspace is not a git repository, skipping nested repository check

This would make it clearer that we're intentionally skipping the check rather than just "allowing" repositories.

})

// Mock fileExistsAtPath to return false for workspace/.git (workspace is not a git repo)
vitest.spyOn(fsUtils, "fileExistsAtPath").mockImplementation((filePath: string) => {
Copy link
Author

Choose a reason for hiding this comment

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

The mock implementation is clever, but could we make it more explicit about what we're testing? Consider adding a comment explaining why we're only mocking the workspace/.git path and using real implementation for others to maintain test integrity.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 18, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[BUG] Checkpointing disabled when workspace root is not a Git repository
2 participants