Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Branch-base configuration is read with one Git process instead of up to three, preserving existing precedence and fallback behavior. The change is confined to local configuration reads, with no change to product defaults or configuration writes. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Read branch-specific base configuration apps/server/src/vcs/GitVcsDriverCore.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts |
The reader matches branch-specific configuration keys and selects the last value for repeated entries. It prefers t3-merge-base and falls back to gh-merge-base. The regression test covers exact branch matching and fallback behavior. |
Use configuration during base resolution apps/server/src/vcs/GitVcsDriverCore.ts |
Base resolution obtains the configured ref and branch base together, then uses the returned branch base. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Suggested reviewers: juliusmarminge, stbenjam
Merge Risk: 
Minimal · up to 7ac63
-
The lookup consolidates Git config reads, with no merge-blocking issue identified.
Pre-merge checks: 
4
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Usage-based review receipt
- Mode: Continue automatically
- Reviewed files: 2
- Charged: $0.50
- View usage details
Note
This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.
|
macOS numbers for the "Not checked" line. These come from 111 minutes of server.trace on 0.1.7-nightly.20261102.4093, macOS 27.2, Apple silicon.
The trace records |
Problem
Git status works out which base each non-default branch compares against on every refresh. For a branch with no usable
t3-merge-base-ref, the lookup ran up to threegit config --getprocesses:t3-merge-base-ref, thent3-merge-base, then the legacygh-merge-base. Status with branch changes resolves the base twice, once for the ahead count and once for the change totals. That adds up to six config processes per refresh for branches created outside T3, or by older versions of it. They also take slots from the driver's limit of eight concurrent git processes.Change
readBranchBaseConfigreads all three keys with onegit config -z --get-regexp '^branch\.<branch>\.(t3-merge-base-ref|t3-merge-base|gh-merge-base)$'. The branch name is regex-escaped, sofeature/a.b+cannot matchfeature/aXbb.resolveBaseBranchForNoUpstreamandreadBranchBaseboth use it, and the precedence is unchanged:t3-merge-base-refstill wins.t3-merge-basestill wins overgh-merge-base.--getdoes.-candGIT_CONFIG_*overrides apply exactly as with--get.Branches whose
t3-merge-base-refresolves already took one process, so they are unchanged.Scope and approval
A focused performance change with no change in behavior or output, so it needs no prior issue or discussion. Config writes, key names and branch-base rules stay as they were.
GitManager.resolvePrBase(PR creation, not polled) still readst3-merge-base-refon its own; I left it alone so the service contract stays the same.No screen changes. Status returns the same
branchChanges,aheadCountandaheadOfDefaultCountas before (measured below).Verification
Measurement:
statusDetailsLocal(cwd, { includeBranchChanges: true })on one fixture repository, with a 200-file commit, anoriginremote and one worktree per case. Both driver builds ran in the same process with a counting process spawner, alternating call by call over 400 pairs after 20 warm-up calls each. Linux, git 2.53.gh-merge-baset3-merge-base-refThe host was heavily loaded during the run, which inflates the cost of each process. On the same host, a plain shell loop timed the three
git config --getcalls at about 2.4 ms against 0.8 ms for one--get-regexp. The status results were identical before and after in every case.GitVcsDriverCore.test.ts. It covers a missing key, a legacy-only key, a preferred key over legacy, a repeated key (last wins), an empty last value falling back to legacy, and a branch name with regex characters next to a branch it would wrongly match. With the escaping removed it fails withexpected 'regex-match' to equal null.baseRefforced to null, the existing tests "fetches the selected worktree base for Changes" and "publishes a branch tracking its base under its own name, not the base" fail, so the preferred-ref path is already covered.vp test run src/vcs/GitVcsDriverCore.test.ts src/git/GitManager.test.ts: 331/331 passed.vp run check:changed 1d626d02d9: format, lint, knip, typecheck and tests passed.r]s,q{1},u{2,3}v,a.b+,x(y),d$eandp|q.Not checked: timing on macOS or Windows, where each process costs more; a run in a desktop or web client, since nothing on screen changes.
Prior PRs
None found for this change. Searches for
t3-merge-base-ref,gh-merge-base,readBranchBase,get-regexpandresolveBaseBranchForNoUpstreamacross open and closed PRs found no same-fix PR. Related merged work on the same status path:Open PRs #26125, #24841, #24047, #22249 and #21875 touch this file in other hunks.
Generated with Claude Opus 5.5 and GPT-6.1 Sol in T3 Code Nightly