MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / kill_workflow_task

Function kill_workflow_task

src/tasks/local_workflow.py:131–152  ·  view source on GitHub ↗

Abort the whole run (cascades to every subagent) and mark it killed.

(task_id: str, registry: "RuntimeTaskRegistry")

Source from the content-addressed store, hash-verified

129
130
131def kill_workflow_task(task_id: str, registry: "RuntimeTaskRegistry") -> None:
132 """Abort the whole run (cascades to every subagent) and mark it killed."""
133 captured_run: Any = None
134 fired = False
135
136 def _kill(prev: TaskStateBase) -> TaskStateBase:
137 nonlocal captured_run, fired
138 if not isinstance(prev, LocalWorkflowTaskState) or is_terminal_task_status(prev.status):
139 return prev
140 captured_run = prev.run
141 fired = True
142 return _terminal_replace(prev, status="killed")
143
144 registry.update(task_id, _kill)
145 # Abort OUTSIDE the registry lock (the controller fires listeners).
146 if captured_run is not None:
147 try:
148 captured_run.controller.abort("workflow_stopped")
149 except Exception:
150 logger.exception("failed to abort workflow run %s", task_id)
151 if fired:
152 enqueue_workflow_notification(task_id, registry, status="killed")
153
154
155def skip_workflow_agent(task_id: str, agent_key: str, registry: "RuntimeTaskRegistry") -> bool:

Calls 3

updateMethod · 0.45
abortMethod · 0.45