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

Function fail_agent_task

src/tasks/local_agent.py:294–315  ·  view source on GitHub ↗

Flip status to ``failed``, record error, schedule eviction.

(
    task_id: str,
    *,
    error: str,
    registry: "RuntimeTaskRegistry",
)

Source from the content-addressed store, hash-verified

292
293
294def fail_agent_task(
295 task_id: str,
296 *,
297 error: str,
298 registry: "RuntimeTaskRegistry",
299) -> None:
300 """Flip status to ``failed``, record error, schedule eviction."""
301 def _fail(prev: TaskStateBase) -> TaskStateBase:
302 if not isinstance(prev, LocalAgentTaskState):
303 return prev
304 if is_terminal_task_status(prev.status):
305 return prev
306 # Mirror error into result_text so TaskOutput callers reading
307 # the final text still see something useful (TS does this).
308 return _terminal_replace(
309 prev,
310 status="failed",
311 error=error,
312 result_text=prev.result_text or error,
313 )
314
315 registry.update(task_id, _fail)
316
317
318def kill_async_agent(

Calls 1

updateMethod · 0.45