Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/core/task/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
const isMessageQueued = !this.messageQueueService.isEmpty()
const isStatusMutable = !partial && isBlocking && !isMessageQueued
let statusMutationTimeouts: NodeJS.Timeout[] = []
const statusMutationTimeout = 5_000

if (isStatusMutable) {
console.log(`Task#ask will block -> type: ${type}`)
Expand All @@ -815,7 +816,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
this.interactiveAsk = message
this.emit(RooCodeEventName.TaskInteractive, this.taskId)
}
}, 1_000),
}, statusMutationTimeout),
)
} else if (isResumableAsk(type)) {
statusMutationTimeouts.push(
Expand All @@ -826,7 +827,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
this.resumableAsk = message
this.emit(RooCodeEventName.TaskResumable, this.taskId)
}
}, 1_000),
}, statusMutationTimeout),
)
} else if (isIdleAsk(type)) {
statusMutationTimeouts.push(
Expand All @@ -837,7 +838,7 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
this.idleAsk = message
this.emit(RooCodeEventName.TaskIdle, this.taskId)
}
}, 1_000),
}, statusMutationTimeout),
)
}
} else if (isMessageQueued) {
Expand All @@ -846,17 +847,19 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
const message = this.messageQueueService.dequeueMessage()

if (message) {
// Check if this is a tool approval ask that needs to be handled
// Check if this is a tool approval ask that needs to be handled.
if (
type === "tool" ||
type === "command" ||
type === "browser_action_launch" ||
type === "use_mcp_server"
) {
// For tool approvals, we need to approve first, then send the message if there's text/images
// For tool approvals, we need to approve first, then send
// the message if there's text/images.
this.handleWebviewAskResponse("yesButtonClicked", message.text, message.images)
} else {
// For other ask types (like followup), fulfill the ask directly
// For other ask types (like followup), fulfill the ask
// directly.
this.setMessageResponse(message.text, message.images)
}
}
Expand Down
Loading