Skip to content

fix(github): prioritize authenticated user repositories in clone search - #327659

Open
rohitbytecode wants to merge 1 commit into
microsoft:mainfrom
rohitbytecode:fix/github-clone-rank-user-repos
Open

fix(github): prioritize authenticated user repositories in clone search#327659
rohitbytecode wants to merge 1 commit into
microsoft:mainfrom
rohitbytecode:fix/github-clone-rank-user-repos

Conversation

@rohitbytecode

Copy link
Copy Markdown

Summary

Fixes #141754

User's own repos were getting buried under public search results in the GitHub clone picker. This fixes the merge order so authenticated user repos always show up first.

Root cause

GithubRemoteSourceProvider.getRemoteSources() merges results from getUserRemoteSources() and getQueryRemoteSources(). The merge was overwriting duplicates instead of keeping the first match, and cached user repos weren't being filtered against the current query. End result: your own repos could rank below public repos with a similar name, and stale cached repos showed up even when they didn't match what you typed.

Changes

  • Merge user repos first, then GitHub search results
  • Keep first occurrence on merge so user repos win over duplicates from public search
  • Filter cached user repos by the current query instead of returning them all
  • Lazily populate the user repo cache if it hasn't been initialized yet

Testing

Couldn't run the full VS Code build locally — missing the Spectre-mitigated VC++ libs on this machine. Change is small and scoped to extensions/github/src/remoteSourceProvider.ts, should be fine for CI to validate.

Copilot AI review requested due to automatic review settings July 27, 2026 17:03
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/github/src/remoteSourceProvider.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prioritizes authenticated GitHub repositories in clone search results.

Changes:

  • Preserves authenticated repositories during deduplication.
  • Filters and lazily populates the repository cache.
  • Reorders authenticated results before public search results.

Comment on lines +86 to +89
return this.userReposCache.filter(repo =>
repo.name
.toLowerCase()
.includes(normalizedQuery)
Comment on lines +81 to 83
if (this.userReposCache.length === 0) {
const res = await octokit.repos.listForAuthenticatedUser({ sort: 'updated', per_page: 100 });
this.userReposCache = res.data.map(asRemoteSource);
Comment on lines +82 to 83
const res = await octokit.repos.listForAuthenticatedUser({ sort: 'updated', per_page: 100 });
this.userReposCache = res.data.map(asRemoteSource);
Comment thread extensions/github/src/remoteSourceProvider.ts
@rohitbytecode

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clone from Github doesn't rank org repos highly

3 participants