Repository navigation
Closed
Labels
scope/k8sKubernetes commands, Helm charts, pods, services, and policiessource/agentFiled by an agenttype/bugType bug: the code does not do what it must
Description
Problem
Lines cited at 05e9388 (release/v0.2.29).
- Stuck releases are found by stderr text.
_recover_stuck_helm_release_if_pending(commands/k8s/stack_lifecycle.py:208-246) runs only when Helm's stderr contains"another operation"(:212).- It then deletes the release's storage Secret
sh.helm.release.v1.<release>.v<N>with kubectl (:226-242). That assumes Helm's Secret storage driver, and it discards the pending revision rather than rolling back.
- Resources are adopted by parsing error text.
_adopt_helm_resource_if_conflict(:249-300) runs when stderr contains"invalid ownership metadata"or"cannot be imported"(:258-262).- It extracts kind, name and namespace with a regex over Helm's message (
CONST_HELM_OWNERSHIP_CONFLICT_RE,config/constants.py:2273-2275). - It then labels and annotates each resource with kubectl.
- Both depend on the wording of Helm's human error text, which can change between releases. The code already branches on the Helm major version (
_is_helm_v4_or_newer,:489).
Proposed remedy
- Before
helm upgrade --install, readhelm status -o json. No stderr is inspected.- A
pending-installrelease is uninstalled. - A
pending-upgradeorpending-rollbackrelease is rolled back withhelm rollback <release>to its previous revision.
- A
- Pass
--take-ownership(Helm 3.17 and later, and Helm 4) so Helm adopts existing resources itself. Delete the regex, the constant and the kubectl label/annotate loop. - Check the Helm version once: require 3.17 or later, with an error naming the installed version.
Acceptance criteria
-
rg -n 'another operation|invalid ownership metadata|cannot be imported|CONST_HELM_OWNERSHIP_CONFLICT_RE' srcprints nothing. - When the process fake answers
helm status -o jsonwithpending-upgrade, deploy-stack runshelm rollback <release>before the upgrade. - When the process fake answers with
pending-install, deploy-stack runshelm uninstall. - Every
helm upgrade --installargv carries--take-ownership. - Helm 3.16 fails with the version error.
- Tests run offline with fakes only at process and HTTP edges; each new test runs under 1 s.
-
uv run devops cipasses.
Found by the 2026-10-08 client-library audit.
Opened as a borrow (#1153, budget/borrowed): the agent filing quota is spent for this cycle, and this is a defect or security finding of the owner-requested 2026-10-08 client-library audit.
Metadata
Metadata
Assignees
Labels
scope/k8sKubernetes commands, Helm charts, pods, services, and policiessource/agentFiled by an agenttype/bugType bug: the code does not do what it must
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty-bot commentedon Oct 8, 2026
Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.
The code works today but will silently break when Helm changes its human-readable error strings; it is a fragility fix, not an active outage.Users on any future Helm 3.x or 4.x release that rewords its errors will hit unhandled stuck-release or ownership-conflict failures.Requires rewriting two helper functions, adding a version gate, removing a constant and regex, and updating the process-fake test suite, but the scope is well-bounded to one file and its tests.