Repository navigation
Fixed diff dialog appearing as orphan tab when Claude edits outside cwd - #93
Merged
oleg68 merged 1 commit intoApr 25, 2026
Conversation
When Claude cd's into a subdirectory mid-session, the PreToolUse hook fires with cwd = that subdirectory. The session tab lookup used abs.equals(hookCwd), which failed because the tab's startup dir is the project root — not the subdir Claude cd'd into. This left sessionTab = null, causing: - diff opening as a detached top-level tab instead of embedded in session - Cancel and Accept-All buttons disabled - false "outside project" warning for files in the project root Fix: change lookup condition to isFileUnderDirectory(hookCwd, abs) so a tab matches when its startup dir is an ancestor of hookCwd. Also compute outsideProject against the tab's startup dir (project root) rather than hookCwd, and rename the parameter confirmedDir → hookCwd. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Backport of #92 to release/0.21.
Summary
cd's into a subdirectory mid-session and then edits a file outside that subdirectoryabs.equals(hookCwd)— failed because tab's startup dir (project root) ≠ hook'scwd(subdir Claude cd'd into), leavingsessionTab = nullisFileUnderDirectory(hookCwd, abs); outsideProject now uses the tab's startup dir; renamed parameterconfirmedDir→hookCwdTest plan
cd <subdirectory>src/main/java/...)🤖 Generated with Claude Code