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
// This may happen if the last content block was completed before
76
80
// streaming could finish. If streaming is finished, and we're out of
@@ -111,8 +115,11 @@ export async function presentAssistantMessage(cline: Task) {
111
115
if(cline.didRejectTool){
112
116
// For native protocol, we must send a tool_result for every tool_use to avoid API errors
113
117
consttoolCallId=mcpBlock.id
118
+
constskipCount=(clineasany).batchSkipCount??0
119
+
constnextSkipCount=skipCount+1
120
+
;(clineasany).batchSkipCount=nextSkipCount
114
121
consterrorMessage=!mcpBlock.partial
115
-
? `Skipping MCP tool ${mcpBlock.name} due to user rejecting a previous tool.`
122
+
? `Skipping MCP tool ${mcpBlock.name} due to user rejecting a previous tool. (Skipped ${nextSkipCount} tool${nextSkipCount>1 ? "s" : ""} in this batch.)`
116
123
: `MCP tool ${mcpBlock.name} was interrupted and not executed due to user rejecting a previous tool.`
117
124
118
125
if(toolCallId){
@@ -391,8 +398,11 @@ export async function presentAssistantMessage(cline: Task) {
391
398
if(cline.didRejectTool){
392
399
// Ignore any tool content after user has rejected tool once.
393
400
// For native tool calling, we must send a tool_result for every tool_use to avoid API errors
401
+
constskipCount=(clineasany).batchSkipCount??0
402
+
constnextSkipCount=skipCount+1
403
+
;(clineasany).batchSkipCount=nextSkipCount
394
404
consterrorMessage=!block.partial
395
-
? `Skipping tool ${toolDescription()} due to user rejecting a previous tool.`
405
+
? `Skipping tool ${toolDescription()} due to user rejecting a previous tool. (Skipped ${nextSkipCount} tool${nextSkipCount>1 ? "s" : ""} in this batch.)`
396
406
: `Tool ${toolDescription()} was interrupted and not executed due to user rejecting a previous tool.`
@@ -181,10 +217,16 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
181
217
182
218
if(errorinstanceofShellIntegrationError){
183
219
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.",
220
+
formatResponse.toolError(
221
+
"Command was submitted in the terminal, but its output and completion status could not be tracked due to a shell integration error. The command may still be running. Do NOT re-run the command automatically — inspect the terminal manually and report the result.",
222
+
),
185
223
)
186
224
}else{
187
-
pushToolResult(`Command failed to execute in terminal due to a shell integration error.`)
225
+
pushToolResult(
226
+
formatResponse.toolError(
227
+
`Command failed to execute in terminal: ${errorinstanceofError ? error.message : String(error)}. Check the terminal state before retrying.`,
228
+
),
229
+
)
188
230
}
189
231
}
190
232
}
@@ -209,6 +251,8 @@ export type ExecuteCommandOptions = {
209
251
terminalShellIntegrationDisabled?: boolean
210
252
commandExecutionTimeout?: number
211
253
agentTimeout?: number
254
+
/** When true, forces creation of a fresh terminal even for retries. */
255
+
forceNewTerminal?: boolean
212
256
}
213
257
214
258
exportasyncfunctionexecuteCommandInTerminal(
@@ -430,7 +474,10 @@ export async function executeCommandInTerminal(
0 commit comments