You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* test: update snapshots for system prompt working directory instructions
Signed-off-by: Eric Wheeler <[email protected]>
---------
Signed-off-by: Eric Wheeler <[email protected]>
Co-authored-by: Eric Wheeler <[email protected]>
Co-authored-by: Chris Estreich <[email protected]>
workingDirInfo+=`; command changed working directory for this terminal to '${newWorkingDir.toPosix()} so be aware that future commands will be executed from this directory`
Copy file name to clipboardExpand all lines: src/core/prompts/sections/rules.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,8 @@ export function getRulesSection(
64
64
65
65
RULES
66
66
67
-
- Your current working directory is: ${cwd.toPosix()}
67
+
- The project base directory is: ${cwd.toPosix()}
68
+
- All all file paths must be relative to this directory. However, commands may change directories in terminals, so respect working directory specified by the response to <execute_command>.
68
69
- You cannot \`cd\` into a different directory to complete a task. You are stuck operating from '${cwd.toPosix()}', so be sure to pass in the correct 'path' parameter when using tools that require a path.
69
70
- Do not use the ~ character or $HOME to refer to the home directory.
70
71
- Before using the execute_command tool, you must first think about the SYSTEM INFORMATION context provided to understand the user's environment and tailor your commands to ensure they are compatible with their system. You must also consider if the command you need to run should be executed in a specific directory outside of the current working directory '${cwd.toPosix()}', and if so prepend with \`cd\`'ing into that directory && then executing the command (as one command since you are stuck operating from '${cwd.toPosix()}'). For example, if you needed to run \`npm install\` in a project outside of '${cwd.toPosix()}', you would need to prepend with a \`cd\` i.e. pseudocode for this would be \`cd (path to project) && (command, in this case npm install)\`.
console.log("[Terminal] Shell integration not available. Command execution aborted.")
184
+
console.log(`[Terminal${this.id}] Shell integration not available. Command execution aborted.`)
179
185
process.emit(
180
186
"no_shell_integration",
181
-
"Shell integration initialization sequence '\\x1b]633;A' was not received within 4 seconds. Shell integration has been disabled for this terminal instance.",
187
+
"Shell integration initialization sequence '\\x1b]633;A' was not received within 4 seconds. Shell integration has been disabled for this terminal instance. Increase the timeout in the settings if necessary.",
0 commit comments