Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): skip origin fetch when creating worktrees in repos without an origin remote #5556

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/5556/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Starting a worktree thread in a repo with no origin remote failed outright: the "start from origin" default made bootstrap run git fetch origin, which errors when the remote doesn't exist.

Bootstrap now checks whether origin exists first. If it does, behavior is unchanged (fetch, resolve the remote tracking commit, branch from it). If it doesn't, the worktree branches from the local base branch instead of failing the whole thread.

  • New remoteExists on GitVcsDriver/GitWorkflowService (the existing originRemoteExists helper now delegates to it)
  • ws.ts bootstrap only takes the origin path when the remote is present
  • Server tests cover both the origin and no-origin paths

Written by Claude Fable 5 via Claude Code.


Note

Low Risk Localized bootstrap/git workflow change with tests; no auth or data-path impact.

Overview Thread bootstrap no longer fails when start from origin is enabled but the repo has no origin remote. Worktree preparation now calls remoteExists first; only then does it fetch and resolve the remote-tracking base commit.

A generic remoteExists API is added on GitVcsDriver and GitWorkflowService (the internal originRemoteExists helper delegates to it). Server tests assert the origin path still runs fetch/resolve when the remote exists, and that missing origin skips fetch and creates the worktree from the local base branch.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 2a0c57695d15718115e3b3bc6d7e6667207a21c7. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Skip origin fetch when creating worktrees in repos without an origin remote

  • Adds remoteExists({ cwd, remoteName }) to GitVcsDriver and GitWorkflowService, implemented via git remote get-url <remoteName> with a non-zero exit allowed.
  • Refactors originRemoteExists in GitVcsDriverCore.ts to delegate to the new generic method.
  • In ws.ts, the bootstrap prepareWorktree path now checks for the origin remote before fetching; if absent, it falls back to the local base branch ref instead of attempting a fetch that would fail.
Macroscope summarized 2a0c576.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 05feb627-cb1c-4992-9b62-dcb6f9161567

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    3. Approvability

      Verdict: Approved 2a0c576

      Defensive bug fix that adds a remote existence check before attempting to fetch from origin during worktree creation. The change prevents failures in repos without an origin remote by gracefully falling back to the local base branch. Limited scope with comprehensive test coverage.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.