--- title: "ADR 0085: Reconciling a done PipelineRun whose provider cannot be resolved" --- * Status: accepted * Code: [`pkg/reconciler/reconciler.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/reconciler/reconciler.go) (`reconcileKind`, `abandonDoneWithoutProvider`) ## Context A done PipelineRun is reconciled to report its final status and to free the repository's concurrency slot. Both depend on `detectProvider`, which can fail for two different reasons: the git-provider annotation is missing or names an unsupported provider (`ErrProviderNotConfigured`), or the provider client fails to initialise (for example the GitHub App private key secret is missing). Returning an error for the first loops forever holding the slot; swallowing the error for the second forgets the workqueue key so the slot is never released. ## Decision * A `ErrProviderNotConfigured` failure is treated as permanent. `abandonDoneWithoutProvider` releases the queue slot and promotes the next candidate with `startNextPipelineRunInQueue`, then writes `StateFailed`. No final status is posted because there is no provider. * Any other `detectProvider` failure is returned wrapped, so the reconcile is retried. * The queue release happens before the terminal state write. If the write fails the reconcile returns an error and is retried, but the handoff has already been made; the manager remembers it and `ForgetAdmission` is only called after the write succeeds. A retry must not release or promote a second successor. * A deleted Repository CR with a done run stops being reconciled once the run is in a terminal PAC state: dropping the repository clears its queue entries, so there is nothing to recover. A run that is not done keeps returning the error. ## Consequences * A run whose provider is unresolvable ends as failed without any message on the pull request. * The terminal state must stay the last step. Writing it first would make `reconcileKind` short-circuit on the retry and leave the handoff unfinished. * Tests: `TestReconcileKindReturnsErrorWhenDetectProviderFailsTransiently`, `TestReconcileKindAbandonsDoneRunWhenProviderNotConfigured`, `TestReconcileKindAbandonsDoneRunReleasesQueueEvenWhenStatePatchFails`, `TestReconcileKindDeletedRepositoryWithDoneRun`.