Skip to content

Upgrade and uninstall

What to do, in which order, when you move Shadewright to a new release or remove it. The steps are written for the manifests of a release (config/default, applied with kubectl apply -k, see getting started); the commands for the Helm chart are in Upgrade with Helm and Uninstall with Helm. The Helm chart installs the same objects, except the helper roles (off by default) and the Namespace, and the order below applies to helm upgrade and helm uninstall too. Note that helm uninstall keeps the CRDs by default (crd.keep), and that with crd.keep=false it removes the executor and the CRDs together, so do steps 1 to 3 of the uninstall first. Helm creates the RemediationSettings object default only when it does not exist and never changes or deletes it afterwards.

The one thing to know first: a RemediationRequest that has opened a pull request carries a finalizer, and only the executor can remove it. Delete the executor, the namespace or the CRDs before the requests and they stay Terminating with nobody to clean up.

What the finalizer does

The executor adds the finalizer remediation.shadewright.io/close-pull-request to a request just before its first Git write, so no branch or pull request exists without it. It is the only finalizer Shadewright uses, and deleting a request never touches the cluster or rolls back a deployment.

When a request is deleted, the executor:

  • closes its pull request if the request is before merge (PolicyChecked, PRCreated, AwaitingApproval, AutoMergeQueued), stopped in NeedsIntervention or Expired, or holds the lock on its target (status.holdsTarget) in any phase, then removes the finalizer, which also releases that lock. Its recorded pull request is closed also when a person moved it to another base branch (#892). It also closes every other open pull request of the request's branch that carries the marker, whatever its number and whatever base it is open on. A pull request is closed only if it carries the request's marker; one without it is left alone. The branch shadewright/<request UID> is left in place. The lock goes with the finalizer even when a pull request without the marker is still open on the branch: the rule that keeps the lock while an open pull request may deliver the change does not cover deletion, so close such a pull request yourself if its change should not land;
  • leaves a merged pull request alone (the close is refused with a conflict and the deletion goes on);
  • closes them through the target branch the request recorded when the settings now name another one;
  • does not wait when the repository left the settings: nothing can be closed then, and a Warning Event PullRequestLeftOpen names the pull request that may still be open. An entry that cannot be used or a missing RemediationSettings object is a failure of the cleanup instead (CleanupFailing with reason RepositoryUnusable or SettingsNotFound), tried again until the 24 hour bound below, since the pull request may be open and the entry or the object may come back. It waits only about two minutes when the pull request is already gone: the Git host must answer 404 and the listing of the branch must not show it either on two looks of the same executor process at least two minutes apart (the process keeps the first in memory, so a restart of the executor starts the wait again), so deleting such a request takes at least two minutes. A recorded pull request that a person left open but removed the request's marker from does not hold the deletion: it is left open. When the recorded number is gone but the branch lists another pull request with the request's marker (condition PullRequestUnreadable with reason RecordedMissingOtherListed), it does not wait: it closes each such pull request that is open and goes;
  • waits while spec.paused of RemediationSettings is true, however long, because closing is a write (see the emergency stop);
  • gives up on a refusal that lasts 15 minutes when the Git host refuses a step of the cleanup for good (403 GitForbidden or 422 GitRejected): the access token for the repository, the read of the pull request, the listing of the branch or the close. Only a 403 or 422 answer to one of these calls counts, for example from an App whose permissions no longer let it close pull requests. An App that was uninstalled or whose installation no longer includes the repository fails differently (a token mint answered 422 or 404, or 404s on the reads) and falls under the 24 hour bound below. The first refusal sets condition CleanupRefused, which says which step and names the recorded pull request, with a Warning Event of the same name; the cleanup is tried again every minute, and a cleanup that goes through removes CleanupRefused and CleanupFailing. The finalizer is released by the first attempt that is refused 15 minutes or more after the first refusal; an attempt after the 15 minutes that fails another way (a signer error, a 5xx) releases nothing, and the finalizer stays until the next refused attempt or the 24 hour bound below. The release comes with a Warning Event PullRequestLeftOpen and a log line that give the pull request's number and URL: left open when the close was refused, of unknown state and maybe open when an earlier step was. The Event outlives the request for the API server's Event time to live (one hour by default): look for it with kubectl -n shadewright-system get events --field-selector reason=PullRequestLeftOpen, then check that pull request and close it by hand;
  • gives up after 24 hours on any other error, for example a 404 the listing of the branch does not confirm, an answer about another pull request, a server error, a timeout, a token mint the Git host answers with 422 (a repository removed from the App's installation) or 404 (the App uninstalled), or a Key Vault key it cannot sign the App's token with, or a settings entry of the repository that cannot be used (reason RepositoryUnusable). The first failure sets condition CleanupFailing, which names the step and the recorded pull request, with a Warning Event of the same name; the cleanup is retried meanwhile, and a cleanup that goes through removes the condition and lets the request go as usual. 24 hours after the first failure the executor removes the finalizer, with a Warning Event PullRequestLeftOpen and a log line saying that the cleanup could not be finished, that the state of the pull request is not known and that it may be open. Check that pull request and close it by hand.

A request that never reached the Git step has no finalizer and is simply deleted.

Deleting a request and Cancelled

Deleting a request before merge closes its pull request and removes the object, as the list above says. To cancel a request and keep it as the record of what was cancelled and when, set spec.cancel instead (#289):

kubectl -n shadewright-system patch remediationrequest <name> --type merge -p '{"spec":{"cancel":true}}'

The executor closes the request's pull request, if one is open, leaves its branch, and ends the request Cancelled with reason CancelRequested and an Event Cancelled. The API accepts the field only before the merge (no phase, Pending, PolicyChecked, PRCreated, AwaitingApproval, AutoMergeQueued), and never takes it back: it can be set, never unset. A request that is merged, or reaches another final phase, before the executor acts on it keeps that phase. With reviewer hints on, the check shadewright/review is failed before the close, so a pull request reopened later cannot be merged on it. If the close cannot be made (the Git host refuses it, the repository left the settings, a read keeps failing), the request does not end: it keeps its phase, condition CancelPending and a Warning Event say why, and the executor watches the pull request, so a merge still ends the request Merged. Close the pull request by hand, and the request ends Cancelled. Setting it needs patch on remediationrequests, which the remediationrequest-editor-role grants. The executor also ends a request Cancelled by itself, before its pull request opens, when the Incident it names was folded into its cause's Incident or is gone (IncidentFolded, IncidentGone, #794): no pull request is opened, the branch is left, and the target stays locked until the next read of the branch finds no open pull request that may deliver the change, so deleting an Incident ends the fix of its waiting request.

Cancelled and Superseded differ: Superseded is set by the executor when the plan went stale (policy, settings or target changed) and the pull request was closed; see troubleshooting.

Release publication

Published GitHub releases are immutable: assets must be attached before publication. Merging the release-please pull request updates the changelog and creates the version tag and a draft release (draft: true, force-tag-creation: true). Never create a stable vX.Y.Z tag by hand.

For a pre-release, tag the intended commit on main, push the tag, then immediately create the draft:

git tag vX.Y.Z-rc.1 <commit-on-main>
git push origin vX.Y.Z-rc.1
gh release create vX.Y.Z-rc.1 --verify-tag --draft --prerelease

Images, Chart, Release plugin and Trivy start on the v* tag push, including for drafts. Nothing depends on a release: published event. The plugin workflow waits up to five minutes for the draft, then uploads four archives, checksums.txt and checksums.txt.sigstore.json after signature and provenance checks. Chart verifies the image digests, tests and publishes the chart, then appends digests and verification commands to the release body. Its final job waits up to 30 minutes for all six nonempty, uploaded plugin assets and requires the exact verification section for the image and chart digests that it published. Only then does it run gh release edit --draft=false, preserving the pre-release flag.

If a prerequisite fails or the wait expires, the job fails and leaves the release a draft. Fix and rerun the failed tag workflow, then rerun Chart's Publish the complete release job. Do not publish manually to bypass the gate or disable immutable releases. Release body edits remain possible after publication; asset uploads do not. Re-running the final job on a complete published release makes no change.

Verify a release

Images built from main or a v* tag after #82 are signed keyless with cosign (the certificate comes from GitHub's OIDC token, there is no key to trust), carry an SPDX SBOM per platform image (linux/amd64 and linux/arm64) as a signed attestation, and have a GitHub build provenance attestation. v0.1.0 images are not signed. Verify by digest, never by tag, and use the digest you will deploy. You need Docker (for buildx imagetools), jq, cosign 3.x or later (the signatures are stored as Sigstore bundles, which cosign 2.x does not find) and the GitHub CLI.

IMAGE=ghcr.io/pkalin/shadewright-executor   # and shadewright-analyzer, shadewright-verifier
DIGEST=sha256:<digest from the release page>
IDENTITY='^https://github\.com/pkalin/shadewright/\.github/workflows/images\.yml@refs/(heads/main|tags/v[0-9].*)$'
ISSUER=https://token.actions.githubusercontent.com

# Signature: made by the images workflow of this repository.
cosign verify \
  --certificate-identity-regexp "$IDENTITY" \
  --certificate-oidc-issuer "$ISSUER" \
  "$IMAGE@$DIGEST"

# SBOM (SPDX JSON) attestations: one per platform image, on the digest of each child of the index,
# with the same identity; the predicate is the SBOM.
for ARCH in amd64 arm64; do
  CHILD=$(docker buildx imagetools inspect --raw "$IMAGE@$DIGEST" | jq -r --arg a "$ARCH" \
    '.manifests[] | select(.platform.os == "linux" and .platform.architecture == $a) | .digest')
  cosign verify-attestation --type spdxjson \
    --certificate-identity-regexp "$IDENTITY" \
    --certificate-oidc-issuer "$ISSUER" \
    "$IMAGE@$CHILD" | jq -r '.payload | @base64d | fromjson | .predicate' > "sbom-$ARCH.spdx.json"
done

# Build provenance: built by this repository's images workflow.
gh attestation verify "oci://$IMAGE@$DIGEST" \
  --repo pkalin/shadewright \
  --signer-workflow pkalin/shadewright/.github/workflows/images.yml

# The chart: signature and provenance, by the chart workflow on a release tag.
CHART=ghcr.io/pkalin/charts/shadewright@sha256:<chart digest from the release page>
cosign verify \
  --certificate-identity-regexp '^https://github\.com/pkalin/shadewright/\.github/workflows/chart\.yml@refs/tags/v[0-9].*$' \
  --certificate-oidc-issuer "$ISSUER" \
  "$CHART"
gh attestation verify "oci://$CHART" \
  --repo pkalin/shadewright \
  --signer-workflow pkalin/shadewright/.github/workflows/chart.yml

Releases after v0.1.0 list the digests of its images and its chart, with these commands filled in for that tag (the identity pinned to it), once the images and the chart are published. A pre-release tag such as v0.2.0-rc.1 is built, signed and verified the same way: the identity regexp above accepts it, it is tagged 0.2.0-rc.1 only (no latest, no X.Y), and its chart has that version and appVersion.

Each command exits non-zero when the signature, the identity or the issuer does not match. To pin a single release instead of any main or tag build, replace the end of IDENTITY with refs/tags/vX.Y.Z$. Each SBOM lists the packages of one platform image; the signature and the provenance are on the index digest, the SBOMs on the child digests (images from before #341 have a single SBOM on the index digest, made from the linux/amd64 image). The same checks run in the images workflow right after every push, so a build that cannot be verified fails there.

Upgrade

All three Deployments run one replica by default (the Helm chart can add standbys, see the configuration reference) with leader election and have no state of their own: Incidents, requests, the settings and the budget live in the cluster API. Every step of the executor rebuilds what it knows from Git and the API, and branch names and pull request markers derive from the request UID and the plan digest, so a restart in the middle of a step finds the work already done instead of repeating it.

  1. Read the release notes (CHANGELOG and the GitHub release). While the version is 0.x a minor release may carry breaking changes (a commit with ! or a BREAKING CHANGE: footer): API fields, CRD schema, flags or what the manifests install. The API is v1alpha1 and there is no conversion between versions.
  2. Check that the cluster runs Kubernetes 1.32 or later. From the first release after v0.2.0 the executor lists requests with field selectors on the RemediationRequest CRD's selectable fields (#293), generally available from Kubernetes 1.32, which the chart requires. Until the new CRD is established, and on an API server without CRD field selectors, those lists fail and the executor lets no request through the policy check (fail closed): new ones stay Pending and waiting ones keep their Queued condition, since each check of the limits fails too; requests already past the policy check do not check the limits again and go on.
  3. From v0.1.0: move maxAnalysesPerDay. v0.1.0 had the daily analysis limit at spec.maxAnalysesPerDay; it is now spec.analysis.maxAnalysesPerDay. Before upgrading, read the old value (kubectl get remediationsettings default -o jsonpath='{.spec.maxAnalysesPerDay}{"\n"}'; empty means it was never set and nothing needs to move). Right after step 6 applies the new CRDs (the old schema would drop the new field), set the new field to the value you read and remove the old one in one patch, for example for 0: kubectl patch remediationsettings default --type merge -p '{"spec":{"maxAnalysesPerDay":null,"analysis":{"maxAnalysesPerDay":0}}}'. Change the same in the manifests you keep in Git: a manifest that still sets the old field is refused by the API server, by kubectl and by Flux alike. If you skip this step, a value stored in the old field stays and the analysis trigger goes by the lower of the two fields (the new one defaults to 100), so a stored 0 still keeps analysis off; only a write that sets or changes the old field is refused.
  4. Pause writes (optional): set spec.paused: true on the RemediationSettings object if you want no pull request opened or closed while the pods restart. Analysis goes on. Unpause afterwards.
  5. Use the same release for all images. Analyzer, executor and verifier share the CRDs and the API types, and only a pair built from one tag has been tested together. Replace every digest in your overlay (the release page lists them; verify them first) and keep the ?ref= of the base on the same tag.
  6. Apply: kubectl apply -k . applies the CRDs and the Deployments together. Wait for the CRDs (kubectl wait --for=condition=Established crd/..., as in getting started) and then for kubectl -n shadewright-system rollout status deploy/shadewright-analyzer deploy/shadewright-executor. Only the pod holding the Lease (shadewright-executor-leader-election, shadewright-analyzer-leader-election) works, so a new pod does nothing until it has the Lease, which can take a short while after the old pod is gone.
  7. Check with kubectl shadewright doctor of the new release (it exits 1 when a check fails), the settings status (DetectionFailed is False), the Deployments' logs for errors, and that the waiting requests still show their phase.
  8. Unpause if you paused.

What happens to requests that are waiting for a person when you upgrade:

  • A request in PRCreated or AwaitingApproval keeps its pull request. The executor rechecks it every five minutes and looks at its pull request every --pull-request-poll-interval (one minute by default) in between.
  • A release that changes how the plan digest is computed or what the freshness check compares would end such a request as Superseded (PlanChanged) and close its pull request. This follows from the freshness check, not from a promise of a release, so read the notes of every upgrade.
  • A change to the settings or the policy in the same step has the same effect, whatever the release, and one that removes the repository or changes its URL closes nothing, while a new installation for the same URL closes the waiting pull requests through it after checking their marker (#290): see freshness and identity rotation.
  • The release that closes #294 records the lock on a target in status.holdsTarget. A request written before has no such field: the executor sets it once from the request's status, keeping the lock for a request that the executor still moves on, that is being deleted with its finalizer, or that stopped with a recorded pull request its status does not show closed or merged (see limits). Such a stopped request then looks its pull request up every 10 minutes and frees the target once it is closed or merged. A request that ended without a plan digest (a refusal) gets false, so the limits stop reading it.
  • The release that closes #390 records in status.breakerCounts whether the circuit breaker may still need a request's outcome. Apply its CRDs before the executor: the breaker lists with that selectable field, and until the CRD has it the lists fail and nothing goes through. A request that ended before has no such field and is read (fail closed): the executor sets it once from the request's status (true for a success, a failure or a probe, false for any other end), and the checks of the limits after that clear, up to 100 at a time, the outcomes that ended before the latest request in Succeeded (recorded in status.breakerClearedBy; see limits).
  • The release that closes #482 lowers the render check's build budget from 16 MiB to 4 MiB of input (counted with repetition) and its object limit from 4,096 to 1,024 (a build over the budget). A waiting pull request whose build is over the new limits is not rechecked against them at once: the executor renders a waiting change again only when the head of the target branch has moved since its last render. At the first recheck after the target branch moves it refuses with TooLarge, closes the pull request and ends the request in NeedsIntervention. Until then the pull request stays open and a person can still merge it; to end it earlier, close it. New requests on such a build end NeedsIntervention (TooLarge) at the policy check.
  • The release that closes #488 also limits the YAML documents a build reads before the render to 4,096, counted with repetition (a List counts 1 plus its items), and refuses a file of the build that is not UTF-8 or uses YAML anchors, aliases or merge keys (InvalidYAML, see troubleshooting), and a patch with a JSON patch copy operation (UnsupportedKustomization). A waiting pull request over these limits is treated as above.
  • The release that closes #542 changes the one comment the executor posts when someone pushes to a waiting pull request (BranchDiverged), whether or not reviewer hints are on. Before it looks for the comment's marker it reads the App's ID once (GET /app under the App's JWT, so one more Key Vault signature per provider, design 9.2); if that read fails, no comment is posted. Only the marker as a whole line of a comment the App's own bot user posted counts as the comment being there already, so a marker a person pasted no longer suppresses it. On a pull request with more than 1,000 comments it posts nothing, and a post that fails is not repeated. The request stops in NeedsIntervention either way, and its message says when commenting failed.
  • The release that closes #495 also bounds what patches with a target and transformers (labels, annotations, namespace, name prefix and suffix, images, replicas) can add to the render: at most 4 MiB, the bytes of each value and 128 for each of its YAML nodes, times an upper bound of the places it reaches, counted with repetition (a build over the budget). A build over it ends NeedsIntervention (TooLarge) at the policy check, and a waiting pull request over it is treated as above.
  • The release that closes #626 also counts strategic merge patches without a target in that budget, as a patch with a target that selects one object, and limits what strategic merge patches merge into one mapping or list of one object to 4,096 keys or list items, counted per path over every patch that may reach the object (a build over the budget). A build over either ends NeedsIntervention (TooLarge) at the policy check, and a waiting pull request over them is treated as above.
  • v0.5.0 (the release that closes #614) runs the render check in a child process of the executor with limits of its own (ADR-0035). The chart's default executor.resources.limits.memory goes from 256Mi to 640Mi, and the executor's default GOMEMLIMIT from 90 to 36 percent of it, the same 241591910 bytes as before. The chart now refuses to render an executor memory limit below its GOMEMLIMIT plus 192 MiB plus 128 MiB: a values file that sets 256Mi, or an executor.goMemLimit that leaves less room, fails helm upgrade with a message that says so. A limit written as an exponent (1e9) or in milli is not checked and needs executor.goMemLimit. The manifests in config/manager set 640Mi and the same GOMEMLIMIT bytes. Builds whose render needs more than 128 MiB of Go memory or 20 s of CPU time, which passed before, are refused with TooLarge (a build over the budget); a waiting pull request over them is treated as above, at its next render.
  • The release that closes #714 marks a request in status.unfinishedRenders before each render check and removes the mark when the check returns (ADR-0035). Apply its CRDs before the executor: with a CustomResourceDefinition that does not know the field the API server drops the mark, the executor starts no render check and retries, so requests wait until the CRDs are applied; since #866 it also records the Warning Event CustomResourceDefinitionOutdated on the request. Two refusals are new for a waiting pull request: RenderNeverFinished after three render checks in a row that ended the executor process (NeedsIntervention, the pull request is closed), and PlanIncomplete for a request whose status has no planDigest. See troubleshooting.
  • The release that closes #895 records a restart of the executor, or a change of leader, during Verifying as a reset of the executor's window with the new reason ExecutorRestarted in status.verification.lastReset (troubleshooting). Apply its CRDs before the executor: the CustomResourceDefinition of v0.5.2 does not list that reason, so the API server refuses the status write that carries it (422 Invalid). The executor then records the Warning Event CustomResourceDefinitionOutdated on the request and retries with the error backoff, and the request stays in Verifying until the CRDs are applied (troubleshooting). A request whose timeout passes in that time ends at the first check after the CRDs are applied.
  • The release that closes #794 reads the Incident a request names live from the API server as the last step before its pull request opens (ADR-0039 points 21 and 22). A request waiting across the upgrade without a pull request (Pending behind a limit or a lock, or PolicyChecked) whose Incident was folded into its cause's Incident, or deleted, while it waited now ends Cancelled (IncidentFolded, IncidentGone) and opens no pull request; it leaves its branch, and its target stays locked until the next read of the branch finds no open pull request that may deliver the change; a pull request of its own that this read finds open is closed first. A request that already has a pull request runs its course. A read of the Incident that fails holds the request until it answers or the request's deadline ends it Expired.
  • The release that closes #793 folds a consequence Incident (a kubelet BackOff or Unhealthy) into its cause's Incident when the cause's Incident is created at most 15 minutes after it, on the same container, and none of its requests has a pull request (ADR-0039 point 14): it ends Resolved with Lifecycle FoldedIntoCause, status.foldedInto and status.folded, and is never folded a second time, and an analysis of it in flight publishes nothing. Its CRD adds rules on status.foldedInto: only in phase Resolved; once set, only cleared, and only together with a move out of Resolved; the status cannot be removed while it is set; it cannot name the Incident itself. It also adds status.folded, which never changes from true to false and keeps the status from being removed while it is true. No Incident stored before holds either field, so every stored object stays valid. The executor does not cancel a folded Incident's request yet: one without a pull request at the fold goes on, and its outcome no longer moves the folded Incident.
  • The release that closes #996 changes what an analyzer restart, or a change of leader, does with old events (ADR-0039, amendment of 2026-11-21). A Warning event the restarted collector lists at start, unchanged since, about a pod that is gone, whose last occurrence is more than 5 minutes before the start, no longer opens an Incident: it is counted on an Incident that already exists, or dropped. A more recent one is handled as before and can still open one. An event occurrence an Incident already counts stays on that Incident when its subject falls back from the workload to the pod. What an operator sees: fewer Incidents of deleted pods after a restart or an upgrade of the analyzer, the new counter shadewright_analyzer_stale_on_start_folded_total, and the new reason stale_on_start in shadewright_incident_batches_dropped_total (metrics). An outage of the analyzer longer than 5 minutes, during which a pod was deleted, folds or drops that pod's occurrences from the outage; the drops show under that reason. No CRD change.
  • The release that closes #828 also holds a BackOff or Unhealthy event whose pod status shows a cause the Incident controller has not seen yet, until the controller has an Incident of that cause for the event's workload, not Resolved more than 24 hours before (a cause it holds only as a first sighting does not end the hold), and tells the collector, at most the same 2 minutes (ADR-0039 point 7). What an operator sees: such an event reaches the Incident controller later than before, by the time the controller takes to see the cause (usually none to speak of when the cause opens its Incident at once, as an OOM kill does, since the collector reports the cause from the same pod status; usually the whole 2 minutes for a cause the gate holds until it is seen again, such as a missing Secret), and at most 2 minutes later; its count on the cause's Incident (status.absorbed) moves by as much. An event whose cause the controller had already seen is not held. For a cause the gate holds as a first sighting the event leaves at the end of the 2 minutes, or when its pod is replaced, with that cause (cause_unseen): when its series already recurs it can open an Incident of its own, which is analyzed, and is folded into the cause's Incident if that opens within 15 minutes (#849 is the open follow-up). A release belongs to the cause it was given for: when its delivery is retried and the pod shows another cause by then, only the occurrences released under the first cause leave with it, and the later ones are held again for the new one. The event is emitted with the last cause its pod showed, also when the pod is replaced or a rollout retires its template during the hold, and when the container recovers and the controller then sees the cause; a container that recovered and whose cause the controller has not seen by the end of the 2 minutes is not emitted, counted not_opened as a consequence with no cause is; only an event deleted during the hold is lost, counted dropped. In shadewright_analyzer_held_consequences_total (metrics) the outcome released changes its meaning: before, a cause appeared on the pod of a held consequence with no cause; now, the Incident controller saw, during the hold, a cause the held consequence would be counted on. The new outcome cause_unseen counts holds that ended with a cause the controller had not seen. The bound of 1,024 holds (256 per namespace) now applies to the holds with a cause and to those with none apart, so the analyzer may hold up to twice as many, and shadewright_analyzer_consequences_held can reach 2,048. A dashboard or alert that sums the outcomes needs no change; one that reads released alone counts something else now.
  • The release that closes #792 holds a BackOff or Unhealthy event whose pod status shows no cause for 2 minutes before it goes to the gate (ADR-0039 point 19). An Incident of such a consequence opens at least 2 minutes later than before, or not at all: a container that recovered during the wait (fine at the end after at most one restart), or failed at only one sample, opens nothing, and its pod gone or replaced during the wait opens nothing either. Over 1,024 held (256 per namespace) a consequence goes to the gate at once, as before.
  • The release that closes #789 changes the fingerprint of every observation read from pod status (container terminations, and the new waiting causes such as ImagePullBackOff) once: the source of the observation is now hashed (ADR-0039 point 2). The fingerprints of events and of module symptoms do not change. An Incident opened under the old fingerprint of a termination is not found by the new one: it resolves by the existing rules (quiet after an hour without a new occurrence, or the closure rules), and a Resolved one no longer counts for the 24 hour recurrence rule of the new one. A fault still present at the upgrade opens one new Incident under the new fingerprint, so expect one extra Incident and one extra analysis per ongoing fault, and mind maxAnalysesPerDay. Apply its CRDs before the new analyzer: it records waits in status.occurrences with IDs starting waiting:, which the occurrence ID pattern of the older CustomResourceDefinition refuses, so every status write of an Incident that carries a wait is refused until the CRDs are applied.
  • The release that closes #814 makes apiVersion of a model deployment optional for provider: Anthropic (a CEL rule lets only provider Anthropic leave it out). A settings object stored before stays valid, with or without the value on an Anthropic deployment, and you can drop it there at any later edit: it is not sent. Apply the CRDs before you remove it, since the old schema requires it. The analyzer now starts with --triage-model and without --model-endpoint-suffixes when --anthropic-api-key-file is set, reads no workload identity then, and refuses every Foundry deployment (ProviderNotConfigured). The chart no longer reads settings.spec. It requires analyzer.identity.azure.clientId exactly when analyzer.analysis.endpointSuffixes or a record store is set, and with a triage model at least one of endpointSuffixes and the Anthropic API key. On an upgrade the settings object is not changed, so the values can say Anthropic while it still names a Foundry deployment: the render passes and the analyzer refuses that deployment (ProviderNotConfigured), which the Incident shows.
  • The release that closes #771 records every wait on a failed read of the Git host in status.gitWaits, one entry per kind (Paced, RequestDeadline, HandoffGrace, HandoffRecovery, MergeCheck, MergeContent; six kinds, HandoffRecovery added by the release that closes #786, see below), each with its start and, but for Paced, its end (ADR-0030, entries of 2026-11-18; design 6.6.1). Apply its CRDs before the executor. The new schema holds the rules the executor writes by: the kind is one of those six, a bounded kind records ends and a Paced one has none, MergeCheck and MergeContent name their pull request and no other kind does, and an entry keeps its start, its end and its pull request while it stands. The old schema does not list gitWaits, so the API server prunes it from the executor's writes: no entry is stored, and a merge wait has no recorded end to reach. Until the CRDs are applied no wait can be stored, so a merge seen without its commit is never recorded. The writes themselves succeed, and before #866 nothing reported it: the five minutes started again at every reconcile. Since #866 the executor compares the answer to each status write with what it sent: when status.gitWaits (or status.unfinishedRenders, or status.pullRequest.incidentStopped) is missing from it, the reconcile fails with an error that says the installed CustomResourceDefinition of RemediationRequest is older than the executor, a Warning Event with reason CustomResourceDefinitionOutdated is recorded on the request, and nothing else is done for that request until the CRDs are applied (troubleshooting). What a request that waits across the upgrade does, once the CRDs are applied:
    • A merge seen without its commit under the old executor has status.mergeCommitAwaitedSince and no MergeCheck entry. That field is not an end any more and is not changed. The first look of the new executor that finds the pull request still merged without a full merge commit records the entry, with ends five minutes after its own start, so the five minutes begin again then, not at mergeCommitAwaitedSince. A merge commit reported before that records the merge with its receipt at once. Past the end the executor reads once more (not during a pause) and records the merge without a receipt, with the plan marked not shown fresh, when that read fails.
    • A request in PolicyChecked past its status.deadline ends Expired (PullRequestDeadline) at its first reconcile that is not under a pause, reading nothing from the Git host, as before. The cleanup of a pull request it may have opened comes after it: a failed close sets CleanupFailing, and 24 hours after that condition's lastTransitionTime one more close is tried, and PullRequestDeadlineCleanupFailed ends it if that fails too.
    • A handoff recovery is bounded as before, by the grace of 15 minutes after status.deadline, which is read from the status and needs no entry; a failed read of the branch within it now shows as an entry of kind HandoffGrace and condition GitReadRetry, and past the grace the request ends NeedsIntervention with HandoffRecoveryFailed.
    • A stopped request that holds its target lock (status.holdsTarget) keeps it until one look settles it. Every 10 minutes the executor lists its marked pull requests on the recorded branch and on the one the settings name now, and frees the lock when none can still merge; TargetHeld names one that can, also the request's own pull request open on a third base a person moved it to (#892). A merge the status already records frees it from the status alone. A request stopped with TargetBranchChanged by the old executor is read on both branches too, so a pull request a person moved to the new branch and merged is recorded even days later (Merged, then Inconclusive with StalePlanMerged). A failed read keeps the lock and shows a Paced entry. A repository that left the settings keeps it, with PullRequestUnreadable (RepositoryUnavailable), and so does a missing RemediationSettings object (SettingsNotFound).
  • The release that closes #771 adds these ends and reasons an operator can meet, each with its row in troubleshooting: MergedWithForeignChange for a pull request a person moved to the new target branch and merged when the merge brought more than the planned change, and MergeContentUnreadable when what it brought could not be read for five minutes (the MergeContent entry); MergeNotCheckable when the target file it is compared against cannot be parsed. All three end NeedsIntervention with no merge receipt, no verification, no circuit breaker outcome and no revert proposal, and keep the target lock until a look finds no other open pull request that may deliver the change. PullRequestDeadlineCleanupFailed ends an Expired request whose cleanup kept failing, as above. SettingsNotFound also appears as the reason of condition PullRequestUnreadable on a stopped holder: nothing is released and no wait ends until the object exists again. A merge into the new target branch that carries the planned change alone ends Inconclusive with StalePlanMerged, counted for neither side of the circuit breaker.
  • Since this release a pause (spec.paused, see pause and resume) holds three things it did not before: the new reads of the cancel watch after a change of the target branch and of the look of a stopped holder on two branches; the new waits, MergeContent and the 24 hour cutoff of the cleanup after Expired, which end only after one more read made once the pause is lifted; and the target lock of a merge that did not deliver the plan as shown (MergedWithForeignChange, MergeContentUnreadable, MergeNotCheckable), which was freed from status before and now waits for a read of the branch after the lift. The MergeCheck wait holds as it did. While writes are paused no request can open a pull request, so nothing waits for such a target meanwhile.
  • The release that closes #808 (merged with it) sets condition GitReadRetry (reason GitReadFailed, a Paced entry of status.gitWaits, operation close the change request) on a StalePlanMerged request with no pull request recorded when the close of its stale plan fails to read the Git host. It changes nothing else, and it needs the CRDs of the note above.
  • v0.6.0 (the release that closes #786) changes how the recovery of a handoff ends when it cannot read. Before, per case:

    • a refused read of the branch (403 or 422) ended the replacement at once, NeedsIntervention with the refusal's reason (GitForbidden or GitRejected);
    • a repository that left the settings, an entry that names another target branch, or an entry that cannot be used ended it at once with RepositoryUnavailable, TargetBranchChanged or RepositoryUnusable;
    • only a refused read of a pull request was retried, and ended it HandoffRecoveryFailed 15 minutes after its deadline;
    • a failure of the Kubernetes API that lasted past those 15 minutes ended it HandoffRecoveryFailed too, with a message that blamed the branch.

    Now the first refusal of a read of the recovery (a 403 or 422 on the branch or a pull request) and the first of those three reasons about the repository abort the handoff at once (decision of 2026-11-18): the request it replaces has its intent Aborted (its hint Declined with HandoffAborted and a reply) before it writes anything again, so its freshness check, merge gate and deletion work again at once; when the branch carries the replacement's commit it stops NeedsIntervention with BranchDiverged and one comment that hands the pull request to a person (or, when its plan is stale, fails shadewright/review, closes the pull request as stale and ends Superseded, as any stale plan does), and otherwise it goes on as if no replacement had come. The replacement keeps its phase and the target lock, writes nothing to Git, and reads the pull request it was to take over every poll interval for 24 hours after that refusal (its HandoffRecovery entry in status.gitWaits, the record of the abort), with condition PullRequestUnreadable naming the read that fails now (RecoveryReadFailed once the cause is gone and another read fails) and condition GitReadRetry with reason GitReadFailedBeforeHandoffRecovery. A merge of its commit in that time is recorded (Merged); it never takes the pull request over, even when reads work again within seconds, so a short refusal now costs the automatic takeover. Then it ends NeedsIntervention with RecoveryWaitExpired (the message states the span it watched), keeps the condition, its status.handoff.from Reserved and the lock; a merge of its commit after that is still recorded on it with its receipt, and the lock goes once that merge is recorded or the pull request is closed, merged with another head (the replacement then ends Cancelled with HandoffAborted), open with the request replaced's own head, or the branch or repository is gone (the host closes a pull request whose branch is deleted, and that close releases it; a repository that left the settings keeps it, as for every stopped holder, with condition PullRequestUnreadable (reason RepositoryUnavailable) until the repository is back and a read settles it (decision of 2026-11-19 on #786: the release there of the second round lost the record of a merge made meanwhile), and so does a missing RemediationSettings object; when the settings name another target branch, the pull request is read on the branch the plan recorded, so a merge or a close there settles the lock as above; second round of #786) (third decision of 2026-11-18). A replacement that ends before its takeover in any other way (HandoffRecoveryFailed, Expired, Cancelled) also keeps status.handoff.from Reserved and the lock while its commit may be on the open pull request, where it used to release the lock with its handoff Aborted. Who records a merge is decided by one rule: a merge of the replacement's commit is recorded on the replacement alone, and the request replaced ends Superseded with the new reason MergedForReplacement (no failure for the circuit breaker); when the replacement is deleted, the request replaced records the merge once as MergedWithForeignChange. While the intent stands the request replaced posts no comment before it stores the abort. The write of the HandoffRecovery entry removes a HandoffGrace entry, so each wait ends at its own end. A failure of the Git host worth retrying and no refusal keeps the old bound: 15 minutes after the deadline, then HandoffRecoveryFailed. A failure of the Kubernetes API never ends a recovery on the replacement: it goes to the error backoff and shows as a reconcile error. A replacement whose every status write is refused, so that it never stores its refusal, behaves as before (#869). What to alert on: an alert on GitForbidden, GitRejected, RepositoryUnavailable, TargetBranchChanged, RepositoryUnusable or HandoffRecoveryFailed as a reason of NeedsIntervention no longer fires for a recovery that cannot read. Alert on BranchDiverged of the request replaced, on condition GitReadRetry with reason GitReadFailedBeforeHandoffRecovery, and on NeedsIntervention with reason RecoveryWaitExpired. See design 6.5. - The release that closes #892 changes how a request ends when a person moved its own pull request to another base branch. Such a request used to end NeedsIntervention with ChangeRequestGone and release its target lock. It now stops NeedsIntervention with ChangeRequestOnOtherBase, with a message that names the pull request and its base, writes nothing more to it, and keeps the target locked while that pull request is open (TargetHeld names it); closing it or moving it back to the target branch releases the lock. One merged into the other base stops the same way and keeps no lock. Deleting such a request closes the pull request on the base it was moved to. The CRDs do not change. The release that closes #925 changes two of these points, as the next note says: such a stop now writes a failed review check, and moving the pull request back no longer releases the lock. - The release that closes #925 changes what a stopped request does to its own open pull request, with reviewer hints on. A request that stops while its pull request is open, on the target branch or on another base, fails the check run shadewright/review on its head: in the step that stops it, or at its next look of the target lock. A stopped request whose look keeps the lock writes it whatever its own pull request is (closed, merged elsewhere or gone) while another open pull request from its branch holds the lock (ADR-0046). Deleting a stopped request writes no check: an unmarked open pull request from its branch keeps a check written before the stop, and the executor logs that at Info. That failed check, which a stale plan or a cancel also writes in the cases ADR-0045 lists, is the only thing written to a pull request on another base besides the close at a deletion, and the stop's message says so. Moved back to the target branch, the pull request keeps the lock, and its check stays failed. While the failed check cannot be written, condition ReviewCheckNotFailed says why, with a Warning Event of the same name; a look that cannot read the check on a head already failed records the Warning Event StoppedCheckUnread once. Any open pull request from the request's branch keeps the lock on every base, with or without the marker. The finalizer of a deleted request whose repository entry now names another target branch closes its marked pull requests through the recorded target branch and on every other base, instead of letting go; when the repository left the settings, it lets go at once with the Warning Event PullRequestLeftOpen, and an entry that cannot be used or a missing RemediationSettings object is a failure of the cleanup (CleanupFailing) retried within its 24 hour bound. A stopped request's failed check, once recorded, is never replaced by another state. Before the merge gate writes the check, the request is read from the API server; while that read fails, condition Approved is False with reason ReviewCheckLiveReadFailed and nothing is written, except a pending or failed check over a passing one on the head. A release of the lock, or the record of a merge, while the failed check is not written logs that at Info. A refused write of the failed check shows reason GitForbidden or GitRejected on ReviewCheckNotFailed, a 401 (a wrong App key or a deleted App) GitUnauthorized, a 404 GitNotFound. The CRDs change only in their descriptions. - The release that closes #892 changes how a request ends when a person moved its own pull request to another base branch. Such a request used to end NeedsIntervention with ChangeRequestGone and release its target lock. It now stops NeedsIntervention with ChangeRequestOnOtherBase, with a message that names the pull request and its base, writes nothing more to it, and keeps the target locked while that pull request is open (TargetHeld names it); closing it or moving it back to the target branch releases the lock. One merged into the other base stops the same way and keeps no lock. Deleting such a request closes the pull request on the base it was moved to. The CRDs do not change. - The release that closes #985 makes networkPolicy.analyzer.prometheus.podLabels and networkPolicy.analyzer.traceCollector.podLabels replace the default selector labels instead of merging with them (Helm merges maps, so a single label you set used to be added to the default and the rule matched no Pod). An empty value, the new default, still selects the documented default labels. If you set one extra label and kept the default, list every label the Pods need now: for Prometheus app.kubernetes.io/name: prometheus and app.kubernetes.io/component: server, for the collector app.kubernetes.io/name: opentelemetry-collector. A key set to null (the workaround app.kubernetes.io/name: null plus your own label) is ignored, so that override renders only your own labels; if every key is null the default applies, never an empty selector. - The release that closes #981 makes spec.analysis.maxContextBytes of the settings bound the context of each analysis; before, the context was always bounded at 48 KiB, whatever the field said. The field's default goes from 32768 to 49152 (48 KiB). The API server wrote the old default into a settings object created before, so after the upgrade such an object bounds the context at 32 KiB, which cuts more and escalates more often. Check it with kubectl get remediationsettings default -o jsonpath='{.spec.analysis.maxContextBytes}{"\n"}'; to keep the bound of before, set it to 49152 or remove the field (the API server then writes the new default). The field's maximum goes from 262144 to 49152, since the section bounds add up to 48 KiB and a larger value added no context: the API server refuses a larger value in a new write, and the analyzer reads a stored larger value as 49152. - The release that closes #873 bounds the work of redaction: each text it decides gets 1,024 steps per byte plus 65,536, and a text that uses them up, is longer than 4 MiB, or is a tool's answer or a sequence of more parts than its bytes allow (reason heap), is withheld whole, never shown in part, and counted in shadewright_redaction_withheld_total (metrics, withheld by redaction). Text the release before redacted and passed on is now refused in these places, all of them text of a few repeated shapes from a few KiB up. A reviewer hint whose redaction runs out of the budget is refused with the refusal NotRedactable. A reply to a hint whose check runs out of it is not posted, and the hint records the reply NotRedactable. An analysis record whose check by the redactor is withheld for its work or size is refused by the store (shadewright_analysis_records_total refused, with the Warning event AnalysisRecordNotWritten). A read tool's result or a context block that is withheld is a source that failed ("could not fetch: withheld by redaction"), so an analysis that needed it escalates. One redaction holds at most 28 bytes of heap per byte of its text plus 4 MiB on most text; on text dense in matches or in control characters it holds more, up to 71.7 bytes per byte measured (111.6 MiB for an object of 1.5 MiB). So the redactions running at once share a limit of half the Go memory limit (GOMEMLIMIT): each takes 4 MiB plus 100 bytes per byte of its text before it starts and waits while the others hold too much, a text over about 1.1 MiB runs alone, and a wait that reaches the caller's deadline or 2 minutes withholds the text with the reason wait (shadewright_redaction_heap_waits_total counts the waits). An analysis record whose check waited on every try of the write is not written (failed), never refused. The analyzer's default memory limit rises from 128Mi to 256Mi (analyzer.resources.limits.memory, and config/manager/analyzer.yaml; the request stays 64Mi): the limit (115.2 MiB), or one large text running alone (up to about 117 MiB), fits beside the rest of the analyzer, measured at 77 MiB of Go heap with no analysis running. A values file that sets the analyzer's memory limit keeps its own value: below 256Mi the analyzer runs as before and logs one warning at start (it reads GOMEMLIMIT, not the container limit: a kustomize overlay that changes the memory limit must set GOMEMLIMIT to 90 percent of it as well, or there is no warning), but one large text can still hold up to about 117 MiB on its own, so the risk is an out-of-memory kill, not a longer wait. The collector no longer reads an event note over 4 KiB and never waits for this limit: the fixed <long note> stands in for its text in the fingerprint, and the Incident shows <long note: N bytes> as its symptom (a module's evidence value over 4 KiB shows <long value: N bytes>). So Incidents of events with notes over 4 KiB get a new fingerprint once, after the upgrade (a new Incident opens for the next such event, and the old one is no longer updated), and two such notes of one subject and reason share one Incident; the model still reads the note through the events tool. Fingerprints of notes of at most 4 KiB do not change. The manifests in config/manager now set the analyzer's GOMEMLIMIT (241591910 bytes, 90 percent of 256Mi) as the chart does; without a Go memory limit the limit is a fixed 64 MiB (#1087). No CRD change. - The release that closes #852 refuses what the model writes with a control character (a code point of Unicode category Cc other than newline and tab) where it would act: a tool call whose name, ID or arguments hold one is not run and gets a fixed refusal as its result, and a result with one in a field other than free text ends the analysis as invalid output. Free text from the model is stored without controls. Redaction also reads cluster text without its controls and hides what that finds, so some text next to a secret that was shown before is hidden now (10). No fingerprint changes: the collector decides symptoms and fingerprints as before, so an Incident opened before the upgrade keeps counting the same symptom.

Symptoms of integration modules (KEDA ceilings, trigger errors and readiness; Flux and Kyverno conditions, cloudflared Pods) open Incidents from v0.3.0 on, and only for the modules that spec.modules.integrations of the RemediationSettings lists (#380). An upgrade from v0.2.0 turns none on: list the modules you want, for example kubectl patch remediationsettings default --type merge -p '{"spec":{"modules":{"integrations":["keda"]}}}', and change the same in the manifests you keep in Git. The release candidates v0.3.0-rc.1 to rc.4 ran the KEDA HPA source for a detected KEDA without that entry; from rc.5 on, a KEDA that is detected but not listed opens no Incident (see No Incident appears).

Known issues in v0.3.0

  • One root cause opens several Incidents (#432, still open; the rule is accepted in ADR-0039 and partly built). One OOM can open an Incident each for OOMKilled, the failing readiness probe and BackOff; each is analyzed and may propose a request for the same container. Since #791, when the OOMKilled Incident exists before the BackOff or Unhealthy event arrives, the event is counted in that Incident's status.absorbed and opens none of its own; a consequence with no cause yet is held for 2 minutes (#792) and opens its own Incident only if it is still failing; since #828 a consequence whose pod shows a cause the Incident controller has not seen yet is held until it has, at most 2 minutes, and then counted on the cause's Incident when that exists. For a cause that opens its Incident at once (an OOM kill), the order in which the two arrive no longer opens a second Incident, except after a restart whose replay finds the event gone or the pod no longer showing the cause. For a cause the gate holds as a first sighting (a waiting cause such as a missing Secret), the consequence leaves the hold at the end of the 2 minutes or when its pod is replaced (cause_unseen), can open an Incident of its own and be analyzed, and is folded into the cause's Incident if that opens within 15 minutes; closing that case is #849; since #793 a consequence Incident that opened up to 15 minutes before its cause's Incident, with no pull request, is folded into it, and since #794 its request with no pull request yet ends Cancelled (IncidentFolded) instead of opening one. Only one of them holds the target (maxConcurrentRemediations). With --verify-outcomes off, as in v0.3.0, requests of different Incidents are not superseded when one of them merges: each ends Denied (PreviousValueMismatch) or, while Flux is still applying the merge, NeedsIntervention (KustomizationNotReady) after 10 minutes. #643 and #719 are built since: a request that waits behind another one ends Superseded when that one is closed without a merge (#643) or, with --verify-outcomes on, succeeded (#719) (design 6.6.4 and 6.6.5), so with it on, a second pull request for the same field no longer opens; with it off, the Denied and NeedsIntervention ends above still apply to a request that waited behind a merge. What is left is the analyses: each of the Incidents still counts against spec.analysis.maxAnalysesPerDay, so set it with about three analyses per OOM in mind.
  • Commits pushed by someone else to a shadewright/<name> branch before the pull request is opened are not checked (#524, planned for v0.3.1). The executor checks the target file on the branch, not that the branch holds nothing else, so such commits end up in the App's pull request without passing the policy or the render check. Until the fix, add a ruleset on the GitOps repository that lets only the GitHub App create and push shadewright/* branches, and review every file a pull request changes.

What is not touched by an upgrade: the budget ConfigMap shadewright-analysis-budget (it ships without data, so applying the manifests does not reset the day's count) and existing Incidents. A downgrade is not tested; the CRDs of the older release may not accept objects the newer one wrote.

Flux delivers the install

In the reference lab the agent is installed by Flux from a vendored copy of config/default (infrastructure/shadewright/ in the fleet repository, regenerated by scripts/vendor-shadewright.sh for a commit and two image digests). An upgrade there is a pull request that regenerates the copy, and Flux applies it. Its Kustomization has prune: true, so removing a file from the copy deletes the object from the cluster.

Upgrade with Helm

Steps 1 to 4 above (release notes, Kubernetes 1.32 or later, which the chart's kubeVersion checks, from v0.1.0 the move of maxAnalysesPerDay, whose patch follows helm upgrade, and the optional pause) come first. The chart carries the image digests of its release (executor, analyzer and verifier), so one chart version is one tested set of images (step 5), and helm upgrade is step 6. Keep your values in a file and pass it on every upgrade:

helm upgrade shadewright oci://ghcr.io/pkalin/charts/shadewright --version <new version> \
  --namespace shadewright-system -f my-values.yaml --wait --timeout 10m

--timeout 10m is twice the five minutes each new Pod may take to turn Ready (health probes).

  • Pin --version, or better install the digest you verified (oci://ghcr.io/pkalin/charts/shadewright@sha256:<chart digest> in place of the reference and --version; Helm accepts it). Verify the chart and the images first (the chart's cosign identity is in the configuration reference, the images are in verify a release).
  • Prefer -f my-values.yaml to --reuse-values, which reuses the values of the last release instead of the new chart's: the digests of the new release may not reach the Deployments. After any upgrade check the images that run (kubectl -n shadewright-system get deploy -o wide). --reset-then-reuse-values starts from the new chart's values and applies yours.
  • From a source checkout, use the path of the clone instead (./dist/chart). A clone has no digests: set executor.image.digest, analyzer.image.digest and verifier.image.digest to the digests of the release you check out, or image.allowTag=true to run the appVersion tag, which needs images built from that same checkout. Without either, the chart refuses to render. Mind that the clone must be of the tag whose images you run.
  • The CRDs are templates of the chart, so helm upgrade applies them with the Deployments, unlike a CRD in a crds/ directory. With --wait Helm returns when the Deployments are available; the Lease handover from step 6 still applies.
  • Keep the same clusterId on every upgrade. It is hashed into every Incident fingerprint, so changing it, also from the empty default (the UID of kube-system) to a value of your own, starts every Incident afresh. A client-side render (helm template, helm diff, Argo CD, Flux with a dry-run) asks no cluster and cannot read the kube-system UID, so it fails until clusterId is set: put it in the values of any such tool, and set it to the value the live release uses (helm get values shadewright -n shadewright-system, or kubectl get ns kube-system -o jsonpath='{.metadata.uid}' if you left it empty).
  • The settings object is not changed by an upgrade, see The settings object.

Then, from v0.1.0, the patch of step 3, and steps 7 and 8 (check, unpause). helm rollback is a downgrade and carries the same warning; for a rollback from v0.5.0 see the next section.

Roll back from v0.5.0

v0.5.0 is a breaking change for rollback. Putting only an older executor image under the v0.5.0 CRDs does not work (decided 2026-11-13, #705). The v0.5.0 CRD of RemediationRequest has rules that reject a status write which leaves out a value already stored: status.mergeReceipt and status.mergeCommitAwaitedSince (set once), status.verification (kept once set), and status.queuedBehind (kept once it names a request). A v0.4.x executor does not know these fields, so its status writes drop them and the API server refuses the writes. The same holds for the analyzer and the Incident CRD: once an Incident's status.revertsProposed has entries, its rules refuse a status write that leaves them out or removes the whole status, so a v0.4.x analyzer cannot write that Incident's status. In the same way, once an Incident has status.cause true (from the release that builds #791), a rule at the status root and one on the field keep it true, and an older analyzer (v0.5.x), which does not know the field, cannot write that Incident's status. The rules stay as they are, because they are what keeps those fields from being changed or removed by anything else. This is not a major release: the project is before 1.0 and a breaking change bumps the minor version.

What to do instead:

  1. Pause writes (spec.paused: true on RemediationSettings) and let the pull requests you care about finish or close, as in upgrade step 4.
  2. Roll back the whole release, CRDs included, so the old schema and the old images arrive together. With Helm, the CRDs are templates of the chart, so helm rollback shadewright <revision> --namespace shadewright-system --wait --timeout 10m (or helm upgrade with the older --version and your values file) applies the old CRDs with the old Deployments. With the manifests, apply the older release's config/default (kubectl apply -k with the ?ref= and the digests of that release). Do not set crd.enabled=false for this: that leaves the v0.5.0 CRDs in place, which is the case this section warns about.
  3. Check as in upgrade step 7, then unpause.

What the old CRD does to requests that are in flight. The fields that v0.4.0 does not have are spec.reverts, status.mergeReceipt, status.mergeCommitAwaitedSince, status.verification, status.queuedBehind and status.conflictSeen. The API server prunes them from the stored objects, at the latest on the next write of each object. The conditions Cleared and Configured are items of the conditions list, not fields of the schema, so they stay on the objects; v0.4.x neither reads nor removes them. A request that was Merged or Verifying loses its receipt and its verification window, and one that waited behind another loses queuedBehind. A revert request loses spec.reverts, and so its link to the request it reverts. An Incident loses status.revertsProposed, so after an upgrade back to v0.5.0 a failed request whose Verified condition moved at most 24 hours before can get its revert proposed again.

The v0.4.x executor does not move a request on after Merged. Its code treats Merged, WaitingForDelivery, Verifying and Succeeded alike: the circuit breaker counts the merge as a success, and nothing sets those phases or reads the receipt. A request that the v0.5.0 executor left in WaitingForDelivery or Verifying (only with --verify-outcomes, off by default) stays there, with no verdict, until you delete it. A request in Inconclusive has a phase that is not in the v0.4.0 phase list. The v0.4.x executor does not count it as ended, so if it was the circuit breaker's probe it holds the breaker half open, and every other request with it, until you delete it.

The chart sets helm.sh/resource-policy: keep on the CRDs (crd.keep), so check after the rollback which CRDs exist (kubectl get crd | grep shadewright). The VerificationReport CRD is new in v0.5.0: it is not in v0.4.0, and the keep annotation makes Helm skip its deletion on a rollback as it does on an uninstall, so it stays. Nothing of v0.4.x uses it; delete it by hand if you do not plan to upgrade again. A rollback from v0.5.0 to v0.4.x has not been run against a cluster.

Uninstall

The order matters only if requests exist. Do it in this order:

  1. Get ready to clean up: make sure spec.paused is false and that the GitHub App and the Key Vault key still work, because closing pull requests needs both. Nothing else needs stopping first: nothing creates requests by itself yet.
  2. Delete the requests and wait until they are gone:
kubectl -n shadewright-system delete remediationrequests --all --wait=true --timeout=5m

Each one closes its open pull request. Check the fleet repository for pull requests whose body carries a Shadewright marker and that are still open. Merged ones are history and stay. 3. If a request stays Terminating, read why (kubectl -n shadewright-system describe remediationrequest <name>, and the executor log). Fix the cause, which is usually a pause that was left on or an App that was uninstalled or lost its permission, and the deletion finishes by itself. A request whose cleanup the Git host refuses (CleanupRefused) goes by itself at the first attempt that is refused 15 minutes or more after the first refusal, and one whose cleanup fails in any other way (CleanupFailing) 24 hours after the first failure; both leave the pull request for you to check and close. Only if the executor can never work again (the App or the vault is gone for good): close the pull request by hand, delete the branch shadewright/<request UID> if you want, and then remove the finalizer yourself:

kubectl -n shadewright-system patch remediationrequest <name> --type=merge -p '{"metadata":{"finalizers":null}}'

This is a human action. The agent itself never removes finalizers. 4. Delete the workloads: the executor and the analyzer (kubectl delete -k ., or delete the Deployments first if you want the CRDs to survive a while). 5. Delete what you created by hand: the RemediationPolicy and RemediationSettings objects, the RoleBindings shadewright-analyzer-watch and shadewright-verifier-watch in every watched namespace (they bind the ClusterRoles shadewright-analyzer-watch-role and shadewright-verifier-watch-role, which kubectl delete -k . removes), and the metrics reader binding you made for Prometheus. 6. Delete the CRDs last. Removing them deletes every Incident, request, policy and settings object. Incidents hold the deduplication state and are the record of what the collector saw; export them first if you want it (kubectl -n shadewright-system get incidents -o yaml, which holds the redacted symptom and no raw logs, see data handling). 7. Outside the cluster: uninstall the GitHub App from the repository (or delete its private key on GitHub) and delete the Key Vault key and the federated credential. Branches shadewright/* that were left are yours to delete. Analysis records in blob storage are kept for their retention, see data handling.

With Flux, removing the Kustomization that installs Shadewright prunes its objects, and Flux does not wait for Shadewright's requests to finish their cleanup, so do steps 1 to 3 first. The budget ConfigMap is not kept on this path: kubectl delete -k . and the Flux prune delete it with the rest, and the next apply creates it empty, so the day's count starts again (unless you exclude the namespace or the object from the prune). The reference lab is the exception that makes this harmless in practice: it is destroyed as a whole, and any pull request still open stays open on GitHub, to be closed by hand.

Uninstall with Helm

Do steps 1 to 3 of the uninstall first (settings unpaused, requests deleted and gone), then:

helm uninstall shadewright --namespace shadewright-system

What this removes: the three Deployments, the ServiceAccounts, the RBAC, the NetworkPolicies, the metrics Services and the RoleBinding the chart made in each watched namespace (which replaces the manual part of step 5 for those). What it leaves, as helm uninstall also says:

  • The CRDs, by default (crd.keep: true adds helm.sh/resource-policy: keep), and with them every Incident, request and policy object. A later helm install of the same release name finds them and goes on with them.
  • The RemediationSettings object default, if the chart created it, see below.
  • The budget ConfigMap shadewright-analysis-budget (it carries helm.sh/resource-policy: keep), so a helm install of the same release name in the same namespace within the same UTC day adopts it and continues the day's count instead of starting from zero. The two leader election Leases are deleted with the release and recreated by the next install; they hold no state worth keeping. To reset the count on purpose, delete the ConfigMap by hand (the next install creates it empty): kubectl delete configmap shadewright-analysis-budget --namespace shadewright-system.
  • The namespace, when --create-namespace made it (Helm never deletes it), and with it anything you created there. Delete it yourself when it holds nothing you need; deleting the namespace deletes the kept budget ConfigMap too.
  • What you created by hand: your RemediationPolicy objects and a metrics reader binding for Prometheus.

Remove the CRDs deliberately (step 6), after the uninstall:

kubectl delete crd incidents.remediation.shadewright.io remediationpolicies.remediation.shadewright.io \
  remediationrequests.remediation.shadewright.io remediationsettings.remediation.shadewright.io

Deleting a CRD deletes every object of its kind, so this deletes every Incident, RemediationRequest, policy and settings object and cannot be undone. Export what you want to keep first (see step 6). Do it only after the requests are gone and the executor has been uninstalled: with the executor gone, a request that still holds its finalizer cannot be cleaned up.

The alternative is crd.keep=false, but Helm reads the annotation from the manifest stored with the release, so it has to be in the release before you uninstall: helm upgrade ... --set crd.keep=false (or the value in your file), then helm uninstall. helm uninstall then deletes the executor and the CRDs in one go, which is why steps 1 to 3 must be done and checked beforehand. kubectl delete crd after a default uninstall gives you the same result with a pause in between to check that nothing is left.

The settings object and Helm

With settings.create=true and a settings.spec, the chart creates the RemediationSettings object default once, as a post-install and post-upgrade hook, and only when lookup finds none. After that Helm renders nothing for it: an upgrade does not change it, so a spec.paused: true you set as the emergency stop survives every helm upgrade, and a changed settings.spec in your values does not reach an existing object. Change it with kubectl or GitOps. The object has no hook-delete-policy and Helm does not track hook objects, so helm uninstall does not delete it either: remove it by hand, after the uninstall and before the CRDs if you keep them for a while:

kubectl delete remediationsettings.remediation.shadewright.io default

A new helm install with settings.create=true over a leftover object keeps the leftover, paused state included (it is not recreated from your values), so check it before you reinstall. helm template and --dry-run ask no cluster and always show the object. Leave settings.create off if you manage the object another way, in your GitOps repository for example.

Not covered

  • Rolling back after a merged pull request: merging is outside Shadewright's control, and undoing it is a revert pull request. After a request ends Failed with Verified False the analyzer proposes one revert request for it (#96), which a person approves like any other; for anything else, revert in Git by hand. On the first start after an upgrade to a version with the proposer, only a request that ended that way at most 24 hours before (by its Verified condition) gets its revert proposed; older ones are left to you.

OpenAI-compatible provider (#834)

Apply the new CRDs before selecting provider: OpenAICompatible. Compatible deployments omit apiVersion; their base and inference API must match an install-time endpoint declaration, and their model must be in its allowed models list (ModelNotAllowed otherwise). Compatible-only installs set analyzer.analysis.disableFoundry=true and need no inference workload identity. Blob records still need Azure identity.

  • This release refuses a Foundry deployment at api.openai.com through CEL, and a Foundry deployment at any declared compatible host through the analyzer. The previous release permitted them when its Foundry suffix list covered the host. An existing stored settings object is not rewritten by upgrade: CEL refuses a subsequent edit containing that OpenAI Foundry deployment, and the analyzer refuses calls to either destination with EndpointNotAllowed. Declare its exact compatible base and API and explicitly change that deployment's provider and remove its apiVersion, or restore a permitted Foundry resource before resuming.

Declare compatible endpoints and optional per-endpoint Secret or CSI key sources with a nonempty allowed models list under analyzer.analysis.openAICompatible.endpoints, then follow the qualification runbook. The Foundry suffix list never authorizes a compatible endpoint. Removing the release removes its mounts but does not revoke server credentials; revoke each key separately. No Secret API permission or additional controller identity is introduced. ADR-0042 is Accepted.