fix: preserve Kubernetes runtimes after recoverable agent failures (#3824)

This commit is contained in:
José Almeida
2026-09-19 23:50:38 +01:00
committed by GitHub
parent e12590e58e
commit 2f44cd7b38
24 changed files with 1243 additions and 94 deletions
+6
View File
@@ -354,6 +354,12 @@ Current connection configuration and recorded workload configuration serve diffe
Ordinary Stop and backend shutdown close local clients and forwards but preserve the Pod and workspace. Agent or main-container restart keeps the Pod volumes; Kandev performs a new nonce handshake and local port-forward. If a Pod disappears, managed or existing PVC storage can support a replacement Pod after identity checks; `emptyDir` cannot.
A recoverable agent error also preserves the established Pod, workspace, and
recovery credentials. Use **Resume** to continue that session. If its retained
credentials or storage are missing, recovery fails rather than silently creating
an empty replacement workspace. A software update cannot restore resources that
were already deleted.
Archive/delete terminal cleanup and explicit force cleanup are destructive. Before deletion, Kandev verifies the recorded namespace, name, UID, and complete standard plus `kandev.ai/*` ownership-label set. It then deletes the exact Pod with UID/resource-version preconditions and deletes a PVC only when inventory proves Kandev created that managed claim. Existing claims are never deleted. A missing object is idempotent; an inventory read error, same-name replacement, UID mismatch, missing label, changed label, extra `kandev.ai/*` label, or mismatched create nonce fails closed without deleting the ambiguous object.
Kandev blocks deleting an executor, or changing an executor into or out of Kubernetes, while runtime inventory still refers to it. Finish normal session cleanup first. Profile deletion does not rewrite or destroy a retained workload because recovery owns the recorded profile ID and snapshot.