fix(cli): avoid protected parent access during checkpoint cleanup - #13540
Merged
marius-kilocode merged 1 commit intoAug 28, 2026
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (3 files)
Reviewed by grok-4.6 · Input: 68.6K · Output: 19.2K · Cached: 536.6K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
August 28, 2026 10:32
WebReflection
approved these changes
Aug 28, 2026
marius-kilocode
deleted the
fix-checkpoint-cleanup-on-worktree-deletion
branch
August 28, 2026 10:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Deleting an Agent Manager worktree could succeed but still show a checkpoint-cleanup error, including when checkpoint recording was disabled. Cleanup inspected every ancestor from the filesystem root. On macOS, access to a protected parent such as Documents can be denied even when the full project path is accessible, causing the cleanup endpoint to return HTTP 400.
Why This Change Was Made
Correct the protected-parent access regression in the worktree cleanup introduced by #13476. Resolve the complete target first and walk upward only to reconstruct missing path components. Keep canonical containment checks, dangling-symlink rejection, path revalidation, repository locking, and the existing quarantine and pending-materialization safeguards.
Do not skip cleanup when snapshot recording is disabled: old checkpoint data can still exist and should be removed when its worktree is explicitly deleted.
User Impact
Worktree deletion no longer requires inspecting unrelated protected parent folders. Missing checkpoint repositories remain harmless, existing checkpoint data is removed, and retained sessions remain available in history.
Evidence