Repository navigation
Description
Problem
Worktree and data-directory resolution (#582, #612, #553) starts from the top-most parent directory holding .git or pyproject.toml. That rule dates from v0.1.8, so that commands run inside a repository cloned under repos/ resolve to the devops-cli workspace. It also means that a checkout, or a linked worktree, placed below another directory holding .git or pyproject.toml resolves to that outer directory:
- a project inside a home directory kept in git, such as a dotfiles repository;
- a linked worktree placed inside a different repository or workspace.
In that case shared data goes to the outer directory's .data, and a checkout below it gates like a repos/ clone. This is not a regression: it has been the behaviour since before #585. #614 and the #553 follow-up record it with strict xfail tests. devops workspace clean refuses the outer workspace's data directory where it can recognise it.
Expected
A repository's own checkout, and its worktrees, resolve to that repository's main worktree however deeply they are nested. Clones under the workspace's repos/ still resolve to the workspace. The rule has to tell "a repository nested in a workspace by design" apart from "a checkout that happens to sit below an unrelated repository", and that distinction is not yet specified.
Proposed design
Problem statement
When a repository checkout or worktree is placed below another directory containing .git or pyproject.toml, the system incorrectly resolves to the outer directory's workspace instead of the checkout's own repository. This causes shared data to go to the wrong location and affects how checkouts are treated in commands like devops workspace clean.
Acceptance criteria
- Criterion 1: A checkout or worktree nested within another repository resolves to its own repository's main worktree, regardless of nesting depth.
Verification: Run a command inside a nested checkout/worktree and verify that it uses the data directory from the nested repository instead of an outer one. - Criterion 2: Clones under the workspace's
repos/still resolve to the workspace as before.
Verification: Verify that a clone placed directly in the workspace'srepos/directory resolves correctly to the workspace's data directory. - Criterion 3: The system distinguishes between repositories nested in a workspace by design and those that happen to sit below unrelated repositories.
Verification: Test both scenarios: one where a checkout is intentionally placed inside a workspace, and another where it accidentally sits under an unrelated repository; verify correct resolution in each case.
Key questions
- Should the resolution rule be changed to differentiate between intentional nesting and accidental nesting?: Yes, the rule must distinguish 'a repository nested in a workspace by design' from 'a checkout that happens to sit below an unrelated repository'. (proposed)
Open questions
- What is the current behavior when a checkout or worktree is nested below another repository? (missing verified source)
- How does the system currently determine which repository a checkout belongs to? (missing verified source)
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(config): shared data resolves under the main worktree for every r…
dan-petty commentedon Sep 30, 2026
Moved from v0.2.25 to the backlog. v0.2.25 is capped at 12 items (#740), and only the next two planned releases keep a milestone (#739), so P2 items wait in the backlog until reprioritization pulls them in.
dan-petty commentedon Oct 8, 2026
Linked: #700, whose worktree inventory leaves root resolution to this item (
core/repo.py:65-67,:156-175). Found by the 2026-10-08 backlog review.fix(core): checkouts and worktrees below another repository resolve t…
dan-petty commentedon Oct 21, 2026
What changed
#1806, merged into
release/v0.2.39as bca9455.6 file(s) changed.
How it was verified
Check runs at 985ddec:
Acceptance Criteria of
docs/agent/tasks/task-617-checkouts-and-worktrees-below-another-repository-resolve-to-their-own-repository.md:repos/(and git submodules) still resolve to the enclosing workspace.repos/clones, submodules, worktrees of the workspace) from accidental nesting under an unrelated repository.cleanup_data_directorysafely cleans its own data without affecting host data, and refuses to prune outer workspace data when explicitly configured._OUTER_DIRECTORY_LIMITxfail marks intests/test_data_dir_worktrees.py; tests now pass strictly.test_a_worktree_of_a_checkout_inside_another_repository_checks_itselfintests/test_repos.pypasses without xfail.test_deeply_nested_unrelated_checkouts_and_worktrees_resolve_to_own_repositoriestesting multi-level nesting.changelog.d/617.mdrecords the fix under### Fixed.feat(release): v0.2.39 (#1947)