feat(diff): show worktree changes for a draft + fix review to use the live branch - #64
Merged
enisze merged 2 commits intoAug 20, 2026
Merged
Conversation
Read a not-yet-sent composer draft's worktree/environment/project so the shared diff, git status, and branch preview load when the panel opens, instead of only after the first message promotes the draft to a server thread. Drafts with no worktree keep the empty per-chat panel, matching the pre-draft behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Review button (and "new chat in this worktree") targeted the thread's persisted `branch` field, which drifts from the worktree's actually checked-out branch after a checkout, PR checkout, or branch switch. The footer branch chip already prefers the live git ref, so the two diverged and a review could run against a stale reference. Resolve the new-chat branch the same way the footer does — live `gitStatus.refName`, falling back to the stored branch — for worktree-backed chats, so a review always follows the branch shown in the chat. Local chats keep the stored value. Co-Authored-By: Claude Opus 4.8 <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.
Summary
Two related worktree-review fixes:
Show worktree changes for a not-yet-sent draft. The diff panel required a server-backed thread to load worktree data, so a worktree holding only a composer draft showed an empty diff/git-status/branch-preview until the first message promoted the draft to a real thread. It now resolves the worktree/environment/project directly from a worktree-targeting draft, loading immediately on open. Drafts with no worktree keep their empty per-chat panel.
Review the worktree's live branch, not the stored ref. The Review button (and "new chat in this worktree") targeted the thread's persisted
branchfield, which drifts from the worktree's actually checked-out branch after a checkout, PR checkout, or branch switch. The footer branch chip already prefers the live git ref, so the two diverged and a review could run against a stale reference. The new-chat branch is now resolved the same way the footer does — livegitStatus.refName, falling back to the stored branch — for worktree-backed chats, so a review always follows the branch shown in the chat.Changes
DiffPanel.tsx: resolve the worktree data source from a real thread when one exists, otherwise from the worktree-targeting composer draft; all downstream queries key off the resolved environment/source.ChatView.tsx: derivenewChatWorktreeBranchfrom the live git ref (footer's resolution) instead of the storedactiveThread.branch, so the Review button and new-worktree-chat action follow the branch currently checked out.🤖 Generated with Claude Code