Roo-Code/src
KJ7LNW 6301e90454
Fix shell integration race condition (and other minor fixup/cleanup) (#1660)
* fix: clarify PowerShell command completion workaround

The command completion detection approach in PowerShell requires an output
string to allow duplicate commands to execute in some versions of code.
Update the string to explicitly indicate it is a Roo PowerShell workaround,
making it clear in terminal output that this is intentional behavior rather
than a side effect.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* cleanup: improve terminal logging and error handling

No functional changes - purely improves error handling and logging clarity.

Terminal.ts:
- Handle undefined process state in setActiveStream without throwing
- Add terminal IDs to all log messages for better traceability
- Improve error message clarity in shell integration timeout

TerminalRegistry.ts:
- Reorganize shell execution event handlers for better flow
- Log shell execution events before processing for reliable debugging
- Add detailed context to terminal not found scenarios
- Include command and execution state in error messages

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* feat: make terminal shell integration timeout configurable

Users with long shell startup times were encountering "Shell Integration Unavailable" errors due to the hard-coded 4s timeout. The timeout is now configurable through Advanced Settings (1-60s).

Thanks @filthy for troubleshooting and @kiwina for suggesting making the timeout configurable.

Fixes #1654

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* critical fix: race condition that prevents command completion

Terminal running state is now managed in TerminalRegistry instead of Terminal to prevent race between stream close and shell completion.

While this race may not trigger on current VSCode versions, newer releases with additional terminal fixes may expose the issue. This proactively prevents "Shell execution end event received, but process is not running" errors.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* fix: improve command execution path reporting

Enhance clarity of command execution context and error reporting:

- Check to see if the directory changed because of the command
- Clarify execution path message
- Add explicit message when command exits with non-zero code

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* system instructions: clarify terminal directory operations

Clear guidance for the AI system on:
- Working directory constraints
- Path handling requirements
- Tool vs terminal directory behavior

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

* test: update snapshots for system prompt working directory instructions

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>

---------

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Chris Estreich <cestreich@gmail.com>
2025-03-17 23:57:20 -07:00
..
__mocks__ fix ut 2025-03-17 14:41:18 +08:00
activate Add Cline events and roofactor subtasks slightly 2025-03-12 22:52:37 -07:00
api Choose specific provider when using OpenRouter (#1753) 2025-03-17 15:40:27 -07:00
core Fix shell integration race condition (and other minor fixup/cleanup) (#1660) 2025-03-17 23:57:20 -07:00
exports Fix shell integration race condition (and other minor fixup/cleanup) (#1660) 2025-03-17 23:57:20 -07:00
integrations Fix shell integration race condition (and other minor fixup/cleanup) (#1660) 2025-03-17 23:57:20 -07:00
services optimize McpHub.ts 2025-03-17 23:57:59 +08:00
shared Fix shell integration race condition (and other minor fixup/cleanup) (#1660) 2025-03-17 23:57:20 -07:00
utils add multiple workspaces support (#1725) 2025-03-18 02:14:39 -04:00
extension.ts 1. Added validation for task history and added option for user to remove/keep task in history 2025-03-16 00:07:21 +00:00