Skip to main content

Job execution flow

A Loom job is the unit of runnable work inside pipeline.execute. Its runtime phases record provider setup, script execution, cleanup, and any configured cache or artifact work.

Use this page when you need to understand:

  • What happens before user script execution
  • Which optional phases can appear around that execution
  • What still runs after a failure

Job phase order

The normalized phase codes above are what you will see in events.jsonl and phase-report.json.

Which phases are always present

PhaseWhy it is always useful
job.provider_prepareAnchors provider setup and pre-execution system work
job.executionAnchors user execution as one job-level envelope
job.cleanupRecords cleanup, even when the job never ran

Which phases are optional

PhaseWhen it appears
job.cache_restoreCache restore work happened before execution
job.cache_saveCache save work happened after execution
job.artifact_restoreThe v2 compatibility identity for artifact_extract publication after cleanup

Optional phases are emitted when Loom performs the corresponding work.

How section names map to phase codes

Some directory names still reflect implementation-specific section labels. The runtime normalizes them into stable phase codes:

Section directoryPhase code you should reason about
system/providerjob.provider_prepare
system/servicesjob.provider_prepare
system/image_buildjob.provider_prepare
system/cache_restorejob.cache_restore
system/cache_savejob.cache_save
system/artifact_extractjob.artifact_restore
system/cleanupjob.cleanup

Use the phase code as the stable mental model. Use the section name to find the file on disk.

Artifact publication

Loom publishes declared output files after cleanup. To preserve existing log paths, the system section is named artifact_extract; runtime-logs v2 uses the phase code job.artifact_restore. The mapping table above lists both names.

Read the receipt's ArtifactPublication outcome and the section metrics to check whether publication succeeded or was skipped. For failures, the section output records the failed operation, affected path, and error.

What job.execution contains

job.execution is the user execution envelope for the whole job. Inside it, each script: line becomes a step-scoped execution.script phase.

That means you get:

  • A job-level execution boundary
  • A mirrored execution event stream at jobs/<job_id>/user/execution/events.jsonl
  • One per-step event stream at jobs/<job_id>/user/execution/script/<NN>/events.jsonl

Failure behavior

The current behavior to rely on:

  • Steps run sequentially
  • The first failing step ends user execution
  • Later script steps do not run
  • Post-execution phases such as cache save may still emit if Loom performs that work
  • Secret cleanup runs before artifact publication
  • A configured artifact section may still publish failure outputs after cleanup

Skip behavior

Loom records skipped work in summaries and phase events:

SituationWhat you see
A cache or artifact phase is intentionally skippedSection summary and manifest entry show status: "skipped" plus skip_reason
A downstream job never runsThe job still emits a skipped job.cleanup finish rather than disappearing
A later step never starts because an earlier step failedThe started step fails; later steps do not emit runtime output

Best artifacts for job-level debugging

ArtifactBest use
jobs/<job_id>/summary.jsonConfirm job outcome quickly
jobs/<job_id>/manifest.jsonBranch to the failing step or failing system section
jobs/<job_id>/user/execution/events.jsonlRead the whole user execution envelope
jobs/<job_id>/user/execution/script/<NN>/events.jsonlRead one failing step
jobs/<job_id>/system/<section>/summary.jsonInspect structured skip and metrics data
jobs/<job_id>/system/<section>/events.jsonlInspect provider, cache, artifact, or cleanup output

Current behavior to rely on

  • A job must become eligible before any job phase can start.
  • job.provider_prepare finishes before later job phases begin.
  • job.execution encloses the step loop.
  • Cache restore happens before execution.
  • Artifact publication happens after job.cleanup, under the compatibility names listed above.

If you need the larger schedule around those jobs, continue to Pipeline execution flow.