You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After #16651, Instance.directory is always the canonical (symlink-resolved) path. But the filepath argument to containsPath() comes from various tool callers (bash.ts, external-directory.ts, file/index.ts) and is not canonicalized. Similarly, Instance.worktree may not be canonical.
This means a symlinked path passed to containsPath() won't match the canonical Instance.directory, causing:
bash.ts:89,129 — false negatives on the boundary check, triggering unnecessary external_directory permission prompts for paths that are actually inside the project
external-directory.ts:17 — same false negative, prompting for permission when none is needed
file/index.ts:503,585 — File.read() and File.tree() incorrectly reject symlinked paths within the project
The existing TODO comments at file/index.ts:501 and :583 acknowledge this as a known limitation ("lexical containment check"). #16651 makes it slightly more pronounced because Instance.directory is now always canonical while inputs remain uncanonicalized.
A fix would be to canonicalize the filepath argument inside containsPath():
If #16660 is intentionally a more focused/actionable follow-up to #16647, it may be worth linking them explicitly or closing one in favor of the other.
Activity
github-actions commentedon Mar 9, 2026
This issue might be a duplicate of (or closely related to) existing issues. Please check:
containsPath()mixing canonical/non-canonical paths, which may be a sub-problem of Symlinked project directories break after 8a95be4 (realpath resolution) #16647 or a follow-up fix.If #16660 is intentionally a more focused/actionable follow-up to #16647, it may be worth linking them explicitly or closing one in favor of the other.
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.