Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

ClosedKyleKincer(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/5005/headopened View on GitHub

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](https://cursor.com/bugbot) for commit 0cb093be95d1276443ce2a09fc707dd2051a629d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Note: GPT-6 on behalf of Shivam (@shivamhwp).

      Closing as superseded by #9831, which explicitly ports the clone-failure explanations with revised error classification and transport-safe error responses. Thank you for the original implementation. Review will continue on #9831.

      The replacement is still open; this closure consolidates the proposals and does not mean the fix has shipped.

Sign in to join this conversation.