feat(web): add "New chat in this worktree" header button - #10
Merged
Conversation
Surfaces an in-thread affordance to open a fresh chat pointed at the
current thread's worktree, reusing the existing git worktree instead of
provisioning a new one. Mirrors the sidebar's "New thread on {branch}"
action.
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.
What
Adds an in-thread affordance to open a fresh chat pointed at the same worktree as the current thread.
When a thread runs in a worktree, a new button (message-plus icon, tooltip "New chat in this worktree") appears in the chat header. Clicking it opens a new draft chat seeded with the current thread's
branch+worktreePathandenvMode: "worktree", reusing the existing git worktree instead of provisioning a new one. On plain current-checkout threads the button is hidden.Why
Multiple chats sharing one worktree was already supported by the data model (a chat is a thread; a worktree is just a
worktreePathfield) and already exposed via the sidebar's "New thread on {branch}" right-click action. This surfaces the same capability as a first-class button inside the open chat.Changes
apps/web/src/components/chat/ChatHeader.tsx— optionalonNewChatInWorktreeprop + header icon button, rendered only when provided.apps/web/src/components/ChatView.tsx—handleNewChatInWorktreewired to the existinghandleNewThread(...), passed only when the thread has a worktree.Reuses existing plumbing; worktree cleanup already guards against deleting a tree another chat still uses.
🤖 Generated with Claude Code