From 5cb010dfe59ebc692595d10e2ddb637836e31412 Mon Sep 17 00:00:00 2001 From: Jefferson Ramos Date: Fri, 10 Jul 2026 21:05:40 -0300 Subject: [PATCH] fix: skip duplicate Analysis stage in approve & upgrade flow Prevents adding a duplicate Analysis stage entry when one already exists in the AgenticRunApproval spec, avoiding a 409 conflict error. Co-Authored-By: Claude Opus 4.6 --- src/hooks/useApprovalActions.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hooks/useApprovalActions.ts b/src/hooks/useApprovalActions.ts index 39a49a6..d512965 100644 --- a/src/hooks/useApprovalActions.ts +++ b/src/hooks/useApprovalActions.ts @@ -23,6 +23,8 @@ export const useApprovalActions = (approval?: LightspeedAgenticRunApproval) => { setError(null); try { const existingStages = currentApproval.spec?.stages ?? []; + if (existingStages.some((s) => s.type === stageType)) return true; + const stageEntry: Record = { type: stageType, decision: 'Approved',