From 126eb383304a93b61fd7d9f2391673ecd1441b17 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Thu, 1 Oct 2026 10:59:14 +0700 Subject: [PATCH] fix(ops): don't cry wolf about a deploy that just hasn't ticked yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A push seconds before an ops-health run has no skip reason yet — that is normal, not a problem. Only flag a missing skip reason once the deploy script hasn't run for >6 min (i.e. the timer really looks stopped). --- scripts/ops-health.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/ops-health.sh b/scripts/ops-health.sh index 5cee3d2..42daf66 100755 --- a/scripts/ops-health.sh +++ b/scripts/ops-health.sh @@ -62,6 +62,11 @@ human_age() { else echo "$((s / 86400))d"; fi } +# Age of a file in seconds, or empty when it doesn't exist. +file_age() { + [ -f "$1" ] && echo $(( $(date +%s) - $(cat "$1" 2>/dev/null || echo 0) )) || echo "" +} + cd "$REPO" 2>/dev/null || { echo "ops-health: repo not found: $REPO" >&2; exit 2; } now=$(date +%s) @@ -153,8 +158,13 @@ else p " ${DIM}→ reason: ${sk_reason}${N}" ;; esac else - p " ${Y}no skip reason recorded — the deploy timer may not be running.${N}" - problems+=("deploy pending with no recorded reason"); signature+="noreason;" + r_age="$(file_age "$RUN_FILE")" + if [ -n "$r_age" ] && [ "$r_age" -lt 360 ]; then + p " ${DIM}waiting for the next deploy tick (~every 3m)…${N}" + else + p " ${Y}no skip reason recorded and the deploy script hasn't run recently — the timer may be stopped.${N}" + problems+=("deploy pending with no recorded reason"); signature+="noreason;" + fi fi fi