From 45bae203dd95f1be801e4f4708f93cda202d8164 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 24 Sep 2026 15:57:53 +0200 Subject: [PATCH 1/2] Resolve latest nightly without filtered runs listing A source=nightly dispatch with an empty run-id sometimes picked a months-old create-release run. The workflow runs listing, when filtered by branch and status, intermittently returns an outdated result set: repeated identical calls returned runs from May, June or two weeks ago instead of the latest. The May run had expired artifacts, which surfaced as "produced none of the expected artifacts"; a run within the 90-day artifact retention would instead have been tested silently as if it were the latest nightly. Listing without server-side filters and selecting the newest successful main run in jq returned the correct run on every call. The listing is still external state, so an auto-resolved run older than three days now fails with a message asking for an explicit run-id rather than testing a stale build. An explicit run-id bypasses the check. --- .github/workflows/test-smokes-built.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-smokes-built.yml b/.github/workflows/test-smokes-built.yml index 4835bbbbd7..f982147852 100644 --- a/.github/workflows/test-smokes-built.yml +++ b/.github/workflows/test-smokes-built.yml @@ -267,12 +267,21 @@ jobs: run: | run_id="$RUN_ID_INPUT" if [ -z "$run_id" ]; then - run_id="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow create-release.yml \ - --branch main --status success --limit 1 --json databaseId --jq '.[0].databaseId // empty')" - fi - if [ -z "$run_id" ]; then - echo "::error::No successful create-release run was found. Provide a run ID or complete a create-release run first." - exit 1 + # The runs listing intermittently returns an outdated result set when + # filtered by branch or status, so filter and sort client-side. + latest="$(gh run list --repo "$GITHUB_REPOSITORY" --workflow create-release.yml \ + --limit 30 --json databaseId,createdAt,headBranch,conclusion \ + --jq '[.[] | select(.headBranch == "main" and .conclusion == "success")] | sort_by(.createdAt) | last // empty | "\(.databaseId) \(.createdAt)"')" + read -r run_id created_at <<<"$latest" + if [ -z "$run_id" ]; then + echo "::error::No successful create-release run was found. Provide a run ID or complete a create-release run first." + exit 1 + fi + age_days=$(( ( $(date +%s) - $(date -d "$created_at" +%s) ) / 86400 )) + if [ "$age_days" -gt 3 ]; then + echo "::error::Latest successful create-release run ${run_id} is ${age_days} days old (${created_at}); the runs listing may be outdated. Provide a run ID explicitly." + exit 1 + fi fi sha="$(gh run view "$run_id" --repo "$GITHUB_REPOSITORY" --json headSha --jq '.headSha // empty')" if [ -z "$sha" ]; then From 1806408365929c4c7ac2e9b13c7b6792bef6e3c9 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Thu, 24 Sep 2026 17:24:22 +0200 Subject: [PATCH 2/2] Compare nightly run age in seconds for the staleness check Integer division to whole days truncated partial days, so a run just under four days old passed the three-day limit. --- .github/workflows/test-smokes-built.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-smokes-built.yml b/.github/workflows/test-smokes-built.yml index f982147852..0989cb9bdf 100644 --- a/.github/workflows/test-smokes-built.yml +++ b/.github/workflows/test-smokes-built.yml @@ -277,9 +277,9 @@ jobs: echo "::error::No successful create-release run was found. Provide a run ID or complete a create-release run first." exit 1 fi - age_days=$(( ( $(date +%s) - $(date -d "$created_at" +%s) ) / 86400 )) - if [ "$age_days" -gt 3 ]; then - echo "::error::Latest successful create-release run ${run_id} is ${age_days} days old (${created_at}); the runs listing may be outdated. Provide a run ID explicitly." + age_seconds=$(( $(date +%s) - $(date -d "$created_at" +%s) )) + if [ "$age_seconds" -gt $(( 3 * 86400 )) ]; then + echo "::error::Latest successful create-release run ${run_id} is $(( age_seconds / 86400 )) days old (${created_at}); the runs listing may be outdated. Provide a run ID explicitly." exit 1 fi fi