From feda217b82e77fa8c22ea6eba312da7262254c36 Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Sun, 26 Jul 2026 20:37:15 -0700 Subject: [PATCH] ci(bump-callers): harden the main-tip lookup in the 5 sibling entrypoints (BE-4683) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `main_tip=$(git ls-remote origin refs/heads/main | cut -f1)` reports the exit status of `cut`, not of `ls-remote`, so the step's `bash -e` never sees a failed lookup. On an ls-remote failure (network blip, remote hiccup, rate limit) main_tip was set to the empty string, the staleness guard compared empty != github.sha, printed the stale-run message and `exit 0` — a green run that bumped nothing, indistinguishable from a green run that bumped everything unless someone read the log. That is precisely the silent-drift failure mode this machinery exists to prevent. Port the shape already landed in the auto-label entrypoint: run ls-remote on its own so its status is checked, reject empty output, and only then compare against github.sha. A lookup we could not perform is not evidence of staleness — fail loudly instead. Applied verbatim to all five siblings (cursor-review, groom, assign-reviewers, pr-size, agents-md); each file's surrounding comment is preserved and the stale-run branch is unchanged. --- .github/workflows/bump-agents-md-callers.yml | 15 ++++++++++++++- .../workflows/bump-assign-reviewers-callers.yml | 15 ++++++++++++++- .github/workflows/bump-cursor-review-callers.yml | 15 ++++++++++++++- .github/workflows/bump-groom-callers.yml | 15 ++++++++++++++- .github/workflows/bump-pr-size-callers.yml | 15 ++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bump-agents-md-callers.yml b/.github/workflows/bump-agents-md-callers.yml index d3e507f..69bdb24 100644 --- a/.github/workflows/bump-agents-md-callers.yml +++ b/.github/workflows/bump-agents-md-callers.yml @@ -97,7 +97,20 @@ jobs: # that run's original (now stale) commit, and the bumper would # force-repin every caller to it. Only act from the current tip — # any newer push has its own queued run that does the bump. - main_tip=$(git ls-remote origin refs/heads/main | cut -f1) + # Don't pipe into `cut`: the pipeline would report cut's status, so a + # failed ls-remote (network blip, remote hiccup) yields an EMPTY + # main_tip that then compares unequal to github.sha and silently + # no-ops the whole fleet bump as if the run were stale. A lookup we + # couldn't perform is not evidence of staleness — fail loudly. + if ! ls_remote=$(git ls-remote origin refs/heads/main); then + echo "::error::Could not look up the current main tip (git ls-remote failed)" + exit 1 + fi + main_tip=${ls_remote%%$'\t'*} + if [[ -z "$main_tip" ]]; then + echo "::error::git ls-remote returned no SHA for refs/heads/main" + exit 1 + fi if [[ "$main_tip" != "$GITHUB_SHA" ]]; then echo "github.sha $GITHUB_SHA is not the current main tip ($main_tip) — stale run/re-run; nothing to bump" exit 0 diff --git a/.github/workflows/bump-assign-reviewers-callers.yml b/.github/workflows/bump-assign-reviewers-callers.yml index 078a2ee..c991aa9 100644 --- a/.github/workflows/bump-assign-reviewers-callers.yml +++ b/.github/workflows/bump-assign-reviewers-callers.yml @@ -102,7 +102,20 @@ jobs: # that run's original (now stale) commit, and the bumper would # force-repin every caller to it. Only act from the current tip — # any newer push has its own queued run that does the bump. - main_tip=$(git ls-remote origin refs/heads/main | cut -f1) + # Don't pipe into `cut`: the pipeline would report cut's status, so a + # failed ls-remote (network blip, remote hiccup) yields an EMPTY + # main_tip that then compares unequal to github.sha and silently + # no-ops the whole fleet bump as if the run were stale. A lookup we + # couldn't perform is not evidence of staleness — fail loudly. + if ! ls_remote=$(git ls-remote origin refs/heads/main); then + echo "::error::Could not look up the current main tip (git ls-remote failed)" + exit 1 + fi + main_tip=${ls_remote%%$'\t'*} + if [[ -z "$main_tip" ]]; then + echo "::error::git ls-remote returned no SHA for refs/heads/main" + exit 1 + fi if [[ "$main_tip" != "$GITHUB_SHA" ]]; then echo "github.sha $GITHUB_SHA is not the current main tip ($main_tip) — stale run/re-run; nothing to bump" exit 0 diff --git a/.github/workflows/bump-cursor-review-callers.yml b/.github/workflows/bump-cursor-review-callers.yml index 36cbb90..db98d7f 100644 --- a/.github/workflows/bump-cursor-review-callers.yml +++ b/.github/workflows/bump-cursor-review-callers.yml @@ -111,7 +111,20 @@ jobs: # that run's original (now stale) commit, and the bumper would # force-repin every caller to it. Only act from the current tip — # any newer push has its own queued run that does the bump. - main_tip=$(git ls-remote origin refs/heads/main | cut -f1) + # Don't pipe into `cut`: the pipeline would report cut's status, so a + # failed ls-remote (network blip, remote hiccup) yields an EMPTY + # main_tip that then compares unequal to github.sha and silently + # no-ops the whole fleet bump as if the run were stale. A lookup we + # couldn't perform is not evidence of staleness — fail loudly. + if ! ls_remote=$(git ls-remote origin refs/heads/main); then + echo "::error::Could not look up the current main tip (git ls-remote failed)" + exit 1 + fi + main_tip=${ls_remote%%$'\t'*} + if [[ -z "$main_tip" ]]; then + echo "::error::git ls-remote returned no SHA for refs/heads/main" + exit 1 + fi if [[ "$main_tip" != "$GITHUB_SHA" ]]; then echo "github.sha $GITHUB_SHA is not the current main tip ($main_tip) — stale run/re-run; nothing to bump" exit 0 diff --git a/.github/workflows/bump-groom-callers.yml b/.github/workflows/bump-groom-callers.yml index c23d8c8..ffe3a61 100644 --- a/.github/workflows/bump-groom-callers.yml +++ b/.github/workflows/bump-groom-callers.yml @@ -127,7 +127,20 @@ jobs: # that run's original (now stale) commit, and the bumper would # force-repin every caller to it. Only act from the current tip — # any newer push has its own queued run that does the bump. - main_tip=$(git ls-remote origin refs/heads/main | cut -f1) + # Don't pipe into `cut`: the pipeline would report cut's status, so a + # failed ls-remote (network blip, remote hiccup) yields an EMPTY + # main_tip that then compares unequal to github.sha and silently + # no-ops the whole fleet bump as if the run were stale. A lookup we + # couldn't perform is not evidence of staleness — fail loudly. + if ! ls_remote=$(git ls-remote origin refs/heads/main); then + echo "::error::Could not look up the current main tip (git ls-remote failed)" + exit 1 + fi + main_tip=${ls_remote%%$'\t'*} + if [[ -z "$main_tip" ]]; then + echo "::error::git ls-remote returned no SHA for refs/heads/main" + exit 1 + fi if [[ "$main_tip" != "$GITHUB_SHA" ]]; then echo "github.sha $GITHUB_SHA is not the current main tip ($main_tip) — stale run/re-run; nothing to bump" exit 0 diff --git a/.github/workflows/bump-pr-size-callers.yml b/.github/workflows/bump-pr-size-callers.yml index 5e9a272..485d34e 100644 --- a/.github/workflows/bump-pr-size-callers.yml +++ b/.github/workflows/bump-pr-size-callers.yml @@ -101,7 +101,20 @@ jobs: # that run's original (now stale) commit, and the bumper would # force-repin every caller to it. Only act from the current tip — # any newer push has its own queued run that does the bump. - main_tip=$(git ls-remote origin refs/heads/main | cut -f1) + # Don't pipe into `cut`: the pipeline would report cut's status, so a + # failed ls-remote (network blip, remote hiccup) yields an EMPTY + # main_tip that then compares unequal to github.sha and silently + # no-ops the whole fleet bump as if the run were stale. A lookup we + # couldn't perform is not evidence of staleness — fail loudly. + if ! ls_remote=$(git ls-remote origin refs/heads/main); then + echo "::error::Could not look up the current main tip (git ls-remote failed)" + exit 1 + fi + main_tip=${ls_remote%%$'\t'*} + if [[ -z "$main_tip" ]]; then + echo "::error::git ls-remote returned no SHA for refs/heads/main" + exit 1 + fi if [[ "$main_tip" != "$GITHUB_SHA" ]]; then echo "github.sha $GITHUB_SHA is not the current main tip ($main_tip) — stale run/re-run; nothing to bump" exit 0