Open
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 Changed
This fixes a race in the first-message worktree setup flow that could prevent actions configured to run automatically on worktree creation from running.
When a new worktree is created from a local draft thread,
ChatViewnow updates the draft thread's branch/worktree context before running the setup script. This keeps the terminal drawer's mount-timeterminal.opencall aligned with the new worktree instead of briefly reopening the PTY against the project root.I also added a browser regression test covering this path.
Why
On the first message in worktree mode, the setup script terminal was opened with the new worktree path, but the terminal drawer could immediately remount and call
terminal.openagain using stale local draft-thread state.Because
terminal.openrestarts the PTY when cwd or env changes, that second open could wipe out the injected setup command. The result was that the terminal opened, but the automatic worktree setup action did not run until it was triggered manually.This change fixes that by keeping the local draft-thread state in sync as soon as the worktree is created.
UI Changes
No visual UI changes.
This is a terminal startup timing/interaction fix.
Checklist
Note
Fix draft worktree terminal startup race by updating draft thread context on worktree creation
ChatViewnow immediately callssetDraftThreadContextwith the new branch, worktree path, andenvMode: 'worktree', so the terminal drawer targets the new worktree instead of the project root.terminalOpenrequests are made with the correct worktreecwdandenvafter sending a message in a draft thread.ChatView.browser.tsxto support a per-fixturerpcResolverhook and to return{history: ""}forterminalOpen/terminalRestartcalls; the resolver now receives the full request body instead of just the method tag.Macroscope summarized 3c388e9.