Skip to content

fix(github): search repositories by name - #8340

Open
jesse-merhi wants to merge 4 commits into
pingdotgg:mainfrom
jesse-merhi:t3code/improve-repository-search
Open

fix(github): search repositories by name#8340
jesse-merhi wants to merge 4 commits into
pingdotgg:mainfrom
jesse-merhi:t3code/improve-repository-search

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Aug 27, 2026

Copy link
Copy Markdown

GitHub repository lookup treated a bare name such as openclaw as an exact repository path and failed.
That forced users to know the repository owner even when GitHub could find the repository by name.
This PR adds a 100 ms debounced github.com repository-name search backed by one GitHub GraphQL request through gh api graphql, while preserving exact owner/name and URL lookup.
The signed-in user's matches appear first, followed by other repositories; selecting one opens clone destination, and Back returns to search.

Change breakdown

Part Files +LOC -LOC
Web and mobile UI 2 +275 -35
Server search and transport 6 +180 -0
Shared client and contracts 5 +38 -2
Tests and fixtures 4 +160 -0
Documentation 1 +2 -1
Total 18 +655 -38

Repository search fetches owner and global matches in one gh api graphql request, avoiding GitHub's 30-request-per-minute Search API limit while preserving 100 ms live search. This PR intentionally targets github.com; GitHub Enterprise host/account routing stays in #5089 instead of being duplicated here.

UI proof

Before: direct base

Typing openclaw and pressing Enter attempts an exact lookup and fails.

Direct-base Add Project dialog showing repository lookup failed for openclaw

query: openclaw
result: Repository lookup failed

After: PR

Typing the same query starts search without Enter and returns multiple repositories, with the signed-in user's match first.

PR Add Project dialog showing multiple openclaw repositories with jesse-merhi first

query: openclaw
1. jesse-merhi/openclaw-dotfiles
2. openclaw/openclaw

query after Back: skills
1. jesse-merhi/skills
2. mattpocock/skills

shorthand query: pingdotgg/t3
highlighted result: pingdotgg/t3code
Enter: opens clone destination for pingdotgg/t3code

zero-result shorthand: octocat/code
visible fallback action: Lookup (Enter)

The recorded UI pass at d7a485d1f17b selected a result, opened clone destination, used Back to return to repository search, confirmed that Enter chooses the highlighted shorthand match, and verified the pointer-accessible fallback for a zero-result shorthand query. The current head 6cf30bd0d762 preserves that behavior, uses reactive query atoms instead of manual search effects and result state, and avoids Search API rate limits with one GraphQL request per query; focused web, mobile, and server typechecks and 39 focused tests pass.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for the UI change
  • I included a video for animation/interaction changes (not applicable; no motion change)

Created with GPT-5.6 Sol in T3 Code.


Note

Medium Risk
New authenticated GitHub GraphQL search on the add-project path increases API surface and rate-limit exposure, but it is read-scoped and does not change clone/publish write flows.

Overview
Adds GitHub repository search by name when cloning a project, so bare names like openclaw no longer require an exact owner/repo lookup.

A new sourceControl.searchRepositories RPC (read scope) runs through SourceControlRepositoryService into GitHubCli.searchRepositories, which uses gh api graphql with separate owner (user:@me) and global queries, merges/dedupes results, and boosts exact owner/repo matches. Providers without search still fall back to a single lookup.

Web (CommandPalette) and mobile (AddProjectRepositoryScreen) call the search via debounced repositorySearch query atoms as the user types on the GitHub path: results are selectable and jump to clone destination; isGitHubRepositoryShorthand keeps Enter-based exact lookup for owner/repo when search has no highlighted hits. GitHub hints/placeholders and user docs are updated accordingly.

Reviewed by Cursor Bugbot for commit 6cf30bd. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add GitHub repository search across source control and UI

  • Adds searchRepositories to GitHubCli using a GraphQL query that scopes to the authenticated owner and globally, deduplicates results, prioritizes exact owner/repo matches, and limits to 20.
  • Exposes the search via a new sourceControl.searchRepositories WebSocket RPC and updates SourceControlProvider and SourceControlRepositoryService.
  • Updates mobile (AddProjectScreen.tsx) and web (CommandPalette.tsx) Add Project flows to perform a 100ms debounced GitHub search, rendering selectable results instead of requiring exact input.
  • Behavioral Change: GitHub repository inputs hide the primary action button during search; direct lookup via Enter only triggers if the input is a valid owner/repo shorthand.

Macroscope summarized 6cf30bd.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5dc1817e-46ce-4b20-b718-49c7dca675ea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Aug 27, 2026
Comment thread apps/server/src/sourceControl/GitHubCli.ts Outdated

@macroscopeapp macroscopeapp Bot 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.

Effect service conventions review of the changed source-control service code. One finding: a fabricated Error is used to satisfy the required cause field on a pure domain failure in GitHubCli.ts. Everything else (namespace subpath imports, inline Context.Service interface, make/layer exports, dependency acquisition via yield* in make, the new GitHubServices layer composition, and error wrapping at the provider boundary) matches the conventions.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/sourceControl/GitHubCli.ts Outdated

@macroscopeapp macroscopeapp Bot 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.

Reviewed the Effect service changes (GitHubCli, GitHubServices, SourceControlProvider*, SourceControlRepositoryService, RPC/contract wiring). Layer composition, dependency acquisition (yield* VcsProcess.VcsProcess, yield* GitHubGraphQlBudget.GitHubGraphQlBudget), namespace imports, and the new searchRepositories error translation all follow the conventions. One finding below.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/sourceControl/GitHubCli.ts Outdated
@jesse-merhi
jesse-merhi force-pushed the t3code/improve-repository-search branch from a38333f to 927db59 Compare August 27, 2026 00:50
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:XXL 1,000+ changed lines (additions + deletions). labels Aug 27, 2026

@macroscopeapp macroscopeapp Bot 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.

One finding on the new GraphQL budget dependency wiring in GitHubCli.layer. Also note that the previously flagged synthetic new Error(...) used only to satisfy the required cause field (now at apps/server/src/sourceControl/GitHubCli.ts:443) is still present; see the check summary rather than a duplicate inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/sourceControl/GitHubCli.ts Outdated
return [];
}

const slashIndex = query.indexOf("/");

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.

🟠 High sourceControl/GitHubCli.ts:518

searchRepositories cannot resolve a normal GitHub URL such as https://github.com/octocat/Hello-World; it splits it into owner === "https:" and repositoryName === "github.com/octocat/Hello-World", then sends invalid repository(owner:, name:) variables. Parse supported GitHub URLs before the slash branch, or preserve the existing URL lookup path.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/sourceControl/GitHubCli.ts around line 518:

`searchRepositories` cannot resolve a normal GitHub URL such as `https://github.com/octocat/Hello-World`; it splits it into `owner === "https:"` and `repositoryName === "github.com/octocat/Hello-World"`, then sends invalid `repository(owner:, name:)` variables. Parse supported GitHub URLs before the slash branch, or preserve the existing URL lookup path.

@macroscopeapp macroscopeapp Bot 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.

One finding in apps/web/src/components/CommandPalette.tsx: in the new GitHub repository-search step, the Enter key handler bypasses the highlighted search result whenever the typed query looks like owner/repo.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/CommandPalette.tsx
@jesse-merhi
jesse-merhi force-pushed the t3code/improve-repository-search branch from 927db59 to 35fa9d1 Compare August 27, 2026 01:36
Comment thread apps/mobile/src/features/projects/AddProjectScreen.tsx Outdated

@macroscopeapp macroscopeapp Bot 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.

Reviewed the web UI changes in apps/web/src/components/CommandPalette.tsx (the only in-scope changed file). No shared-primitive or Tailwind/CSS ownership problems: the new result rows reuse the palette's item contract and ITEM_ICON_CLASS, and no new styling was introduced. Two interaction/affordance issues in the new GitHub search step are noted inline.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/CommandPalette.tsx Outdated
Comment thread apps/web/src/components/CommandPalette.tsx Outdated
@jesse-merhi
jesse-merhi force-pushed the t3code/improve-repository-search branch from 35fa9d1 to d7a485d Compare August 27, 2026 01:44
@jesse-merhi
jesse-merhi marked this pull request as ready for review August 27, 2026 01:55
Copilot AI lite review requested due to automatic review settings August 27, 2026 01:55

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.


