[BUG] Nesting isolation worktrees inside `.claude` causes friction with Dune (among others)

Status Open
Reported on v2.1.215
Maintainer reply None cached
Activity 0 comments · opened Jul 20, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Dune supports vendoring by honoring the _outermost_ dune-workspace file it can find (see [Finding the root][]). This causes problems that are only solvable by installing a WorktreeCreate hook, which is frankly an unreasonably heavyweight workaround for a whole class of correctness bugs ([this bug][] shows JavaScript getting messed up in the same way). [This feature request][] would have provided a better workaround. They were closed not planned and are locked so I'm refiling with corroboration.

[Finding the root]: https://dune.readthedocs.io/en/stable/usage.html#finding-root
[This bug]: https://github.com/anthropics/claude-code/issues/41075
[This feature request]: https://github.com/anthropics/claude-code/issues/27460

What Should Happen?

It shouldn't be the default to nest worktrees like this. It _certainly_ shouldn't be a default that's hard to change.

Error Messages/Logs

Steps to Reproduce

Bare-repo + sibling layout (a standard git setup): project/+repo (bare), project/main (working tree, has dune-workspace). From project/main, Claude Code makes project/main/.claude/worktrees/<name>/. dune build there resolves to main's root and requires dune build --root .. Placing the worktree beside +repo (project/wt-<name>/, under a parent with no dune-workspace) removes the ambiguity — no flags. Note: the .claude/ dot-prefix doesn't help; it only affects downward scans, not a tool computing its own root from inside the worktree.

Claude Model

Not sure / Multiple models

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.215 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

Related issues

  • Closed not planned + locked: #27460 (bare-repo worktree support; blamed for #27436/#27439), #45201 (isolation breaks bare layouts via extensions.worktreeConfig).
  • Open, same nesting fragility: #69026 (edits silently land in the parent checkout), #76496 (preview_start can't find .claude/launch.json in a nested worktree), #78486, #69802.

View original on GitHub ↗