--- title: "ADR 0082: Provider detection failures, terminal writes and secret scope" --- * Status: accepted * Code: [`pkg/reconciler/reconciler.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/reconciler/reconciler.go), [`pkg/reconciler/event.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/reconciler/event.go) ## Context When a PipelineRun finishes, the watcher rebuilds a provider client from the PipelineRun annotations, reports the final status, releases the concurrency slot and writes the terminal PAC state. Any failure in that chain can leave the repository queue blocked or the run reprocessed forever. ## Decision * `ErrProviderNotConfigured` marks a missing or unknown `git-provider` annotation as permanent. `reconcileKind` then calls `abandonDoneWithoutProvider`, which releases the queue and writes state `failed`, instead of returning an error that would be retried with rate limiting while the slot stays held. * Any other `detectProvider` error, such as a GitHub App client failing to initialise, is returned so the reconcile is retried. Swallowing it would forget the key, `reportFinalStatus` would never run and the slot would never be released. * The order is fixed in both paths: promote the queue (`startNextPipelineRunInQueue`), write the terminal state, then `ForgetAdmission`. The manager remembers a successful handoff until the terminal write succeeds, and an unfinished promotion must return an error before the terminal state makes `reconcileKind` short-circuit. * A failed final status post sets the final state to `failed` and the reconcile carries on. LLM analysis failures are logged and non-blocking. Follow-up evaluation and metrics errors are logged only; waiting follow-ups re-evaluate on their own ([ADR 0058]({{< relref "0058-followup-dependency-graph.md" >}})). * `initGitProviderClient` resolves secret inheritance on the local Repository spec first and merges the global Repository afterwards. Whether the git provider secret is inherited depends on the local spec; the merge still applies to every provider because a GitHub App token is scoped with the global settings too. `reportFinalStatus` and `finalizeKind` use the same merge. * For GitHub, `detectProvider` scopes the token to the triggering repository, like the event-time token, because the watcher hands it to created runs (follow-ups) through the git auth secret. It is set after the bootstrap token so `SetClient` can read the configured extra repositories before it replaces that token. * `detailURL` prefers the log URL annotation written when the run started, since it was rendered with the repository custom parameters that the unscoped console lacks. ## Consequences * A run with a broken provider annotation ends `failed` with no status on the provider. * Permanent versus transient is decided only by the sentinel error; a new permanent failure must wrap `ErrProviderNotConfigured`. * Provider-specific scoping lives in this switch; a new provider must be added to it.