anthropics / anthropics/claude-code

Edit tool's cross-worktree guard is stricter than the Bash sandbox on the same path

Đang mở
#93,463 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:sandbox area:tools bug
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

**Summary**

Working across multiple `git worktree`s of the same repo (a common setup when running several concurrent Claude Code sessions, one per worktree), the Edit tool unconditionally refuses to write outside the current session's own worktree: "This session is running in an isolated git worktree at X, but Y belongs to a different worktree." Bash, with the sandbox disabled, has no equivalent restriction on that same path — so a legitimate task like resolving a merge conflict in another agent's branch forces every single file edit in that other worktree through Bash + a heredoc instead of the Edit tool.

**Impact**

Slower and more error-prone than using Edit directly, and inconsistent: two tools enforce different policies for the identical filesystem path, and there's no override for Edit the way `dangerouslyDisableSandbox` exists for Bash.

**Reproduction**

1. Have two `git worktree`s of the same repo checked out locally, in a session created for worktree A.
2. Attempt to use the Edit tool on a file that lives in worktree B.
3. Observe the "belongs to a different worktree" refusal.
4. Attempt the same file write via Bash with `dangerouslyDisableSandbox: true` — it succeeds with no equivalent restriction.

**Suggested fix**

Either give Edit the same explicit-override path Bash already has (so a session can deliberately opt into writing to a path outside its own worktree when it genuinely needs to), or make the two tools consistent by default so one doesn't silently block what the other allows.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start by tracing the Edit tool path that emits the cross-worktree refusal and compare it with Bash handling of dangerouslyDisableSandbox. Reproduce with two git worktrees of the same repo, then attempt the same write through Edit and Bash. Done means the two tools have a documented, consistent policy or an explicit Edit override, and the reproduction no longer shows the mismatch.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
bash, git
Lĩnh vực
cli, developer-experience, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.