Skip to content

Task Graph Lifecycle

This page traces the shipped mission and typed task graph lifecycle from northbound mission intake through planning, scheduling, A2A dispatch, worker execution, artifacts, and northbound reads.

Current Design Truth

Mission execution starts at the orchestrator. mission_api.py accepts a MissionSubmitRequest, creates persisted mission state through MissionStorage, and asks MissionRuntime to run the mission loop in the background. MissionRuntime binds mission observability context and invokes the orchestrator-owned MissionGraph.

MissionGraph discovers workers, builds planner input from mission request plus discovered capabilities, obtains a runtime TaskGraph, persists planner and task graph artifacts, computes ready sets, dispatches ready atomic TaskNodes, observes worker lifecycle reports, applies retry policy, and finalizes mission state. A selected graph is executable truth for the mission; workers never create global tasks or reorder dependencies.

The task graph contract is intentionally narrow. TaskNode is the atomic unit the orchestrator may dispatch. It carries task identity, mission identity, skill identity, assigned worker, slot values, rendered instruction, dependencies, timeout, and retry policy. The scheduler treats dependencies, active workers, and locks as runtime constraints; it does not encode waiting as a fake task.

TaskOutputRef is the shared contract shape for upstream task-output references that can appear in TaskNode.slot_values before dispatch. The orchestrator validates each reference, materializes it into literal slot values before worker dispatch, and records resolved binding evidence for northbound reads. Worker dispatch remains literal-slot-only, and worker ExecuteSkillTask.slot_values never carries unresolved references. Sequential scenario flows remain ordinary TaskNode.depends_on DAG instances, not separate graph types or worker scheduling modes.

The authority split is explicit: the planner produces executable TaskGraph truth, the orchestrator owns scheduling plus dispatch-time slot resolution, and deterministic workers execute only assigned atomic TaskNodes with literal slots. Runtime-backed worker execution is worker-private MCP: the worker owns the operation identity, applies output_mapping, polls private runtime progress, reads terminal results, and converges cancellation without exposing private MCP task IDs northbound.

After execution, MissionReadService serves northbound views from persisted mission artifacts: mission state, task graph, planning details, event timeline, reports, and mission lists. The stable import facade remains omega_orchestrator.services.mission_reads.MissionReadService; the package internals split summary/list, task graph, events, reports, planning/public planning, operator read, diagnostics, and artifact-loading helpers behind that facade. Those views preserve the public DTO behavior for mission summaries, task graph, events, WorkerExecutionReport reports, public planning, monitoring, and operator reads. Public planning reads load the planning_trace storage slot through StorageExposure.PUBLIC_PROJECTED; that is the only active public-projected storage slot. The private planner_outputs/private_debug/raw_responses.json sidecar remains a writer/catalog diagnostic artifact rather than a northbound read source.

Lifecycle Diagram

This diagram follows one current shipped mission through the executable task graph path.

flowchart TD
    Submit["MissionSubmitRequest"] --> Intake["mission_api.py creates mission artifacts"]
    Intake --> Runtime["MissionRuntime starts background loop"]
    Runtime --> Discovery["MissionGraph discovers and gates workers"]
    Discovery --> PlannerInput["Build PlannerInput from mission and workers"]
    PlannerInput --> Planner["Planner service selects attempt"]
    Planner --> TaskGraph["Persist executable TaskGraph"]
    TaskGraph --> ReadySet["Scheduler computes ready TaskNode set"]
    ReadySet --> Dispatch["WorkerA2AClient dispatches assigned atomic node"]
    Dispatch --> Worker["Worker public A2A edge"]
    Worker --> Execution["WorkerService validates TaskNode and starts worker-owned MCP operation"]
    Execution --> PrivateMcp["Private LIFT2 MCP task lifecycle"]
    PrivateMcp --> Execution
    Execution --> Observe["Task observation reads WorkerTaskSnapshot"]
    Observe --> Apply["Scheduler applies report and retry policy"]
    Apply --> ReadySet
    Apply --> Storage["MissionStorage persists state, events, attempts, reports"]
    Storage --> Reads["MissionReadService projects northbound views"]

