Skip to content

Conversation

@roomote
Copy link
Collaborator

@roomote roomote commented Jun 16, 2025

Summary

This PR fixes issue #4746 where RooCode would wait indefinitely for user input after executing PowerShell commands instead of automatically resuming when the command completes.

Root Cause

The issue was caused by PowerShell commands with sleep delays not properly signaling completion to VSCode's shell integration. When the PowerShell counter workaround and command delay features were enabled, the additional commands appended to the original command could cause the shell integration to not properly detect when the command had finished executing.

Changes Made

  1. Improved PowerShell command construction: Wrapped commands in try-finally blocks to ensure proper completion handling
  2. Added timeout mechanism: Added a timeout for PowerShell commands to prevent indefinite waiting (shell integration timeout + 5 seconds buffer)
  3. Fixed variable scoping: Moved PowerShell detection logic before it's used in the timeout mechanism
  4. Enhanced error handling: Better handling of PowerShell sleep commands to prevent hanging

Technical Details

  • Modified to use try-finally blocks for PowerShell commands with delays
  • Added a timeout mechanism that automatically resolves shell execution if VSCode's shell integration doesn't signal completion within the expected timeframe
  • Fixed variable scoping issue where was being used before declaration

Testing

  • All existing terminal tests pass
  • PowerShell-specific tests are properly skipped on systems without PowerShell Core
  • No breaking changes to existing functionality

Fixes

Closes #4746


Important

Fixes indefinite hanging of PowerShell commands in TerminalProcess.ts by adding timeouts and ensuring proper command completion.

  • Behavior:
    • Wrap PowerShell commands in try-finally blocks in TerminalProcess.ts to ensure proper completion.
    • Add timeout mechanism for PowerShell commands to prevent indefinite hanging, with a 5-second buffer over shell integration timeout.
  • Technical Changes:
    • Modify command construction to include Write-Output for PowerShell counter workaround.
    • Adjust command delay handling by wrapping in try-finally.
  • Misc:
    • Fix variable scoping issue by moving PowerShell detection logic before usage in timeout mechanism.

This description was created by Ellipsis for 8b42c16. You can customize this summary. It will automatically update as commits are pushed.

- Improved PowerShell command construction to use try-finally blocks for better completion handling
- Added timeout mechanism for PowerShell commands to prevent indefinite waiting
- Fixed variable scoping issue in TerminalProcess.ts
- Enhanced error handling for PowerShell sleep commands

The issue was caused by PowerShell commands with sleep delays not properly signaling completion to VSCode's shell integration, causing the extension to wait indefinitely for user input.
@roomote roomote requested a review from mrubens as a code owner June 16, 2025 21:10
@roomote roomote requested review from cte and jr as code owners June 16, 2025 21:10
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Jun 16, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 16, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 17, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 17, 2025
@daniel-lxs
Copy link
Member

Closing this PR for now. The current implementation uses a static timeout, which would cause legitimate long-running commands to fail after only 10 seconds.

It might be a good idea to explore completion flags like on #4564

@daniel-lxs daniel-lxs closed this Jun 17, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 17, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Jun 17, 2025
@roomote roomote deleted the fix-4746 branch June 19, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

have to hit enter in terminal to continue after execute

4 participants