ci(release): guard run-ID polling against transient gh failures#1007
Merged
Conversation
Follow-up to #1005 (Sourcery review). The monotonic run-ID polling loops compared `$CANDIDATE` numerically without validating it. If `gh run list` fails transiently or returns an unexpected payload, CANDIDATE can be empty or non-numeric and `[ "$CANDIDATE" -gt "$BEFORE_ID" ]` errors with "integer expression expected" — the exact kind of flake this logic was meant to absorb. - Tolerate transient `gh` failures mid-poll (`2>/dev/null || echo ""`) and skip any iteration where CANDIDATE is empty/non-numeric instead of erroring. - Validate BEFORE_ID up front and fail with a clear message (before dispatch) if it can't be read. - Include before/last-seen IDs and wait duration in the failure message to make race/misconfig diagnosis easier. Applied to both the desktop (release-cli-dd.yml) and packaging (release-model.yml) trigger jobs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="528-531" />
<code_context>
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
- --limit 1 --json databaseId --jq '.[0].databaseId // 0')
+ --limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "")
+ case "$BEFORE_ID" in
+ ''|*[!0-9]*)
+ echo "::error::Could not read the pre-dispatch run ID for release-cli-dd.yml"
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Using `|| echo ""` inside command substitution can silently swallow useful error output from `gh run list`.
Because `BEFORE_ID=$(gh run list ... 2>/dev/null || echo "")` treats any non‑zero exit from `gh` as an empty string, you lose potentially useful error diagnostics from `gh`. Since you already validate `$BEFORE_ID` via the numeric `case`, you can drop `2>/dev/null` and `|| echo ""` so that `gh`’s stderr reaches the workflow logs and the `case` handles invalid or missing IDs.
```suggestion
BEFORE_ID=$(gh run list \
--repo docker/inference-engine-llama.cpp \
--workflow release-cli-dd.yml \
--limit 1 --json databaseId --jq '.[0].databaseId // 0')
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
528
to
+531
| BEFORE_ID=$(gh run list \ | ||
| --repo docker/inference-engine-llama.cpp \ | ||
| --workflow release-cli-dd.yml \ | ||
| --limit 1 --json databaseId --jq '.[0].databaseId // 0') | ||
| --limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "") |
Contributor
There was a problem hiding this comment.
suggestion (bug_risk): Using || echo "" inside command substitution can silently swallow useful error output from gh run list.
Because BEFORE_ID=$(gh run list ... 2>/dev/null || echo "") treats any non‑zero exit from gh as an empty string, you lose potentially useful error diagnostics from gh. Since you already validate $BEFORE_ID via the numeric case, you can drop 2>/dev/null and || echo "" so that gh’s stderr reaches the workflow logs and the case handles invalid or missing IDs.
Suggested change
| BEFORE_ID=$(gh run list \ | |
| --repo docker/inference-engine-llama.cpp \ | |
| --workflow release-cli-dd.yml \ | |
| --limit 1 --json databaseId --jq '.[0].databaseId // 0') | |
| --limit 1 --json databaseId --jq '.[0].databaseId // 0' 2>/dev/null || echo "") | |
| BEFORE_ID=$(gh run list \ | |
| --repo docker/inference-engine-llama.cpp \ | |
| --workflow release-cli-dd.yml \ | |
| --limit 1 --json databaseId --jq '.[0].databaseId // 0') |
ericcurtin
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1005, addressing the Sourcery review
bug_riskcomment.Problem
The monotonic run-ID polling loops added in #1005 compare
$CANDIDATEnumerically without validating it:The
// 0only covers an empty result array. Ifgh run listitself fails transiently (network/auth) or returns an unexpected payload,CANDIDATEcan be empty or non-numeric and[ "$CANDIDATE" -gt "$BEFORE_ID" ]errors withinteger expression expected— the exact kind of transient flake this logic was meant to absorb.Changes
ghfailures mid-poll (2>/dev/null || echo "") and skip any iteration whereCANDIDATEis empty/non-numeric, instead of erroring on the comparison.BEFORE_IDup front and fail with a clear message before dispatch if it can't be read.Applied to both trigger jobs: desktop (
release-cli-dd.yml) and packaging (release-model.yml).Not included (noted for later)
Sourcery also suggested extracting the duplicated trigger-and-wait logic into a shared composite action/script. That's a larger refactor and left out of this focused fix.
Opened as draft for review.
🤖 Generated with Claude Code