Data And Control Flow

  1. A client submits a mission to POST /missions; the orchestrator creates mission artifacts and starts MissionRuntime.
  2. MissionRuntime invokes MissionGraph with the mission id and submit request.
  3. MissionGraph discovers configured workers through WorkerA2AClient, then persists worker discovery results.
  4. The graph builds PlannerInput from the mission request and discovered worker snapshots, calls the planner service, and records planner trace artifacts.
  5. A successful planner attempt yields the runtime TaskGraph, represented as ordered TaskNodes. The graph persists the task graph and initializes runtime task states.
  6. The scheduler computes the ready set from dependency success, active workers, and locks.
  7. If a ready node contains unresolved TaskOutputRef values, the orchestrator validates the reference shape, dependency closure, source output, and consumer slot compatibility before materializing literal slot values.
  8. For every ready node, the orchestrator builds an execute-skill request with literal slot values only and dispatches it through A2A to the assigned worker.
  9. When resolution produces binding evidence, MissionStorage appends it to the task graph artifact so MissionReadService can project resolved slot bindings for operator-facing reads.
  10. Worker execution validates the assigned TaskNode, resolves private MCP implementation bindings, starts a worker-owned MCP operation, and projects accepted, started, progress, succeeded, failed, or canceled WorkerExecutionReport reports.
  11. Long-running private operations remain re-readable through worker-owned operation identity: the worker reads private runtime progress and terminal state, applies configured output_mapping, and uses private runtime cancellation for cancel convergence.
  12. Task observation reads those reports through WorkerTaskSnapshot and applies them to runtime task state.
  13. Failed or canceled attempts follow the node retry policy. Successful terminal reports record a completed task attempt.
  14. When no active or ready task remains, the graph writes final worker reports, records mission completion, and saves the terminal mission state.
  15. Northbound read routes load MissionReadService views from MissionStorage artifacts for mission detail, task graph, planning, timeline, reports, and mission lists.

Ready-Set And Observation Loop

This diagram isolates the scheduler loop after a task graph has already been selected.

flowchart TD
    State["Runtime task state"] --> Ready["Ready-set scheduler"]
    Ready --> Resolve["Resolve TaskOutputRef before dispatch"]
    Resolve --> Dispatch["A2A dispatch with literal slots"]
    Dispatch --> Worker["WorkerService executes assigned task"]
    Worker --> Snapshot["WorkerTaskSnapshot"]
    Snapshot --> Report["Worker report"]
    Report --> Apply["Apply report and retry policy"]
    Apply --> State
    Apply --> Artifacts["MissionStorage artifacts"]
    Artifacts --> Reads["MissionReadService reads"]

Authority Boundaries

Lifecycle stage Current authority Boundary rule
Mission intake Orchestrator mission API Creates mission state and starts the background mission loop.
Worker discovery WorkerA2AClient plus worker gate models Capability and readiness are validated before scheduling.
Planner input MissionGraph and planner service contracts Planner receives mission request plus discovered worker capability snapshots.
Typed TaskGraph Planner attempt validation plus TaskNode contract Runtime graph truth is persisted before dispatch.
Ready-set scheduling services/scheduler.py Only dependency-satisfied, non-conflicting atomic nodes become ready.
Task-output references TaskOutputRef contract plus orchestrator-side resolution References stay domain-neutral and are resolved before dispatch.
A2A dispatch WorkerA2AClient Dispatch crosses the public worker A2A edge only.
Assigned task execution Worker public A2A edge and WorkerService Worker executes assigned work with literal slot values only and reports lifecycle; it does not schedule globally or resolve references.
Worker-owned MCP operation apps/worker_agent/src/omega_worker_agent/mcp/operation.py, apps/worker_agent/src/omega_worker_agent/mcp/operation_projector.py (ProjectorLifecycleOwner), apps/worker_agent/src/omega_worker_agent/mcp/operation_convergence.py (McpOperationConvergence), and LIFT2 mcp_lifecycle.py Private MCP task IDs and raw diagnostics stay below the worker boundary; public reports use worker operation identity and output_mapping.
Runtime observation Task observation service and worker task snapshots Worker reports update orchestrator runtime state.
Mission artifacts MissionStorage Persisted artifacts are the durable mission truth.
Northbound reads MissionReadService and mission API read routes Operator-facing reads come from artifacts, including canonical resolved-slot binding positions, not direct worker-local state.

