From 357f035418073dc42078cd36b5ccb0c5fd703ab2 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Fri, 24 Apr 2026 18:36:19 +0000 Subject: [PATCH] fix: skip K8s jobs with deletionTimestamp in concurrency guard (FAR-34) Jobs being deleted via kubectl enter a Terminating state where deletionTimestamp is set but no Complete/Failed condition is added. The concurrency guard previously treated these as running, blocking all subsequent heartbeat runs for the agent until the job fully disappeared from the K8s API. Co-Authored-By: Paperclip --- package.json | 2 +- src/server/execute.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c3ce00..7b68136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperclip-adapter-claude-k8s", - "version": "0.1.42", + "version": "0.1.43", "description": "Paperclip adapter plugin that runs Claude Code agents as Kubernetes Jobs", "license": "MIT", "repository": { diff --git a/src/server/execute.ts b/src/server/execute.ts index fa3db62..a7445c7 100644 --- a/src/server/execute.ts +++ b/src/server/execute.ts @@ -649,7 +649,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise !j.status?.conditions?.some((c) => (c.type === "Complete" || c.type === "Failed") && c.status === "True"), + (j) => + !j.metadata?.deletionTimestamp && + !j.status?.conditions?.some((c) => (c.type === "Complete" || c.type === "Failed") && c.status === "True"), ); if (running.length > 0) { // Separate orphaned jobs (from a previous server-side run) from truly