Repository navigation
Conversation
…orRemote getGitHubApiRepositoryForRemote is the shared entry point for GitHub identity lookups on a named remote. Some callers gate it with shouldProbeGitRemote (resolveGitHubApiRepositoryCandidates), but others call it directly (getRepoUpstream, the tracked-upstream-branch fallback in branch-lookup-resolution.ts, issue source preference 'upstream'). For a missing remote, one cold call runs `git remote get-url <name>` twice: once in getOwnerRepoForRemote and again in getEnterpriseGitHubRepoSlugForRemote, whose cache has a flat 30s TTL. Field data (Windows, v1.4.206): 1,421 failing `git remote get-url upstream` execs in one day for a repo whose `git remote` listing (which succeeded 778 times) contains only `origin`. They came in back-to-back pairs, which matches this function's double probe. The exact caller was not identified. Fix: gate the function itself with shouldProbeGitRemote for every remote except `origin`, reusing the cached remote-name listing (config-signature revalidated), so every current and future caller inherits it. Adding an upstream remote later is still picked up on the next listing refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughNon-origin remote lookups now check Merge Risk: ⚪ Minimal · up to Missing non-origin remotes no longer trigger repeated URL probes, while configured and newly added remotes remain discoverable. No issue requiring a fix before merge was established. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
The changed-code quality gate fails on the new test — pnpm run check:code-quality:changed reports typescript(consistent-type-assertions) at github-api-repository-remote-probe.test.ts:59 and exits non-zero, so this needs a fix before merge.
Reviewed changes
- Gated non-origin remote probes:
getGitHubApiRepositoryForRemotenow runsshouldProbeGitRemotefor every remote exceptoriginand returnsnullwhen the cached remote listing proves the remote is absent, so ungated callers (getRepoUpstream, the tracked-upstream branch fallback, explicit-upstreampreference) stop spawning a failinggit remote get-url <name>on each poll. - Regression test: new
github-api-repository-remote-probe.test.tsdrives the real implementation with onlygitExecFileAsyncmocked, asserting zeroget-url upstreamexecs across repeated 60 s-apart polls, that upstream detection still works when configured or added later, and thatoriginis still probed unconditionally.
The gate placement is sound: every skipped call is one where git remote get-url <name> would have failed anyway, shouldProbeGitRemote fails open when the listing errors, and origin keeps its unconditional probe. I verified the new tests are real coverage — reverting the gate makes 3 of the 5 fail (2 get-url upstream execs on a single cold call, 10 across 5 polls).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| const error = new Error(`Command failed: git remote get-url ${remoteName}`) as Error & { | ||
| stderr: string | ||
| } | ||
| error.stderr = `error: No such remote '${remoteName}'` | ||
| return error |
There was a problem hiding this comment.
The changed-code quality gate rejects this bare assertion (casting code quality: 1 new finding(s), typescript(consistent-type-assertions) at line 59). AGENTS.md requires avoiding type assertions or adding a line-scoped // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: … rationale. The identical pattern at github-repository-identity.fork-owner-repo.test.ts:69 is unchanged, so it isn't gated — this line is.
| const error = new Error(`Command failed: git remote get-url ${remoteName}`) as Error & { | |
| stderr: string | |
| } | |
| error.stderr = `error: No such remote '${remoteName}'` | |
| return error | |
| return Object.assign(new Error(`Command failed: git remote get-url ${remoteName}`), { | |
| stderr: `error: No such remote '${remoteName}'` | |
| }) |
…orRemote (#41276) Callers such as getRepoUpstream and the tracked-upstream branch fallback called getGitHubApiRepositoryForRemote without checking the cached remote listing, causing repos without an upstream remote to run failing git remote get-url upstream execs on cold lookups. Gate non-origin remotes on shouldProbeGitRemote at the shared entry point while keeping origin unconditional. Refs #22684 Co-authored-by: h5k <31630310+h5kk@users.noreply.github.com>
|
Thanks for this optimization! Rebased onto current |

ELI5
On repos that have no
upstreamremote (most repos), Orca kept runninggit remote get-url upstream, which always fails, as a background subprocess over and over. This PR makes the shared lookup function check the cached list of remotes first, so it never asks git about a remote that doesn't exist.What Changed
getGitHubApiRepositoryForRemote(src/main/github/github-api-repository-remote-probe.ts) now callsshouldProbeGitRemotefor every remote name exceptoriginbefore probing. Before, only some callers gated it (e.g.resolveGitHubApiRepositoryCandidates, which #18455 fixed). Others call it directly:getRepoUpstream, the tracked-upstream-branch fallback inbranch-lookup-resolution.ts, and issue source preference'upstream'. Also, one cold call for a missing remote runsget-urltwice: ingetOwnerRepoForRemoteand again ingetEnterpriseGitHubRepoSlugForRemote, whoseoriginRepoCachehas a flat 30 s TTL.originis still probed unconditionally, because callers depend on that. Adding anupstreamremote later is picked up on the next remote-listing refresh (config-signature revalidated).Why
Field data from one Windows machine (trace logs):
git remote get-url upstreamexecs over ~15 days on repos with onlyorigin. That's 60% of allgit remotecalls.git remotelisting succeeded 778 times and contained onlyorigin.Honest caveat: I could not identify which caller produced those runs. Trace spans carry no parent span context, and ~35 min of running a build with this fix (plus a stack-trace log on the new gate) didn't reproduce the trigger. Gating at the shared function covers every caller, current and future, instead of patching one call site.
Linked Issue
Related: #18455 (partial fix of the same symptom). No open issue found for the remaining case.
Visual Proof
N/A: background subprocess behavior, no UI change.
Testing
get-url upstreamexecs over ~35 min (384 git execs total), but the original trigger didn't occur in that window either, so this isn't proof.github-api-repository-remote-probe.test.tsdrives the real implementation (only git exec mocked). It asserts zeroget-url upstreamexecs across repeated 60 s-apart calls when the remote is missing, that upstream detection still works when the remote exists or is added later, and thatoriginis always probed.Related suites pass (github-api-repository, github-repository-identity, remote-name-listing, review-head-remote, client).
tsc(node) clean, oxlint and oxfmt clean on changed files. Platform: Windows 11.AI Disclosure
Investigation and implementation by Claude Opus 5.5 (Claude Code), reviewed by me.
Agent skill upstream boundary
Checklist
N/Awith reason for visualspnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass: targeted suites, typecheck and lint pass locally; full suite left to CI🤖 Generated with Claude Code