Skip to content

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

Open
lnieuwenhuis wants to merge 3 commits into
pingdotgg:mainfrom
lnieuwenhuis:fix/clone-failure-detail
Open

fix(source-control): explain clone failures#9831
lnieuwenhuis wants to merge 3 commits into
pingdotgg:mainfrom
lnieuwenhuis:fix/clone-failure-detail

Conversation

@lnieuwenhuis

@lnieuwenhuis lnieuwenhuis commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Failed clones surface a bare git error, leaving users to guess between SSH trust, SSH auth, HTTPS auth, DNS, and connectivity problems.

Classify stderr with an ordered matcher (generic repository-not-found last, since SSH emits it alongside DNS errors) and wrap failures in a transport-safe error carrying lengths only, never raw stderr over RPC. Unknown transports get a neutral message instead of an HTTPS guess.

Ports #5005 onto current main.

Built with muse-spark-1.3-contributor via OpenCode in T3 Code.


Note

Medium Risk
Changes clone error handling and RPC-visible failure payloads; misclassification could mislead users, but scope is limited to source-control clone flows.

Overview
Failed repository clones now return fixed, actionable user messages instead of leaking raw Git stderr over RPC.

cloneRepository runs git clone with allowNonZeroExit, classifies stderr via a new cloneFailureDetail matcher (SSH host key, SSH/HTTPS auth, DNS, connectivity, repo access, then a generic fallback), and fails with SourceControlRepositoryError whose cause is a GitCommandError carrying only command metadata and output lengths—not stderr text. When no provider is passed, the service infers provider kind from the remote URL.

New effect tests cover each classified failure path and assert the mapped detail plus transport-safe GitCommandError shape.

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

Note

Add effect test for cloneRepository failure explanations

  • Adds a parameterized effect test in SourceControlRepositoryService.test.ts covering SSH host-key failures, SSH public-key auth failures, HTTPS credential failures, DNS resolution failures, connection timeouts, and unrecognized Git failures.
  • Each case mocks a non-zero Git result and verifies the operation, inferred GitHub provider, actionable detail, GitCommandError cause, fixed cause detail, and captured stderr length.
  • Risk: the test suite now requires cloneRepository to map each Git stderr pattern to the exact actionable message listed in the test cases; mismatches will fail the suite.

Macroscope summarized 8072f19.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 4, 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 default effort and found 2 potential issues.

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 912c26b. Configure here.

Comment thread apps/server/src/sourceControl/SourceControlRepositoryService.ts
Comment thread apps/server/src/sourceControl/SourceControlRepositoryService.ts
@macroscopeapp

macroscopeapp Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — The PR narrowly improves failed clone reporting by converting Git stderr into actionable, transport-safe messages while preserving successful clone behavior. It is covered by focused tests and introduces no schema, deployment, default, or static-analysis changes.

Not approved because:

  • Monthly spending limit reached (workspace setting). Approvability relies on correctness review in order to determine eligibility

Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/server/src/sourceControl/SourceControlRepositoryService.ts Outdated
…h and timeouts

Azure DevOps SSH public-key failures no longer get HTTPS advice; macOS SSH Operation timed out maps to connectivity; GitCommandError cause uses git-level detail.
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Sep 4, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 6, 2026 19:36

Dismissing prior approval to re-evaluate 7590f3e

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:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant