{
 "library": "bootstrap",
 "version": "0.11.0",
 "root": "a6a3d1ff0f982ee30430c5b42f3784c8ec901fd68482cfc1bc30899c1e5e48c5",
 "license": null,
 "slug": "TaskLifecycle",
 "ref": "TaskLifecycle#5591",
 "hash": "sema:TaskLifecycle#mh:SHA-256:559124d595219af971fe018e4709077bbe77f3ce7e1769a058cbeffd4a11c38b",
 "stub": "5591",
 "layer": "Infrastructure",
 "type": "Primitives",
 "summary": "Formal state machine governing task progression",
 "mechanism": "Explicit StateTransition#bdc0 machine governing Task#a850 progression through five states: PENDING (created, awaiting assignment), ASSIGNED (claimed by an Agent#e127), RUNNING (actively executing, emitting Heartbeat#c5df), COMPLETED (successfully finished, Result#c02a attached), FAILED (terminated with Exception#ae94, retry decision required). Each transition requires a typed Event#3675: assign, start, complete, fail, cancel. Invalid transitions are rejected. RUNNING state requires periodic Heartbeat#c5df; timeout triggers automatic FAILED transition. The attached Risk#e7f6 profile informs retry and escalation policy on failure.",
 "invariants": [
  "Forward-Only: Tasks must not regress (no COMPLETED to RUNNING via StateTransition#bdc0)",
  "Single Owner: Exactly one Agent#e127 owns a Task#a850 in ASSIGNED or RUNNING state",
  "FAILED tasks must include an Exception#ae94 describing the failure",
  "RUNNING tasks must emit Heartbeat#c5df within configured interval"
 ],
 "parameters": [
  {
   "name": "heartbeat_interval_seconds",
   "type": "Integer",
   "range": "[5, 300]",
   "description": "Maximum seconds between heartbeats before RUNNING task is marked FAILED"
  }
 ],
 "signature": [
  "StateTransition(Task)"
 ],
 "preconditions": [
  "Task#a850 exists in PENDING state"
 ],
 "postconditions": [
  "Task#a850 in terminal state (COMPLETED, FAILED, or CANCELLED)"
 ],
 "failure_modes": [
  "Heartbeat timeout (agent dies silently — task stuck in RUNNING without timeout enforcement).",
  "State desync (two agents believe they own the same task due to network partition).",
  "Zombie tasks (FAILED tasks never retried or escalated — accumulate in queue)."
 ],
 "domain": "",
 "caution": "",
 "sources": [],
 "name": "TaskLifecycle",
 "builds_on": [
  {
   "alias": "heartbeat",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Heartbeat",
   "ref": "Heartbeat#c5df",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Heartbeat"
  },
  {
   "alias": "task",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Task",
   "ref": "Task#a850",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Task"
  },
  {
   "alias": "agent",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Agent",
   "ref": "Agent#e127",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Agent"
  },
  {
   "alias": "event",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Event",
   "ref": "Event#3675",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Event"
  },
  {
   "alias": "risk",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Risk",
   "ref": "Risk#e7f6",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Risk"
  },
  {
   "alias": "exception",
   "relation": "references",
   "library": "bootstrap",
   "slug": "Exception",
   "ref": "Exception#ae94",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Exception"
  },
  {
   "alias": "result",
   "relation": "yields",
   "library": "bootstrap",
   "slug": "Result",
   "ref": "Result#c02a",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/Result"
  },
  {
   "alias": "state_transition",
   "relation": "composes_with",
   "library": "bootstrap",
   "slug": "StateTransition",
   "ref": "StateTransition#bdc0",
   "url": "https://semahash.org/vocabularies/bootstrap/patterns/StateTransition"
  }
 ],
 "related": [],
 "used_by": [],
 "url": "https://semahash.org/vocabularies/bootstrap/patterns/TaskLifecycle",
 "md_url": "https://semahash.org/vocabularies/bootstrap/patterns/TaskLifecycle.md",
 "library_url": "https://semahash.org/vocabularies/bootstrap"
}
