--- title: "ADR 0087: Starting an already running PipelineRun and finalizing with a gone successor" --- * Status: accepted * Code: [`pkg/reconciler/reconciler.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/reconciler/reconciler.go) (`updatePipelineRunToInProgress`), [`pkg/reconciler/finalizer.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/reconciler/finalizer.go) ## Context Promotion patches a PipelineRun's PAC state annotations. Tekton may already have started the run, so it is no longer pending before the patch and the patch only carries metadata, not a spec change. The finalizer takes the next key off the queue, which already moves it into the running set before the finalizer can validate it. ## Decision * For an already running run, a readback showing it is not pending proves nothing. A failed state patch is judged by the state and reporting annotations: if they are absent the write did not land and the reconcile is retried. * A PipelineRun Tekton reports as Running while its spec is cancelled or gracefully stopped, and whose start was never reported, can never be started. The promotion path treats `errPipelineRunGone` as nothing to do and returns nil. Graceful stop makes the Running condition last as long as the tasks drain, so requeueing would retry for that whole time over something no retry changes. * In `FinalizeKind`, a successor that no longer exists is dropped and the loop moves on; its slot was reserved when it left the queue, so an error would leave it held forever. A read failure that is not NotFound is returned and the finalizer retried. * A malformed successor key is skipped and its reservation released, and the loop continues to the next valid candidate. The guard is defensive: annotation parsing does not produce such keys today. ## Consequences * A cancelled-but-Running run silently drops out of promotion. * The finalizer test expectations for the gone and malformed cases must not be turned into error expectations. * Related: [ADR 0058]({{< relref "0058-followup-dependency-graph.md" >}}) for follow-ups started through the same path.