Repository navigation
fix(claude): resolve symlinks in the WorktreeCreate hook's path - #4814
Merged
Merged
Conversation
Claude Code 2.1.325 refuses a WorktreeCreate answer that goes through a symlink inside the project. The hook printed the templated path from wt switch --format=json, which does when worktree-path places worktrees under a symlinked directory in the repository. It now prints the canonical path. Closes #4812
This was referenced Nov 16, 2026
skills(running-tend): track projects that carry Worktrunk; Dependabot keeps flake.lock current
#4804
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Claude Code
WorktreeCreatehook printed thepathfield fromwt switch --format=jsonwithout changing it. For a new worktree, that is the templatedworktree-path. When the template puts worktrees under a symlinked directory inside the repository, such as{{ repo_path }}/.worktrees/…with.worktreeslinked elsewhere, the printed path goes through that link. Claude Code 2.1.325 refuses that kind of answer (CHANGELOG: "Changed EnterWorktree to refuse aWorktreeCreatehook path that goes through a symlink inside the project; have the hook print the real path"). The hook now resolves the path withdunce::canonicalizebefore printing it.operational_worktree_pathinswitch.rsalready resolves paths for existing worktrees the same way.test_claude_hook_worktree_create_resolves_symlinklinks.worktreesto a directory outside the repository and checks the path the hook prints. It failed before the change (…/repo/.worktrees/agent-task) and passes after it (…/real-worktrees/agent-task). The existingWorktreeCreatetests still pass. I couldn't check the change against Claude Code 2.1.325 itself. The refusal described above comes from its changelog.The JSON output of
wt switch --format=jsonis unchanged. Whether it should report resolved paths in general is a separate question.Closes #4812 — automated triage