One Mission Walkthrough

Use this walkthrough when you need to debug or change one shipped happy-path mission without confusing runtime truth, diagnostics, and proof surfaces.

Step Reader question Current owner Source path Artifact or read model
1. Submit Where does mission truth start? Orchestrator mission API apps/orchestrator/src/omega_orchestrator/mission_api.py Mission submit artifact and initial mission state
2. Start loop Who runs the mission after HTTP intake returns? MissionRuntime apps/orchestrator/src/omega_orchestrator/services/mission_runtime.py Mission runtime context and failed-loop handling
3. Discover workers Which workers can be scheduled? WorkerA2AClient plus worker gate contracts apps/orchestrator/src/omega_orchestrator/clients/worker_a2a_client.py Worker discovery artifact and capability snapshots
4. Build planner input What does the planner see? MissionGraph and planner input builder apps/orchestrator/src/omega_orchestrator/graph.py Planner input artifact
5. Select executable graph What is executable mission truth? Planner service plus TaskNode contracts apps/orchestrator/src/omega_orchestrator/services/planner/, packages/contracts/src/omega_contracts/task_graph.py Selected task graph artifact and planning trace
6. Schedule ready work Why did this node run now? Scheduler helpers and MissionGraph apps/orchestrator/src/omega_orchestrator/services/scheduler.py Runtime task state and active worker projection
7. Resolve slots Who materializes upstream task outputs? Orchestrator resolver apps/orchestrator/src/omega_orchestrator/services/task_output_resolver.py Literal task slot values and resolved binding evidence
8. Dispatch to worker How does the boundary get crossed? WorkerA2AClient apps/orchestrator/src/omega_orchestrator/clients/worker_a2a_client.py Worker task id and observation target
9. Execute assigned task Who owns task execution? Worker public A2A edge and WorkerService apps/worker_agent/src/omega_worker_agent/execution/ WorkerTaskSnapshot and ordered WorkerExecutionReport reports
10. Use private MCP Where does downstream execution fit? Worker-owned MCP adapter and projector apps/worker_agent/src/omega_worker_agent/mcp/config.py, apps/worker_agent/src/omega_worker_agent/mcp/operation.py, apps/worker_agent/src/omega_worker_agent/mcp/operation_projector.py, external/lerobot_lab/deploy/lift2/omega_runtime/mcp_server.py, external/lerobot_lab/deploy/lift2/omega_runtime/mcp_runner_adapter.py, external/lerobot_lab/deploy/lift2/omega_runtime/mcp_lifecycle.py McpOperationSnapshot, mapped output, and WorkerExecutionReport reports
11. Read outcome What should operators read? MissionStorage and MissionReadService facade apps/orchestrator/src/omega_orchestrator/services/mission_storage/, apps/orchestrator/src/omega_orchestrator/services/mission_reads/ Mission state, timeline, reports, task graph, public planning view, operator read, resolved slot bindings

Validation Responsibilities

