Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 10, 2025

Summary

This PR fixes issue #7843 where checkpoints would fail to initialize in large repositories due to the 15-second timeout being too short for git add operations.

Problem

As discussed with @NaccOll in #7843, the issue occurs because:

  1. RooCode starts checkpoint initialization without awaiting (line 1664 in Task.ts)
  2. Subsequent calls have a 15-second timeout while waiting for that initialization
  3. In large repositories, git add . can take longer than 15 seconds

Solution

This PR implements the following improvements:

  1. Add --ignore-errors flag to git add command - This allows the operation to continue even if some files can't be added due to permission issues, similar to Cline's implementation
  2. Remove timeout for initial checkpoint service initialization - The initial call from initiateTaskLoop now passes isInitialCall: true flag to avoid timeout
  3. Keep timeout for subsequent calls - When the service is already initializing and other operations need to wait, they still use the 15-second timeout

Changes

  • Modified src/services/checkpoints/ShadowCheckpointService.ts to add --ignore-errors flag to git add
  • Updated src/core/checkpoints/index.ts to accept isInitialCall parameter and skip timeout when true
  • Modified src/core/task/Task.ts to pass isInitialCall: true when calling from initiateTaskLoop

Testing

  • All existing checkpoint tests pass successfully
  • Linting and type checking pass without issues

Related Issues

Fixes #7843


Important

Removes timeout for initial checkpoint initialization and adds --ignore-errors flag to git add to handle large repositories in ShadowCheckpointService.ts, index.ts, and Task.ts.

  • Behavior:
    • Removes timeout for initial checkpoint initialization in getCheckpointService() in index.ts by adding isInitialCall parameter.
    • Adds --ignore-errors flag to git add in stageAll() in ShadowCheckpointService.ts to handle permission issues.
    • Keeps 15-second timeout for subsequent calls in getCheckpointService().
  • Code Changes:
    • Modifies getCheckpointService() in index.ts to accept isInitialCall parameter.
    • Updates initiateTaskLoop() in Task.ts to pass isInitialCall: true.
    • Changes stageAll() in ShadowCheckpointService.ts to use --ignore-errors flag.
  • Testing:
    • All existing checkpoint tests pass.
    • Linting and type checking pass.

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

- Add --ignore-errors flag to git add command to handle permission issues
- Remove timeout for initial checkpoint service initialization
- Keep timeout only for subsequent calls when service is already initializing

This fixes issue #7843 where checkpoints would fail to initialize in large
repositories due to the 15-second timeout being too short for git add operations.
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 10, 2025 08:07
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Sep 10, 2025
Copy link
Contributor 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.

I reviewed my own code and found it acceptable. The bar was low.

)
// If this is the initial call from initiateTaskLoop, don't apply a timeout
// to allow large repositories to complete initialization
const waitOptions = isInitialCall ? { interval } : { interval, timeout }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this approach thread-safe? While the isInitialCall flag correctly removes the timeout for initial initialization, there might be a race condition if multiple operations try to get the checkpoint service simultaneously. Consider adding a mutex or lock mechanism to prevent concurrent initialization attempts.

await git.add(".")
// Use --ignore-errors to continue even if some files can't be added (e.g., permission issues)
// This prevents the operation from failing in large repositories with problematic files
await git.add([".", "--ignore-errors"])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good addition of the --ignore-errors flag! However, when errors are caught, we're not logging which specific files failed to be added. Could we enhance the error logging to help users identify and fix permission issues?

{ interval = 250, timeout = 15_000 }: { interval?: number; timeout?: number } = {},
{
interval = 250,
timeout = 15_000,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The 15-second timeout is still hardcoded for subsequent calls. Would it be beneficial to make this configurable through settings? Users with varying repository sizes might need different timeout values.

// Kicks off the checkpoints initialization process in the background.
getCheckpointService(this)
// Pass isInitialCall=true to avoid timeout for large repositories
getCheckpointService(this, { isInitialCall: true })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we expand this comment to be more descriptive? Consider adding more context about why isInitialCall=true is important and what problem it solves (e.g., preventing checkpoints from being disabled in large repos due to timeout during git add operations).

@NaccOll
Copy link
Contributor

NaccOll commented Sep 10, 2025

@roomote-agent close this pr.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 10, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Sep 10, 2025

Acknowledged @NaccOll. I will now close this pull request as requested.

@roomote roomote bot closed this Sep 10, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Sep 10, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 10, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Sep 10, 2025

Pull request #7847 has been successfully closed as requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Checkpoints cannot be initialized in large repositories

4 participants