MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / onTaskAborted

Method onTaskAborted

src/core/webview/ClineProvider.ts:286–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

284 this.emit(RooCodeEventName.TaskCompleted, taskId, tokenUsage, toolUsage)
285 }
286 const onTaskAborted = async () => {
287 this.emit(RooCodeEventName.TaskAborted, instance.taskId)
288
289 try {
290 // Only rehydrate on genuine streaming failures.
291 // User-initiated cancels are handled by cancelTask().
292 if (instance.abortReason === "streaming_failed") {
293 // Defensive safeguard: if another path already replaced this instance, skip
294 const current = this.getCurrentTask()
295 if (current && current.instanceId !== instance.instanceId) {
296 this.log(
297 `[onTaskAborted] Skipping rehydrate: current instance ${current.instanceId} != aborted ${instance.instanceId}`,
298 )
299 return
300 }
301
302 const { historyItem } = await this.getTaskWithId(instance.taskId)
303 const rootTask = instance.rootTask
304 const parentTask = instance.parentTask
305 await this.createTaskWithHistoryItem({ ...historyItem, rootTask, parentTask })
306 }
307 } catch (error) {
308 this.log(
309 `[onTaskAborted] Failed to rehydrate after streaming failure: ${
310 error instanceof Error ? error.message : String(error)
311 }`,
312 )
313 }
314 }
315 const onTaskFocused = () => this.emit(RooCodeEventName.TaskFocused, instance.taskId)
316 const onTaskUnfocused = () => this.emit(RooCodeEventName.TaskUnfocused, instance.taskId)
317 const onTaskActive = (taskId: string) => this.emit(RooCodeEventName.TaskActive, taskId)

Callers

nothing calls this directly

Calls 6

getCurrentTaskMethod · 0.95
logMethod · 0.95
getTaskWithIdMethod · 0.95
emitMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected