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 <noreply@paperclip.ing>
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paperclip-adapter-claude-k8s",
|
"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",
|
"description": "Paperclip adapter plugin that runs Claude Code agents as Kubernetes Jobs",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -649,7 +649,9 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
|
|||||||
labelSelector: `paperclip.io/agent-id=${sanitizedAgentId},paperclip.io/adapter-type=claude_k8s`,
|
labelSelector: `paperclip.io/agent-id=${sanitizedAgentId},paperclip.io/adapter-type=claude_k8s`,
|
||||||
});
|
});
|
||||||
const running = existing.items.filter(
|
const running = existing.items.filter(
|
||||||
(j) => !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) {
|
if (running.length > 0) {
|
||||||
// Separate orphaned jobs (from a previous server-side run) from truly
|
// Separate orphaned jobs (from a previous server-side run) from truly
|
||||||
|
|||||||
Reference in New Issue
Block a user