Repository navigation
Conversation
A session whose cwd is a linked worktree could not read files of the other tracked repos in its workspace: read(file) of an absolute or repo-prefixed path into a sibling repo failed with "source path is outside the selected checkout". A session in the primary checkout read the same file fine. The source lane picks its checkout from the session cwd and refuses every path outside it. A cwd-bound file read that names a sibling repo of the session workspace now leaves that lane and takes the ordinary read path, the same one a primary-checkout session uses. Reads of the worktree's own files keep the lane and its freshness proof; a repo outside the session workspace and an explicit worktree selector keep their refusal.
zzet
left a comment
There was a problem hiding this comment.
Request changes for the P2 checkout-source routing issue below. The normal sibling-read behavior is useful, but aliases into the worktree family's own primary checkout must keep the existing source-lane refusal.
This finding is source-derived; no local runtime reproduction was performed. It is not a filesystem authorization/security escape: the tracked roots are already authorized. Please preserve genuine sibling reads and explicit worktree-selector behavior while correcting physical ownership classification.
A symlink beneath a sibling repo that resolves into the worktree family's primary now keeps the source-lane refusal, as naming the primary does.
zzet
left a comment
There was a problem hiding this comment.
The previous primary-checkout alias finding is addressed, including the distinct primary/worktree regression. One P2 remains for legitimate sibling reads through Windows directory junctions, as detailed inline.
This finding is source-derived from the pinned Go implementation and the request-routing flow; it was not runtime-reproduced on Windows. CI is green, but the new tests cover file symlinks rather than this directory-junction case. This is a functional checkout-source routing issue, not an authorization escape.
| resolved, err := filepath.EvalSymlinks(abs) | ||
| if err != nil { | ||
| return false |
There was a problem hiding this comment.
[P2] Use junction-aware resolution for genuine sibling paths
A legitimate allowed sibling path such as sibling\junction\file.go, where junction points to another directory inside that same sibling, is rejected here on Windows. With default pinned Go1.27.3 behavior, a directory junction has ModeIrregular rather than ModeSymlink/ModeDir; filepath.EvalSymlinks returns ENOTDIR when it encounters that ancestor. This helper then returns false, retains the worktree source carrier, and read_file rejects the sibling as source path is outside the selected checkout.
Earlier routing does not canonicalize the path value. The ordinary physical guard can resolve and validate this in-sibling target, but it does not rewrite the path or remove the already-selected source carrier.
Please reuse the existing pathguard.EvalLinks junction-aware resolver while retaining the lexical/resolved ownership, workspace and fail-closed checks. Add a Windows directory-junction positive for a genuine sibling and a negative for a junction into the family's primary checkout. Existing file-symlink tests do not cover this case.
Source-derived; no Windows runtime reproduction is claimed.
There was a problem hiding this comment.
Fixed: classification now resolves through pathguard.EvalLinks, keeping the lexical and resolved ownership, workspace and fail-closed checks. Added TestWorktreeSessionSiblingReadThroughJunction (Windows): it reads a genuine sibling through a junction and refuses a junction into the family's primary. Ran it on a Windows 11 machine: it passes with the change and fails without it.
filepath.EvalSymlinks fails on a path through a directory junction, so a genuine sibling path beneath one stayed on the source lane and was refused. pathguard.EvalLinks resolves it, keeping the same ownership checks.
Problem
An agent working in a linked worktree couldn't read files from the other repos in its workspace.
read(operation:"file")with an absolute or repo-prefixed path into a sibling repo failed withsource path is outside the selected checkout. A session in the primary checkout read the same file without trouble. Agents then gave up on Gortex for that repo and fell back to shell reads.What changes
view:{kind:"worktree"}.🤖 Generated with Claude Code