Skip to content

fix: use remote with .git suffix as main clone url - #4301

Merged
mbani01 merged 2 commits into
mainfrom
fix/git_integration_failed_clones
Jul 3, 2026
Merged

fix: use remote with .git suffix as main clone url#4301
mbani01 merged 2 commits into
mainfrom
fix/git_integration_failed_clones

Conversation

@mbani01

@mbani01 mbani01 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This pull request improves the robustness of the git cloning process in clone_service.py by introducing fallback logic for repository URLs and adjusting retry behavior. The most important changes are:

Cloning Robustness Improvements:

  • Both _perform_minimal_clone and _perform_full_clone now attempt to clone using the .git suffix on the remote URL first, and if that fails, they log a warning and retry with the original URL. This helps handle repositories that may or may not require the .git suffix. [1] [2]

Retry Behavior Adjustment:

  • The maximum number of retry attempts for clone errors has been reduced from 6 to 3, making failures surface sooner and reducing unnecessary retries.

Note

Medium Risk
Changes core onboarding clone paths and broad except Exception fallback could hide non-URL failures; fewer retries may increase clone failures under flaky networks.

Overview
Clone URL handling in _perform_minimal_clone and _perform_full_clone now tries git clone against {remote}.git first, then on any failure logs a warning and retries with the stored bare remote (callers already normalize via removesuffix(".git")).

Retry policy for @retry_on_clone_error (minimal/full clone and batch deepen) drops max attempts from 6 → 3, so transient rate-limit/network errors fail faster.

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

…t suffix

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 self-assigned this Jul 3, 2026
Copilot AI review requested due to automatic review settings July 3, 2026 10:33
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 and found 1 potential issue.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit ccc6661. Configure here.

self.logger.warning(
f"Clone with .git suffix failed, falling back to bare URL: {remote}"
)
await run_shell_command([*base_cmd, remote, "."], cwd=path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Retryable errors trigger URL fallback

Medium Severity

The .git-suffix clone path uses a bare except Exception, so transient failures such as RateLimitError, NetworkError, and RemoteServerError from run_shell_command trigger an immediate bare-URL clone instead of propagating for @retry_on_clone_error. That bypasses exponential backoff on the primary URL and can add an extra clone during rate limits or outages.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ccc6661. Configure here.

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

This PR updates the git-integration clone flow to be more tolerant of remotes that may or may not require a .git suffix, and reduces the number of retry attempts for certain clone failures.

Changes:

  • Reduced tenacity retry attempts for retryable clone errors from 6 to 3.
  • Added “try {remote}.git first, then fall back to {remote}” logic for both minimal and full clones.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +196 to +200
except Exception:
self.logger.warning(
f"Clone with .git suffix failed, falling back to bare URL: {remote}"
)
await run_shell_command([*base_cmd, remote, "."], cwd=path)
Comment on lines +388 to +392
except Exception:
self.logger.warning(
f"Clone with .git suffix failed, falling back to bare URL: {remote}"
)
await run_shell_command([*base_cmd, remote, "."], cwd=repo_path)
Comment on lines +193 to +195
base_cmd = ["git", "clone", "--depth=1", "--no-tags", "--single-branch"]
try:
await run_shell_command([*base_cmd, f"{remote}.git", "."], cwd=path)
@mbani01
mbani01 merged commit 2bf124b into main Jul 3, 2026
15 checks passed
@mbani01
mbani01 deleted the fix/git_integration_failed_clones branch July 3, 2026 10:45
skwowet pushed a commit that referenced this pull request Jul 3, 2026
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
skwowet pushed a commit that referenced this pull request Jul 3, 2026
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
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.

3 participants