Skip to content

fix(source-control): explain clone failures - #5005

Open
KyleKincer wants to merge 3 commits into
pingdotgg:mainfrom
KyleKincer:fix/source-control-clone-diagnostics
Open

fix(source-control): explain clone failures#5005
KyleKincer wants to merge 3 commits into
pingdotgg:mainfrom
KyleKincer:fix/source-control-clone-diagnostics

Conversation

@KyleKincer

@KyleKincer KyleKincer commented Jul 30, 2026

Copy link
Copy Markdown

Source-control clones currently collapse Git transport failures into a generic operation error. This leaves users unable to distinguish SSH host trust, SSH key authentication, HTTPS credentials, repository access, DNS, and network failures. Raw clone URLs also report the provider as unknown even when the host identifies GitHub, GitLab, Bitbucket, or Azure DevOps.

Keep cloning in the shared Git driver rather than delegating to provider CLIs. Both glab repo clone and gh repo clone ultimately invoke Git, while Bitbucket has no equivalent official CLI path; provider-specific cloning would split one operation across inconsistent implementations without fixing Git transport setup.

The clone service now captures nonzero Git results locally, maps common stderr signatures to actionable transport-safe messages, preserves structured Git failure metadata without sending raw stderr over RPC, and infers the provider from raw remote URLs. This applies uniformly to GitHub, GitLab, Bitbucket, Azure DevOps, self-hosted instances, and generic Git URLs.

Verification:

  • focused SourceControlRepositoryService tests: 8 passed
  • targeted server typecheck: passed
  • targeted lint and formatting: passed

Generated with GPT-5.6 using the Codex harness in T3 Code.


Note

Medium Risk
Changes clone error handling and user-facing transport/auth messaging without altering credential storage, but misclassified stderr patterns could mislead users during setup failures.

Overview
Clone failures now return clear, transport-safe errors instead of a generic Git failure. cloneRepository runs git clone with allowNonZeroExit, then maps common stderr patterns (SSH host trust, publickey auth, HTTPS credentials, DNS, connectivity, repo access) to actionable messages via cloneFailureDetail. Raw stderr is not exposed over RPC; failures surface as SourceControlRepositoryError with a nested GitCommandError (exit code and lengths only).

When only a remote URL is supplied, the provider is inferred with detectSourceControlProviderFromRemoteUrl so errors can name GitHub/GitLab/etc. instead of unknown.

Tests cover the main stderr cases and assert operation, provider, detail, and structured cause fields.

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

Note

Fix cloneRepository to return actionable error details on Git clone failures

  • Adds cloneFailureDetail in SourceControlRepositoryService.ts that maps common Git clone stderr patterns (SSH key issues, auth failures, DNS errors, timeouts, repo not found) to human-readable messages.
  • cloneRepository now captures the Git exit code via allowNonZeroExit: true and wraps non-zero exits in a SourceControlRepositoryError with a GitCommandError cause, replacing raw error propagation.
  • Provider is now inferred from remoteUrl via detectSourceControlProviderFromRemoteUrl when not explicitly supplied.

Macroscope summarized 0cb093b.

@coderabbitai

coderabbitai Bot commented Jul 30, 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: 5d9cfd5b-81ae-4f02-8f0a-2aa1f61b4706

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

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.

❤️ Share

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:M 30-99 changed lines (additions + deletions). labels Jul 30, 2026
Comment thread apps/server/src/sourceControl/SourceControlRepositoryService.ts Outdated
Comment thread apps/server/src/sourceControl/SourceControlRepositoryService.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 0cb093b

This PR improves error messaging for git clone failures by mapping stderr patterns to actionable, user-friendly messages. The changes are self-contained to error handling, don't alter core clone behavior, and include comprehensive tests.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:M 30-99 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.

1 participant