-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
ShadowCheckpointService.getNestedGitRepository() has three correctness issues that cause it to miss nested git repositories (false negatives) or incorrectly detect repositories outside the workspace (false positives).
Impact
- False negatives: Git submodules and worktrees use a
.gitfile (not directory) containing agitdir:pointer. The current search pattern (**/.git/HEAD) only finds.gitdirectories. Submodule/worktree-style nested repos are completely missed, allowing checkpoints to initialize when they should be disabled. - False positives: The
--followflag causes ripgrep to traverse symlinks outside the workspace boundary, potentially detecting git repositories that are not actually nested in the workspace. - Brittle path matching: The current filter uses
includes(".git/HEAD")andstartsWith(".git/")for path classification, which is imprecise across platforms and path formats.
Reproduction
False negative (submodule case):
- Create a workspace with a git submodule (the submodule directory will contain a
.gitfile withgitdir: ...content instead of a.gitdirectory) - Initialize checkpoints
- Observe that the nested repo is not detected and checkpoints proceed
False positive (symlink case):
- Create a workspace containing a symlink that points to a directory outside the workspace
- The external directory (or its ancestors) contains a
.gitrepository - Initialize checkpoints
- Observe that
--followcauses ripgrep to traverse the symlink and detect the external repo as "nested"
Expected behavior
- Nested repos inside the workspace are detected consistently, regardless of whether they use a
.gitdirectory or a.gitpointer file - Paths outside the workspace are not considered
- Root-level
.git(directory or file) is excluded from detection
Actual behavior
.gitpointer files (submodules/worktrees) are missed entirely--followcan cause out-of-workspace matches- String-based path matching is fragile across separator styles and relative/absolute path variations
Related issues and prior art
- Prompt and entire task contents deleted due to nested git checkpoint; stuck on "Still initializing checkpoint..." #7765 — Task history disappeared when checkpoint init failed with nested submodule
- [ENHANCEMENT] Persistent nested-repo warning with offending path inline #7884 — Enhancement: persistent warning with offending path (PR fix: make nested git repository warning persistent with path info #7885 merged)
- [BUG] Checkpoints feature is disabled because of nested git repos #8433 — Checkpoints disabled with nested repos
- [BUG] Checkpointing disabled when workspace root is not a Git repository #8164 — Workspace root not a git repo triggers misclassification
- Nested git repository detected, cannot use checkpoint feature #10636 — Parent folder with multiple sibling repos triggers nested-repo disable
- PR fix: allow checkpoints with nested git repos by excluding them #8434 — Proposed exclude-based scoping (closed, unmerged)
- PR fix: handle nested git repos gracefully in checkpoints #8863 —
fix: handle nested git repos gracefully in checkpointsby daniel-lxs (closed as stale)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working