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(terminal): retry with execa when shell integration loses command
When shell integration fails with commandSubmitted=true (command was
submitted but output tracking was lost), silently retry with execa
fallback instead of showing a dead-end error to the user.
Issues: #779, #705, #634
Copy file name to clipboardExpand all lines: src/core/tools/ExecuteCommandTool.ts
+21-10Lines changed: 21 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -175,17 +175,28 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
175
175
}
176
176
177
177
pushToolResult(result)
178
-
}else{
179
-
// Command was submitted but shell integration lost track of it — show warning.
180
-
awaittask.say("shell_integration_warning")
181
-
182
-
if(errorinstanceofShellIntegrationError){
183
-
pushToolResult(
184
-
"Command was submitted in the VS Code terminal, but shell integration did not report its output or completion status. Do not run the command again automatically.",
185
-
)
186
-
}else{
187
-
pushToolResult(`Command failed to execute in terminal due to a shell integration error.`)
178
+
}elseif(errorinstanceofShellIntegrationError){
179
+
// Command WAS submitted but shell integration lost track of output.
180
+
// Retry with execa so the user always gets a result. The original
181
+
// command may have already executed in the terminal, so the retried
182
+
// output could duplicate or differ — but a result is always better UX
Copy file name to clipboardExpand all lines: src/integrations/terminal/TerminalProcess.ts
+16-12Lines changed: 16 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -95,18 +95,22 @@ export class TerminalProcess extends BaseTerminalProcess {
95
95
// Remove event listener to prevent memory leaks
96
96
this.removeAllListeners("stream_available")
97
97
98
-
// Emit no_shell_integration event with descriptive message
99
-
this.emit("no_shell_integration",{
100
-
message: `VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout()/1000} seconds. Terminal problem?`,
101
-
commandSubmitted: true,
102
-
})
103
-
104
-
// Reject with descriptive error
105
-
reject(
106
-
newError(
107
-
`VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout()/1000} seconds.`,
108
-
),
109
-
)
98
+
// Emit no_shell_integration event with commandSubmitted: true so the
99
+
// ExecuteCommandTool catch block retries via execa fallback. The command
100
+
// was already submitted to the terminal (executeCommand() returned),
101
+
// so the original may still be running — the retried execa output may
102
+
// duplicate or differ, but a result is always better than a dead-end.
103
+
this.emit("no_shell_integration",{
104
+
message: `VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout()/1000} seconds. The command was submitted but output tracking was lost; retrying with fallback executor.`,
105
+
commandSubmitted: true,
106
+
})
107
+
108
+
// Reject with descriptive error
109
+
reject(
110
+
newError(
111
+
`VSCE shell integration stream did not start within ${Terminal.getShellIntegrationTimeout()/1000} seconds.`,
0 commit comments