cline icon indicating copy to clipboard operation
cline copied to clipboard

Permissions issue when initializing checkpoints

Open canvrno opened this issue 9 months ago • 1 comments

Description

Users reported issues with checkpoints related to permissions in the workspace. It was found that this was due to permissions, as users were able to bypass this issue by either changing permissions or disabling checkpoints. This PR makes changes to check that we have the necessary permissions and add what files we can.

The legacy checkpoints implementation would ignore these errors, and end up tracking no files/creating no checkpoints. These changes will proceed with checkpoints, including files where possible.

Fixes #2322, #2239

Test Procedure

Modify a workspace such that VS Code/Cline is not able to access any files (sudo chmod 000 ), then start a new task with file modification goals. It will not succeed, but it should not hang.

Modify a workspace such that some files and folders are not accessible (sudo chmod 000 <file/dir>), and perform the same test. It should proceed, and if you check the checkpoints shadow git in globalStorage it should be tracking the files it is able to access (git ls-files). Restoring from a checkpoint should only restore the tracked files.

Type of Change

  • [X] 🐛 Bug fix (non-breaking change which fixes an issue)
  • [ ] ✨ New feature (non-breaking change which adds functionality)
  • [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] 📚 Documentation update

Pre-flight Checklist

  • [X] Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • [X] Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • [X] I have created a changeset using npm run changeset (required for user-facing changes)
  • [X] I have reviewed contributor guidelines

Screenshots

Additional Notes


[!IMPORTANT] Adds permissions checks and error handling to checkpoint initialization and file addition, allowing partial file tracking when some files are inaccessible.

  • Behavior:
    • Adds permissions checks in getWorkingDirectory() in CheckpointUtils.ts to ensure workspace accessibility.
    • Modifies addCheckpointFiles() in CheckpointGitOperations.ts to continue adding accessible files despite errors.
    • Updates initShadowGit() in CheckpointGitOperations.ts to handle file addition failures gracefully.
  • Error Handling:
    • Introduces error handling in addCheckpointFiles() and initShadowGit() to log errors and proceed with accessible files.
    • Logs errors in commit() in CheckpointTracker.ts if file addition fails.
  • Misc:
    • Adds --ignore-errors option to git.add() in CheckpointGitOperations.ts to bypass inaccessible files.
    • Updates CheckpointTracker.ts to handle partial file additions without hanging.

This description was created by Ellipsis for 2c1642105cad724599aa4004c8820e3a360c91a9. It will automatically update as commits are pushed.

canvrno avatar Mar 20 '25 19:03 canvrno

🦋 Changeset detected

Latest commit: b06959249f7bb9295bf258d8f5e11923a5f87b33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
claude-dev Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Mar 20 '25 19:03 changeset-bot[bot]