[Bug]: Create PR fails with "base invalid" when the worktree base exists only locally#22920
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
- In a repository with a GitHub
origin, create a branch frommainand do not push it (for example a stack parent you have not pushed yet, or a leftover local branch). It exists only asrefs/heads/<parent>. - Create a T3 worktree/thread with that branch as its base (
baseRef: "<parent>", either through a new-worktree thread ort3_worktree_handoff). T3 recordsbranch.<child>.gh-merge-base = <parent>. - Commit and push the child branch (
git push -u origin <child>). The push succeeds. - Click Create PR in the thread's source-control panel.
Expected behavior
T3 should not send a base branch that the remote does not have. It should validate the base against refs/remotes/origin/<base> (or the GitHub API), and either fall back to the repository's default branch or show an actionable error naming the missing remote base.
Actual behavior
Create PR fails with:
| 1 | Source control provider github failed in createChangeRequest: GitHub returned an error: Validation Failed; base invalid |
The push itself succeeds; only PR creation fails. git config --get branch.<child>.gh-merge-base returns the local-only parent, while the remote has no such branch (gh api repos/<owner>/<repo>/branches/<parent> returns 404). Choosing main manually in the Create PR menu works.
Impact
Minor bug or occasional failure — it blocks PR creation until the base is corrected manually, but it is easy to hit whenever a worktree is created from a local-only or stale branch.
Version or commit
T3 Code (Beta) 0.1.1 (CFBundleShortVersionString 0.1.1)
Environment
macOS 27.2, GitHub cloud provider, SSH remote (git@github.com:...), desktop app.
Logs or stack traces
Not a crash. The full UI error is the createChangeRequest message above.
Relevant behaviour in the bundled 0.1.1 app:
- The worktree's
baseRefends up inbranch.<child>.gh-merge-base;GitVcsDriver.pushCurrentBranch.recordMergeBasealso writes that key when it is empty. - PR base resolution reads
branch.<child>.gh-merge-baseand accepts it after a localbranchExists(cwd, <base>)check, returningrefs/heads/<base>. createChangeRequestforwards that value asbaseBranch/baseRefNameto the GitHub provider.
A base that exists only in the local clone therefore passes T3's check and is rejected by GitHub, so the user sees an opaque provider error instead of a base-selection problem.
Workaround
Point the merge base at a branch that exists on the remote:
| 1 | git config branch.<child>.gh-merge-base main |
or push the intended parent first (git push -u origin <parent>) and retry Create PR.