Behavior Source-owned validation responsibility
Mission submit starts the background runtime mission_api.py and MissionRuntime own background mission startup.
Planner input to typed runtime graph graph.py, planner service modules, and task_graph.py own planner input and graph contracts.
Generic task-output reference shape TaskOutputRef in task_graph.py owns the shared reference shape.
Dispatch-time TaskOutputRef materialization task_output_resolver.py and graph.py own dispatch-time materialization.
Resolved slot binding evidence ResolvedSlotBindingEvidence, TaskGraphArtifact, MissionStorage, and MissionReadService own read-side evidence positions.
Literal worker slot dispatch boundary WorkerA2AClient and worker execute-skill contracts own literal-slot dispatch.
Ready-set scheduling and retry state Scheduler helpers and MissionGraph own ready-set and retry semantics.
Atomic A2A dispatch WorkerA2AClient and worker public A2A route builders own the public dispatch boundary.
Worker lifecycle observation Task observation service and WorkerTaskSnapshot own lifecycle observation.
Worker-owned MCP operation projection Worker MCP operation/projector sources and LIFT2 mcp_lifecycle.py own private operation projection.
Persisted mission artifacts MissionStorage and mission artifact contracts own durable mission truth.
Northbound mission reads MissionReadService and mission read routes own northbound projections.
End-to-end task graph loop Orchestrator, worker, contracts, and deploy topology source own the complete loop.

Current Status

This page reflects the current Engineering Preview implementation. The orchestrator owns selected graph truth, runtime scheduling, dispatch-time TaskOutputRef resolution, mission artifacts, and operator-facing reads. Workers execute only assigned atomic TaskNodes with literal slot values, own the private MCP operation identity, and report lifecycle state back through the A2A boundary.

Source Of Truth

Concern Source-owned truth
Mission intake and northbound mission routes apps/orchestrator/src/omega_orchestrator/mission_api.py
Background mission loop apps/orchestrator/src/omega_orchestrator/services/mission_runtime.py
LangGraph mission flow apps/orchestrator/src/omega_orchestrator/graph.py
Ready-set scheduling and worker-report transitions apps/orchestrator/src/omega_orchestrator/services/scheduler.py
Mission artifact persistence apps/orchestrator/src/omega_orchestrator/services/mission_storage/
Northbound artifact reads apps/orchestrator/src/omega_orchestrator/services/mission_reads/ facade package, exported as omega_orchestrator.services.mission_reads.MissionReadService
Task graph and TaskOutputRef contract packages/contracts/src/omega_contracts/task_graph.py
Dispatch-time task-output resolution apps/orchestrator/src/omega_orchestrator/services/task_output_resolver.py
Resolved slot binding evidence packages/contracts/src/omega_contracts/mission_artifacts.py, apps/orchestrator/src/omega_orchestrator/services/mission_storage/service.py
Resolved-slot read positions packages/contracts/src/omega_contracts/operator_read_model.py
Orchestrator to worker A2A dispatch apps/orchestrator/src/omega_orchestrator/clients/worker_a2a_client.py
Worker public execution edge apps/worker_agent/src/omega_worker_agent/a2a/routes.py, apps/worker_agent/src/omega_worker_agent/execution/worker_service.py
Worker-private MCP operation projection apps/worker_agent/src/omega_worker_agent/mcp/operation.py, apps/worker_agent/src/omega_worker_agent/mcp/operation_projector.py, external/lerobot_lab/deploy/lift2/omega_runtime/mcp_lifecycle.py
Lifecycle validation responsibility Orchestrator, worker, contracts, and deploy topology sources

Out Of Scope

  • Worker-owned DAG mutation, worker-created global tasks, or worker reordering of dependencies.
  • Encoding wait states as TaskNodes.
  • Runtime-phase replanning after a graph is selected as executable mission truth.
  • Direct orchestrator calls into worker-local execution code or worker-private LIFT2 MCP servers.
  • Worker-side TaskOutputRef resolution or worker access to global mission state.
  • Moving resolved-slot authority into worker code or private MCP payloads.
  • Mission-level realtime transport, including resubscribe semantics, snapshot reconciliation, and operator-facing UX; those remain deferred scope.