Repository navigation
fix(cli): prevent background git operations from hijacking stdin - #29148
DavidAPierce wants to merge 5 commits into
Conversation
b6539c7 to
b404f4f
Compare
|
📊 PR Size: size/M
|
Summary of ChangesHello, 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 resolves an issue where background Git operations in the CLI would inadvertently capture terminal input, causing the application to freeze. By enforcing non-interactive settings and implementing timeouts for network-dependent Git commands, the changes ensure that extension management remains resilient and does not interfere with the user's interactive session. Highlights
Using Gemini Code AssistThe 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
Customization To customize the 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 Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. 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. Footnotes
|
|
Size Change: +1 kB (0%) Total Size: 35.3 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a non-interactive Git client configuration to prevent background Git operations from prompting for user input or blocking terminal execution. It also adds a 15-second timeout to git ls-remote operations during extension update checks, along with corresponding unit tests. The review feedback correctly identifies that the setTimeout used for the background timeout is never cleared, which can keep the Node.js event loop active and cause tests or the CLI process to hang. A code suggestion is provided to clear the timeout in a .finally block.
|
We need this fix asap. It blocks CLI terminal entirely. |
Summary
This PR addresses issue #23480 where background extension update checks (
git.listRemote) or clones (git.clone) spawn Git without disabling interactive terminal prompts. If credentials or passphrases are challenged under slow, private, or authenticated remotes, Git blocks waiting onstdin, which is invisible under the Ink TUI, causing the terminal CLI to freeze and hijack keyboard input.Details
createNonInteractiveGithelper inpackages/cli/src/config/extensions/github.tsthat configuressimple-gitwithGIT_TERMINAL_PROMPT: '0'andGIT_SSH_COMMAND: 'ssh -o BatchMode=yes'(preserving user-configured commands).createNonInteractiveGitinto bothcloneFromGitandcheckForExtensionUpdate.git.listRemotebackground checking incheckForExtensionUpdatewith a15_000msbackground timeout race to prevent indefinite network hangs.packages/cli/src/config/extensions/github.test.tsto verify environment variable injection and graceful handling of prompt suppression failures.Related Issues
Closes #23480
How to Validate
npm test -w @google/gemini-cli -- src/config/extensions/github.test.ts --runPre-Merge Checklist