MCPcopy Create free account
hub / github.com/freecodexyz/free-code / failAgentTask

Function failAgentTask

src/tasks/LocalAgentTask/LocalAgentTask.tsx:437–456  ·  view source on GitHub ↗
(taskId: string, error: string, setAppState: SetAppState)

Source from the content-addressed store, hash-verified

435 * Fail an agent task with error.
436 */
437export function failAgentTask(taskId: string, error: string, setAppState: SetAppState): void {
438 updateTaskState<LocalAgentTaskState>(taskId, setAppState, task => {
439 if (task.status !== 'running') {
440 return task;
441 }
442 task.unregisterCleanup?.();
443 return {
444 ...task,
445 status: 'failed',
446 error,
447 endTime: Date.now(),
448 evictAfter: task.retain ? undefined : Date.now() + PANEL_GRACE_MS,
449 abortController: undefined,
450 unregisterCleanup: undefined,
451 selectedAgent: undefined
452 };
453 });
454 void evictTaskOutput(taskId);
455 // Note: Notification is sent by AgentTool via enqueueAgentNotification
456}
457
458/**
459 * Register an agent task.

Callers

nothing calls this directly

Calls 2

evictTaskOutputFunction · 0.85
updateTaskStateFunction · 0.50

Tested by

no test coverage detected