Skip to content

fix: add timeout and disable terminal prompts for remote git commands#1078

Merged
yamadashy merged 5 commits intoyamadashy:mainfrom
Pipboyguy:fix/git-terminal-prompt-timeout
Jan 8, 2026
Merged

fix: add timeout and disable terminal prompts for remote git commands#1078
yamadashy merged 5 commits intoyamadashy:mainfrom
Pipboyguy:fix/git-terminal-prompt-timeout

Conversation

@Pipboyguy
Copy link
Contributor

Prevents indefinite hangs when accessing inaccessible repositories (non-existent, private, or requiring auth).

Changes:

  • Set GIT_TERMINAL_PROMPT=0 to fail fast instead of waiting for credentials
  • Add 30s timeout to remote git operations

Fixes #1077

Prevents indefinite hangs when accessing inaccessible repositories.

Fixes yamadashy#1077
@Pipboyguy Pipboyguy requested a review from yamadashy as a code owner January 6, 2026 07:30
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Pipboyguy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses potential indefinite hangs during remote Git operations by implementing a 30-second timeout and disabling interactive terminal prompts for credentials. These changes enhance the robustness of Git interactions, allowing the system to fail quickly and gracefully when encountering inaccessible, non-existent, or authentication-requiring repositories, thereby improving overall system reliability and responsiveness.

Highlights

  • Timeout for Remote Git Operations: Introduced a 30-second timeout for all remote Git commands (ls-remote, fetch, clone) to prevent indefinite hangs when repositories are inaccessible or slow.
  • Disable Git Terminal Prompts: Set the GIT_TERMINAL_PROMPT environment variable to 0 for remote Git commands, ensuring that operations fail fast instead of waiting for user credentials interactively.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Important

Review skipped

Auto incremental 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.

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

📝 Walkthrough

Walkthrough

This change adds timeout enforcement and terminal prompt suppression to Git remote operations in gitCommand.ts. A shared remoteOpts configuration combining a 30-second timeout and GIT_TERMINAL_PROMPT=0 environment variable is applied consistently to git ls-remote, fetch, and clone operations to prevent indefinite hangs on inaccessible repositories.

Changes

Cohort / File(s) Summary
Git Remote Operation Configuration
src/core/git/gitCommand.ts
Introduces GIT_REMOTE_TIMEOUT constant (30s) and gitRemoteEnv to suppress interactive prompts. Creates shared remoteOpts combining timeout and environment settings. Applies remoteOpts to git ls-remote, fetch operations (with and without remoteBranch), and clone operations to standardize remote command behavior and prevent indefinite hangs.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Support commit SHA in --remote-branch option #212: Also modifies git remote operation paths (shallow clone and fetch) in gitCommand.ts, introducing remoteBranch and commit-SHA handling that interacts with the timeout/environment configuration changes in this PR.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: adding timeout and disabling terminal prompts for remote git commands.
Description check ✅ Passed The description includes the key changes (GIT_TERMINAL_PROMPT=0, 30s timeout), explains the problem being solved, and links the corresponding issue.
Linked Issues check ✅ Passed The PR successfully addresses issue #1077 by implementing the 30s timeout and GIT_TERMINAL_PROMPT=0 environment variable across all remote git operations as proposed.
Out of Scope Changes check ✅ Passed All changes in gitCommand.ts are directly related to fixing the timeout and terminal prompt issue; no out-of-scope modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds timeouts and disables terminal prompts for remote git commands to prevent hangs, which is a great improvement. However, the changes will break existing unit tests in tests/core/git/gitCommand.test.ts because the mocks for execFileAsync are no longer correct. This is a critical issue that needs to be addressed. Please update the tests to reflect the new arguments passed to execFileAsync and consider adding assertions for the new timeout and environment variables. I have also included some minor suggestions to improve code consistency by centralizing the remote command options.

Pipboyguy and others added 3 commits January 6, 2026 09:34
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Use gitRemoteOpts constant consistently across all remote git operations
- Update tests to expect the third argument (options with timeout and env)
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.16%. Comparing base (8cb110c) to head (af2387c).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1078   +/-   ##
=======================================
  Coverage   87.15%   87.16%           
=======================================
  Files         116      116           
  Lines        4376     4379    +3     
  Branches     1019     1019           
=======================================
+ Hits         3814     3817    +3     
  Misses        562      562           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yamadashy
Copy link
Owner

Hi @Pipboyguy!

Thanks for the PR! The fix looks good and the code is solid.

Merging this now. Thanks for the contribution! 🙏

@yamadashy yamadashy merged commit 70b5e1b into yamadashy:main Jan 8, 2026
54 checks passed
yamadashy added a commit that referenced this pull request Jan 18, 2026
Add release notes for v1.11.1 covering:
- Multi-root directory labels (#1024)
- Non-interactive skill generation options (#1022)
- Remote git command timeout fix (#1078)
- CLI output visibility fix for light themes (#1088)
- Library bundling documentation (#1075)

Improve release note generation guidelines:
- Clarify "What's New" vs "Improvements" usage
- Add rule to include related issue numbers with PRs
- Add rule to include links in documentation sections
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.

pack_remote_repository hangs indefinitely on inaccessible repos

2 participants