Handle non-git drafts in local mode#1930
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 |
8f78b0a to
6aa1871
Compare
ApprovabilityVerdict: Needs human review This PR modifies runtime behavior in the message send flow by adding git status checks and fallback logic for non-git projects. While the changes are well-tested and the edge case handling is sensible, the modifications to critical path code (message sending) warrant human review to verify the interaction with existing worktree/local mode logic. You can customize Macroscope's approvability policy. Learn more. |
Closes #1914
What was broken
Draft threads could stay in
New worktreemode for directories that are not Git repositories. On the first send, that pushed users into the base-branch guard even though the project could only run locally.Root cause
The draft env-mode resolver treated persisted
worktreemode as authoritative without considering the active project's Git status, so non-git drafts kept a worktree-only send path.What changed
Note
Handle non-git projects in local draft mode by falling back from worktree to local send
resolveEffectiveEnvModein BranchToolbar.logic.ts gains an optionalisGitRepoflag; whenfalse, it returns'local'regardless of the draft's persisted mode.useEffectin ChatView.tsx.ChatViewnow callsrefreshGitStatus; if the project is not a git repo, it falls back to a local send and skipsprepareWorktree.worktreemode will silently send as local when the project is not a git repo.Macroscope summarized f56bf0c.
Note
Medium Risk
Touches the first-send dispatch path and draft thread state normalization for worktree creation, which could affect message sending/worktree bootstrapping behavior. Changes are scoped and covered by new unit + browser regression tests but still impact a core interaction flow.
Overview
Fixes drafts getting stuck in
New worktreemode for non-git projects by making env-mode resolution explicitly fall back tolocalwhenisRepois false, even ifworktreewas persisted.Normalizes local draft thread state when git status indicates a non-repo (clearing
branch/worktreePathand forcingenvMode: "local"), and updates the send flow to refresh git status before enforcing the worktree base-branch guard—falling back to local dispatch (or persisting the detected branch) based on the refreshed result.Adds regression coverage in
BranchToolbar.logictests and full-appChatView.browsertests for non-git fallback and the pending-status refresh race.Reviewed by Cursor Bugbot for commit f56bf0c. Bugbot is set up for automated code reviews on this repo. Configure here.