fix(server): support local-only worktree bases - #8349
Conversation
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.
|
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 Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
There was a problem hiding this comment.
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, andoriginpresent but base branch missing onorigin.
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.
ApprovabilityVerdict: Approved at 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. |
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.resolveRemoteTrackingCommiterror.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 missingoriginand 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-directivesvp run --filter t3 typecheckgit diff --checkModel: 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 successfuloriginfetch,resolveRemoteTrackingCommitfailures 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
originremote and an existingoriginwhere 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
makeWsRpcLayerwhen remote tracking commit fails to resolveWhen
startFromOriginis enabled and theoriginremote exists, worktree bootstrap now wrapsresolveRemoteTrackingCommitin 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:originmissing entirely, andoriginpresent but the base branch absent on it.Macroscope summarized 3388d31.