-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix: Resolve Windows startup/exit hangs and shell warnings #1175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Fix DeprecationWarning in shellExecutionService by removing empty args. - Add timeout to PowerShell IDE detection to prevent startup hangs. - Add timeout to IdeClient initialization to allow other commands to load. - Add timeout to exit cleanup to prevent process hanging on quit. - Ensure commands are reloaded after IDE detection completes.
📋 Review SummaryThis PR addresses critical stability issues on Windows where the CLI would hang during startup and exit, and also fixes a Node.js deprecation warning. The changes implement timeout mechanisms for critical blocking operations and fix API usage for shell execution. Overall, this is a solid improvement to the reliability and user experience of the CLI, particularly for Windows users. 🔍 General Feedback
🎯 Specific Feedback🔴 CriticalNo specific issues identified in this review. 🟡 HighNo specific issues identified in this review. 🟢 Medium
🔵 Low
✅ Highlights
|
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
Summary
This PR addresses critical stability issues on Windows where the CLI would hang during startup (preventing commands like /quit from loading) and during exit. It also fixes a Node.js deprecation warning related to shell execution.
Problem
Startup Hang: On some Windows machines, the PowerShell command used to detect the IDE environment (Get-CimInstance) can be extremely slow or unresponsive. This blocked the initialization of IdeClient, which in turn blocked the loading of all built-in commands. As a result, the CLI would start, but typing / would show no commands, and /quit would not work.
Exit Hang: When running /quit or pressing Ctrl+C, the application attempts to disconnect the IdeClient. If the detection process was still stuck, this cleanup step would also hang, preventing the process from terminating.
Deprecation Warning: Using spawn with shell: true and an empty arguments array caused a Node.js DeprecationWarning.
Solution
Implemented timeout mechanisms for critical blocking operations and fixed the API usage for shell execution.
Detailed Changes
shellExecutionService.ts
Removed the empty args array [] when calling spawn with shell: true to resolve the DeprecationWarning.
process-utils.ts
Added a 5-second timeout to the PowerShell execution used for IDE detection. This prevents the detection logic from hanging indefinitely.
ideCommand.ts
Added a 1-second timeout to IdeClient.getInstance() during the initial command loading phase.
If initialization takes longer than 1s, a placeholder /ide command is registered immediately. This ensures that other critical commands (like /quit, /help) are available to the user instantly, without waiting for slow IDE detection.
slashCommandProcessor.ts
Added a listener to trigger reloadCommands() once IdeClient initialization completes. This ensures that the full /ide command functionality becomes available automatically once the background detection finishes.
AppContainer.tsx
Added a 2-second timeout to the exit cleanup logic. If disconnecting the IDE client takes too long, the process will force exit
, ensuring the CLI remains responsive to termination requests.
Impact
Windows Users: significantly improved startup reliability and exit responsiveness. The CLI is now guaranteed to be usable immediately after launch, even if the system's PowerShell is slow.
All Users: Cleaner console output (no deprecation warnings).