if (provider === "github" && !isGitHubRepositoryShorthand(rawRepository)) {
return;
}

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.

GitHub field drops URL lookup

Medium Severity

Pasting a GitHub URL or SSH remote into the GitHub repository field no longer opens the repo. Search splits on the first /, so a host is treated as the owner, and exact lookup is skipped because the input is not owner/repo shorthand. gh repo view previously accepted these values.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d7a485d. Configure here.

Comment thread apps/mobile/src/features/projects/AddProjectScreen.tsx
@macroscopeapp

macroscopeapp Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — GitHub repository search is a substantial cross-layer feature adding debounced authenticated GraphQL requests, new RPC and authorization plumbing, and new web/mobile clone-flow state while changing existing lookup behavior. Unresolved findings cover URL regressions, duplicate navigation, loading and cache handling, and sparse GraphQL responses, warranting focused human review.

Not approved because:

  • 2 blocking correctness issues found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

Comment on lines +810 to +817
<ListRow
key={repository.nameWithOwner}
title={repository.nameWithOwner}
subtitle={repository.url}
icon={<SourceControlIcon kind="github" size={18} color={String(iconColor)} />}
isFirst={index === 0}
onPress={() => selectRepository(repository)}
/>

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.

🟠 High projects/AddProjectScreen.tsx:810

Repository rows remain tappable while lookupRepository is resolving, so pressing Enter and then tapping a result dispatches two StackActions.push("AddProjectDestination") actions and leaves two clone flows on the navigation stack. Disable the result rows while isSubmitting is true.

Suggested change
<ListRow
key={repository.nameWithOwner}
title={repository.nameWithOwner}
subtitle={repository.url}
icon={<SourceControlIcon kind="github" size={18} color={String(iconColor)} />}
isFirst={index === 0}
onPress={() => selectRepository(repository)}
/>
<ListRow
key={repository.nameWithOwner}
title={repository.nameWithOwner}
subtitle={repository.url}
icon={<SourceControlIcon kind="github" size={18} color={String(iconColor)} />}
isFirst={index === 0}
disabled={isSubmitting}
onPress={() => selectRepository(repository)}
/>
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/projects/AddProjectScreen.tsx around lines 810-817:

Repository rows remain tappable while `lookupRepository` is resolving, so pressing Enter and then tapping a result dispatches two `StackActions.push("AddProjectDestination")` actions and leaves two clone flows on the navigation stack. Disable the result rows while `isSubmitting` is true.

loading={isSubmitting}
/>
)}
{source === "github" && isRepositorySearchPending ? (

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.

GitHub lookup shows no loading state

Medium Severity

The GitHub spinner now follows isRepositorySearchPending instead of isSubmitting. Shorthand Enter lookup still sets isSubmitting, but that flag no longer drives any GitHub UI, so a lookup after search settles has no progress indicator for the whole request.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 91ad373. Configure here.

const isGitHubRepositorySearchPending =
normalizedRepositorySearchQuery.length > 0 &&
(normalizedRepositorySearchQuery !== debouncedRepositorySearchQuery ||
repositorySearch.isPending);

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.

Pending search hides cached results

Medium Severity

isGitHubRepositorySearchPending is true whenever repositorySearch.isPending is set, and displayedGroups then drops the list even if repositorySearch.data already has matches. After this refactor, confirm no longer snapshots results, so Back unsubscribes the SWR atom. Once staleTime (30s) expires—easy while browsing a clone folder—remount revalidates with waiting: true, and the palette shows Searching instead of the repos the user just came from. Mobile still renders the cached list during pending.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2a4c55e. Configure here.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Aug 27, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6cf30bd. Configure here.

global: Schema.Struct({ nodes: Schema.Array(RawGitHubRepositorySearchResultSchema) }),
}),
}),
),

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.

Search decode fails on sparse nodes

Medium Severity

The GraphQL search decoder requires every nodes entry to be a complete repository object. GitHub search still emits null or {} for inaccessible or non-matching union items even with type: REPOSITORY, so one sparse entry fails the whole decode as GitHubRepositorySearchDecodeError. Existing GraphQL search in this repo skips those rows instead of blanking the result set. Users then see a search failure rather than the remaining matches.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6cf30bd. Configure here.

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

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants