Repository navigation
Description
Summary
The Diff tab can include unrelated changes when the local base branch trails its remote tracking branch. For a short base name such as develop, the Git plugin resolves the local branch first, even when origin/develop is present and newer.
Versions and environment
bb 0.48.1 desktop app on macOS; Git worktree environment with a clean feature branch. Reproduced against source fa30b0a with a synthetic repository in the Git plugin test suite.
Steps to reproduce
- Create a repository with
mainat commit A. - Commit an unrelated
base.txtonmain(commit B), and setrefs/remotes/origin/mainto B. - Create
featurefrom B, move the unused localmainref back to A, and commitfeature.txtonfeature. - Run
bb git diff <environment-id> --target branch_committed --merge-base-branch main --json.
The executable fixture is in the proposed workspace-reads.test.ts change.
Expected vs actual
Expected: one changed file, feature.txt, matching origin/main...feature.
Actual on 0.48.1: two changed files, base.txt and feature.txt, matching stale local main...feature. In the observed worktree this inflated the Diff tab from 24 files and 1,876 additions to 224 files and 5,027 additions plus 1,044 deletions. The working tree was clean. Choosing origin/develop explicitly returned the expected 24 files.
Evidence
resolveMergeBaseBranch at fa30b0a checks the short local ref before refs/remotes/origin/<branch>.
What I ruled out
- Uncommitted changes: the worktree was clean.
- GitHub PR size: its base comparison showed 24 files.
- Worktree provider provisions stale refs and long-lived manager turns can silently search old code #3955 concerns worktree provisioning and agent turn freshness, not Diff tab base ref selection.
Suggested priority and effort
Medium: the diff can mislead code review; selecting origin/<branch> explicitly is a workaround.
AGENT GENERATED
Activity
bb-slop-cop commentedon Nov 5, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotworkspaces,confirmed-repro. Final Type re-read: Bug.origin/main(fa30b0a) in two clean checkouts: short base lists two files; explicit remote lists one; worktree is clean. Existing Git plugin coverage passes: 35 files, 276 tests.origin/<branch>is a verified workaround.Git: use origin's base branch when the local one only trails it (get-…
Resolve local-vs-origin branch refs with one shared resolver (#7719)