From 655a479c09f51b376b8cc6398a0f76d327dbae86 Mon Sep 17 00:00:00 2001 From: kjgbot Date: Sun, 6 Sep 2026 11:50:00 +0200 Subject: [PATCH] fix(review-swarm): a missing reviews directory yields MISSING, not a find error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebased onto main after #203 landed. #203 already carried this PR's `mkdir -p .github/workflows/scripts`, so only the verdict guard remains. `swarm_latest_transcript` ran `find` against a directory that need not exist. The guard returns empty instead, and `swarm_lens_result` maps empty to MISSING, which is non-PASSED and fails the aggregate — so this stays fail-closed rather than converting a missing directory into a passing gate. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1 --- .github/workflows/scripts/swarm-verdict.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/scripts/swarm-verdict.sh b/.github/workflows/scripts/swarm-verdict.sh index 2aeb1ab29..71845ddd9 100755 --- a/.github/workflows/scripts/swarm-verdict.sh +++ b/.github/workflows/scripts/swarm-verdict.sh @@ -3,6 +3,10 @@ # Shared, fail-closed review transcript selection and verdict extraction. swarm_latest_transcript() { local reviews_dir=$1 pr=$2 lens=$3 + # A run whose reviews directory was never created must yield MISSING, not a + # `find` error. The caller keys on empty output, so returning nothing here + # stays fail-closed. + [ -d "$reviews_dir" ] || return 0 find "$reviews_dir" -maxdepth 1 -type f \ -name "????????-????-pr${pr}-${lens}.md" -print 2>/dev/null | LC_ALL=C sort | tail -n 1