delivery-operator (opus; no Edit, Write, NotebookEdit or Agent) is the verify-stage lead. After a human approves and merges, it reads the delivery doc at the merge commit's first parent, proves its kubeconfig cannot write (four auth can-i probes), loads the routed tool skills and runs delivery-verify. It posts the operator report as its own comment, then the final Handoff (Next command none on pass). delivery-verify: - stops first if the change was already reverted; - waits for Flux through flux-diagnose's Applied check (15-minute cap) and reads post-merge CI per workflow through delivery-ci-checks (45-minute cap), accepting a later cumulative run as cover; - checks the PR's post-merge assertions with Read-tier commands only; - ties a failure to the change only when that is established, and otherwise stops. A tied failure opens a revert PR (Ready for Human, built in a temporary worktree); it never reverts on its own. For Flux the guarantee is bounded: the merge commit applied and the inventory HelmReleases are Ready. The assertions prove a values or chart change took effect. The delivery doc format gains a seventh parsed section, Post-merge checks (glob -> push-event status names, or none when Flux pulls the change), so delivery-repo-doc goes to 0.2.0. delivery-ci-checks takes a caller check list and wait cap; delivery-handoff carries the verify stops. delivery 0.6.0. Refs: #194 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
6.4 KiB
Attributing a failure
A revert PR undoes this change, so it is opened only when a failure is tied to this change. When in doubt the failure is untied: a stop asks a human, a wrong revert PR asks them to undo the undo. A failure is tied only when every condition below is established from what the run read; anything not established, including a cause or an earlier state that cannot be read, is untied.
Assertion
Tied only when its target was reached and the observed value contradicts the change: a service
answering with the old version, an object present with the wrong spec. Untied when an untied
failure below (a Kustomization already failing, another commit's failure) is what made it fail. A
connection error or timeout reaching the target is never a fail: it is
unverifiable: <why> (SKILL.md Step 5).
Untied when the state read may come from a commit after the merge commit: the Applied commit
(references/report.md) is not the merge commit, a waited Kustomization carries a
superseded by note, or a check passed only as "covered by" a later commit. A later commit may
have changed the target.
CI check
Always untied, whatever file or component it names: a failure from an unreachable host, a timeout, a cancelled run, a runner or registry error, or a refusal to run such as Provision's "not tip of main". These say the run could not judge the change, not that the change is wrong.
Otherwise tied when both hold:
-
It names this change. The cause from
delivery-ci-checks, or the job log (mcp__gitea__actions_run_readget_job_log_preview), names a file the PR changed, or names a component whose files the PR changed. A component is a unit the repo's tooling runs by name: an Ansible role or playbook, a Flux app, a Helm chart, a Terraform module. It maps to the directory or file that defines it (roles/<name>/,<playbook>.yml, the app's or chart's directory); the failure names the component and the PR changed a file under its directory. -
It was passing before. Walk the merge commit's first-parent history back to the nearest ancestor carrying a status with the same name:
git log --first-parent --format=%H -n 50 <merge commit>^1 # ADR-0023: parsedBare
git, per ADR-0023: rtk filtersgit logand this output is parsed. Read each SHA's statuses withmcp__gitea__commit_readget_status, newest first. Askippedstatus ran nothing, so pass over it, but only when every row of its workflow (the status name's prefix before/) on that commit issuccessorskipped; otherwise a failure there may have skipped it, and the failure is untied. The first one found must besuccess. Anything else, or none in the 50 commits → untied.
Kustomization
Tied when all hold:
- Its attempted revision is the merge commit itself. One that strictly descends from it is another commit's failure, not this change's: untied.
- Its diagnosis names a path the PR changed, or an object rendered from one.
- It was Ready at the revision before: its Ready message,
flux eventsorflux trace, read throughflux-diagnose, show that. A Kustomization already failing is untied.
A Kustomization that is failed only through its HelmReleases, including a failed health check
on them, is judged under §HelmRelease alone.
HelmRelease
The Applied check reports every failing HelmRelease in a waited Kustomization's inventory, so most are not this change's. A failing one is tied only when all three hold:
-
It is linked to this PR, by one of these:
-
Its manifest is in a changed file. Read each changed
.yamlor.ymlfile the PR did not delete withmcp__gitea__get_file_contents,refthe merge commit; aHelmReleasedocument matches by name and namespace. One with nometadata.namespacematches by name only when its Kustomization'sspec.pathcontains that file. -
Its
spec.chartRefor aspec.valuesFromentry names, by kind, namespace and name, an object defined in a changed file, or generated from one. A generator matches when aconfigMapGeneratororsecretGeneratorin anykustomization.yamlunder its Kustomization'sspec.pathlists the changed file: afiles,envsorenventry (the path after anykey=,../included) resolves, relative to thatkustomization.yaml, to the changed path. It generates<base>-<hash>, or<base>when it disables the name suffix. A hashed generator matches avaluesFromname that is<base>-plus a 10-character suffix, by prefix, or the unhashed<base>: kustomize rewrites the name only when aconfigurations:nameReference forkind: HelmRelease,path: spec/valuesFrom/nameexists. List the candidates and read each at the merge commit, with.for an emptyspec.pathor./:rtk git ls-tree -r --name-only <merge commit> -- <spec.path>A
secretGeneratormatches by name only; never read the files it lists. -
Its
spec.chart.spec.sourceRefis aGitRepositoryreferences/apply-wait.mdstep 2 kept, and itsspec.chart.spec.chartpath contains a changed path (that file's step 4 rule).
Read the references, names only, never values (an empty namespace is the release's own):
KUBECONFIG=<path> kubectl get helmrelease <hr> -n <hr-ns> -o jsonpath='{.spec.chartRef.kind}{"|"}{.spec.chartRef.namespace}{"|"}{.spec.chartRef.name}{"|"}{.spec.chart.spec.sourceRef.kind}{"|"}{.spec.chart.spec.sourceRef.namespace}{"|"}{.spec.chart.spec.sourceRef.name}{"|"}{.spec.chart.spec.chart}{"\n"}{range .spec.valuesFrom[*]}{.kind}{"|"}{.name}{"\n"}{end}' -
-
It was Ready before the change, shown by its
flux eventsorflux tracethroughflux-diagnose: an upgrade from Ready to failing is this change's. A HelmRelease failing before, or new in this PR with no earlier state, is untied. -
Its Kustomization reached the merge commit itself:
appliedat it, orfailedwith its attempted revision equal to it. The second coverswait: trueorhealthChecks: when a health check on its HelmReleases fails, kustomize-controller is believed, not confirmed, to keep the applied revision at the previous commit. Asuperseded byorlater revision … failingnote on that Kustomization → untied: a later commit's chart or values may be what fails.
Anything else is untied: a stop, never a revert.
Recording
Record each failure in the report's Verification line with tied or untied and the one-line
reason.