Skip to content

fix(server): support local-only worktree bases - #8349

Open
frankleng wants to merge 1 commit into
pingdotgg:mainfrom
frankleng:fix/local-only-worktree-base
Open

fix(server): support local-only worktree bases#8349
frankleng wants to merge 1 commit into
pingdotgg:mainfrom
frankleng:fix/local-only-worktree-base

Conversation

@frankleng

@frankleng frankleng commented Aug 27, 2026

Copy link
Copy Markdown

Starting a thread from a local-only branch fails when the saved Start from origin preference makes bootstrap resolve a remote-tracking ref that does not exist. The valid local branch is never used, and the user only sees a generic GitVcsDriver.resolveRemoteTrackingCommit error.

After fetching origin, fall back to the selected local base branch when its remote-tracking commit cannot be resolved. Existing behavior is unchanged when the remote branch exists, and fetch failures still abort bootstrap. The server regression test now covers both a missing origin and a branch that exists only locally.

Tests:

  • vp test run apps/server/src/server.test.ts -t "bootstraps first-send worktree turns|falls back to the local base branch"
  • vp lint apps/server/src/ws.ts apps/server/src/server.test.ts --report-unused-disable-directives
  • vp run --filter t3 typecheck
  • git diff --check

Model: GPT-5.6 sol (medium)
Harness: T3 Code / Codex


Note

Low Risk
Narrows bootstrap failure to fetch errors only; remote resolution success path is unchanged and covered by expanded regression tests.

Overview
Thread bootstrap with Start from origin no longer fails when the chosen base branch has no remote-tracking ref on origin. After a successful origin fetch, resolveRemoteTrackingCommit failures are treated as a miss and worktree creation keeps using the local base branch; when resolution succeeds, behavior is unchanged.

The integration test for this fallback is parameterized to cover both a missing origin remote and an existing origin where the base branch only exists locally, with expectations for fetch/resolve calls adjusted per scenario.

Reviewed by Cursor Bugbot for commit 3388d31. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fall back to local base branch in makeWsRpcLayer when remote tracking commit fails to resolve

When startFromOrigin is enabled and the origin remote exists, worktree bootstrap now wraps resolveRemoteTrackingCommit in a recovery path so that a missing remote branch silently falls back to the local base branch instead of propagating an error. The test in server.test.ts is parameterized to cover both scenarios: origin missing entirely, and origin present but the base branch absent on it.

Macroscope summarized 3388d31.

Starting a thread from a local-only branch failed when the stored start-from-origin preference tried to resolve a remote-tracking ref that did not exist. Fall back to the selected local branch after a successful fetch when that remote ref cannot be resolved.
Copilot AI lite review requested due to automatic review settings August 27, 2026 03:04
@github-actions github-actions Bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Aug 27, 2026
@github-actions github-actions Bot added the size:S 10-29 changed lines (additions + deletions). label Aug 27, 2026
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

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: 77960936-23fb-4b0b-9b58-ac1bf4b0ab68

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

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes thread bootstrap when the Start from origin preference is enabled but the selected base branch has no remote-tracking ref (e.g., branch exists only locally). Instead of failing bootstrap with a generic GitVcsDriver.resolveRemoteTrackingCommit error, the server now falls back to using the local base branch after a successful origin fetch.

Changes:

  • In worktree bootstrap, treat remote-tracking commit resolution failures as a miss and keep using the local base branch.
  • Expand/parameterize the server regression test to cover both: missing origin, and origin present but base branch missing on origin.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/server/src/ws.ts Adds fallback behavior when resolveRemoteTrackingCommit fails during bootstrap with “Start from origin”.
apps/server/src/server.test.ts Updates regression test to cover both missing-remote and missing-remote-branch scenarios.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@macroscopeapp

macroscopeapp Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 3388d31

Macroscope's review found this PR approvable — This is a localized server bug fix that preserves existing remote-based worktree behavior while allowing local-only branches to fall back to the selected local base. The accompanying changes are focused tests with no production impact, and no schema, security, billing, or deployment surfaces are involved.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants