From 75f205a53990aae20fefbb6ceed78ac8e156e812 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 3 Jul 2026 11:44:27 +0000 Subject: [PATCH] cicd ignore reused object total timing --- .agents/skills/unidesk-cicd/references/branch-follower.md | 2 ++ scripts/src/cicd.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.agents/skills/unidesk-cicd/references/branch-follower.md b/.agents/skills/unidesk-cicd/references/branch-follower.md index b81b3b19..92b20ba9 100644 --- a/.agents/skills/unidesk-cicd/references/branch-follower.md +++ b/.agents/skills/unidesk-cicd/references/branch-follower.md @@ -68,6 +68,8 @@ Stage timing must be queryable through normal CLI output, not only raw JSON. `st Do not backfill, infer, or migrate old branch-follower state when historical timing, stage timing, or other observability fields are missing or known to be unreliable. Compatibility starts with future state written by the current controller; old missing data must render as `-`/unknown in CLI output instead of being recovered from unrelated native objects. +If a deterministic Kubernetes Job or PipelineRun is reused and there is no already-stored `timings.startedAt`, the reused object's current wait/check duration is only a stage observation; it must not be promoted to `timings.totalSeconds`. + State machine phases are `Observed`, `Noop`, `PendingTrigger`, `Triggering`, `ClosingOut`, `Succeeded`, `Failed`, `Superseded`, `Blocked`, and `Skipped`. Status and decision inputs are Kubernetes-native: diff --git a/scripts/src/cicd.ts b/scripts/src/cicd.ts index 8c999a38..5957f910 100644 --- a/scripts/src/cicd.ts +++ b/scripts/src/cicd.ts @@ -2126,6 +2126,8 @@ function compactTimings(timings: FollowerState["timings"]): FollowerState["timin function totalTimingFromCommand(command: Record | undefined, phase?: BranchFollowerPhase): { seconds: number; status: string; source: string; startedAt: string | null; finishedAt: string | null } | null { if (command === undefined) return null; + const payload = asOptionalRecord(command.payload); + if (payload?.reused === true) return null; const startedAt = stringOrNull(command.startedAt); const finishedAt = stringOrNull(command.finishedAt); const seconds = totalSecondsFromRange(startedAt, finishedAt) ?? secondsFromMs(numberOrNull(command.elapsedMs));