Skip to content

Serialize desktop auto-releases and wait for prior Codemagic build#5438

Merged
kodjima33 merged 1 commit intomainfrom
codex/serialize-desktop-releases
Mar 8, 2026
Merged

Serialize desktop auto-releases and wait for prior Codemagic build#5438
kodjima33 merged 1 commit intomainfrom
codex/serialize-desktop-releases

Conversation

@kodjima33
Copy link
Copy Markdown
Collaborator

Adds workflow concurrency and waits for prior 'Release OMI Desktop (Swift)' check to complete before creating the next tag, preventing release/tag pile-up.

@kodjima33 kodjima33 merged commit 30931f3 into main Mar 8, 2026
2 checks passed
@kodjima33 kodjima33 deleted the codex/serialize-desktop-releases branch March 8, 2026 00:02
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 8, 2026

Greptile Summary

This PR serializes the Auto Release Desktop on Main workflow by adding a concurrency group (queue-mode, not cancel) and a new polling step that waits up to 120 minutes for the previous "Release OMI Desktop (Swift)" Codemagic check to complete before creating the next tag. The intent is to prevent release/tag pile-up when rapid pushes hit main.

The overall approach is correct and addresses a real operational problem. However, there are three issues worth addressing:

  • Critical: missing API pagination — the gh api call for check-runs returns only the first 30 results by default. If the tagged commit has ≥ 30 check runs, "Release OMI Desktop (Swift)" may never appear in the response, causing STATUS to always be empty and the step to immediately exit 0 (skipping the wait entirely).
  • Design gap: conclusion not checked — the step exits successfully whether the previous build succeeded, failed, or was cancelled. If a prior release build fails, the workflow still proceeds to tag a new release. It is worth deciding whether a failed prior build should block the next release.
  • Minor: two separate API calls per iteration — fetching STATUS and CONCLUSION with separate requests doubles the API call cost; both can be retrieved in a single request.

Confidence Score: 3/5

  • Safe to merge with caveats — the core serialization logic works, but a missing pagination flag can silently bypass the entire wait under common conditions.
  • The concurrency group is correct and the polling loop structure is sound. However, the lack of per_page=100 or --paginate on the check-runs API call is a real logic bug: for any busy commit with ≥ 30 check runs the wait step will always see an empty STATUS and exit immediately, rendering the entire feature ineffective. The absence of a conclusion check is a design decision that should be clarified or addressed. The dual API calls are a minor efficiency issue.
  • .github/workflows/desktop_auto_release.yml — specifically the "Wait for previous desktop release build" step around lines 46–63 for pagination handling and conclusion validation.

Last reviewed commit: e052a35

Comment on lines +46 to +49
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .status' | head -n1 || true)
CONCLUSION=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .conclusion' | head -n1 || true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing --paginate may silently skip the wait

The gh api command for check-runs returns only the first page (30 items by default). If the target commit has more than 30 check runs, "Release OMI Desktop (Swift)" may not appear in the response. In that case STATUS will be empty, the [ -z "$STATUS" ] branch at line 51 fires, and the workflow exits 0 immediately — skipping the intended wait entirely and potentially creating a new tag before the previous build has finished.

Add --paginate to both calls (or pass per_page=100 as a query param) to ensure all check runs are considered:

Suggested change
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .status' | head -n1 || true)
CONCLUSION=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .conclusion' | head -n1 || true)
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs?per_page=100" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .status' | head -n1 || true)
CONCLUSION=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs?per_page=100" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .conclusion' | head -n1 || true)

Comment on lines +58 to +60
if [ "$STATUS" = "completed" ]; then
exit 0
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No check on build conclusion — proceeds even on failure

The step exits 0 (success) whenever STATUS == "completed", regardless of whether CONCLUSION is "success", "failure", or "cancelled". This means a new release will be created even if the previous Codemagic build failed or was explicitly cancelled.

If the intent is to only proceed when the prior release succeeded, check the conclusion:

Suggested change
if [ "$STATUS" = "completed" ]; then
exit 0
fi
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" != "success" ]; then
echo "Previous release build finished with conclusion: $CONCLUSION. Aborting."
exit 1
fi
exit 0
fi

If intentionally ignoring the conclusion (e.g. "just wait for it to finish, whatever the outcome"), a comment explaining the rationale would help future maintainers.

Comment on lines +46 to +63
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .status' | head -n1 || true)
CONCLUSION=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .conclusion' | head -n1 || true)

if [ -z "$STATUS" ]; then
echo "No Codemagic release check found for $LATEST yet; continuing."
exit 0
fi

echo "Previous release build status: $STATUS (${CONCLUSION:-n/a})"

if [ "$STATUS" = "completed" ]; then
exit 0
fi

sleep 60
done
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two separate API calls per loop iteration — consolidate for efficiency

STATUS and CONCLUSION are fetched with two independent gh api calls. This doubles the rate-limit cost and introduces a small window where a build could transition from in_progress to completed between the two requests, creating an inconsistent pair. Both fields can be retrieved in a single request by selecting them in one jq expression:

Suggested change
STATUS=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .status' | head -n1 || true)
CONCLUSION=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | .conclusion' | head -n1 || true)
if [ -z "$STATUS" ]; then
echo "No Codemagic release check found for $LATEST yet; continuing."
exit 0
fi
echo "Previous release build status: $STATUS (${CONCLUSION:-n/a})"
if [ "$STATUS" = "completed" ]; then
exit 0
fi
sleep 60
done
for i in {1..120}; do
RESULT=$(gh api "repos/${{ github.repository }}/commits/$SHA/check-runs?per_page=100" \
--jq '.check_runs[] | select(.name=="Release OMI Desktop (Swift)") | "\(.status) \(.conclusion)"' | head -n1 || true)
STATUS=$(echo "$RESULT" | awk '{print $1}')
CONCLUSION=$(echo "$RESULT" | awk '{print $2}')
if [ -z "$STATUS" ]; then
echo "No Codemagic release check found for $LATEST yet; continuing."
exit 0
fi
echo "Previous release build status: $STATUS (${CONCLUSION:-n/a})"
if [ "$STATUS" = "completed" ]; then
exit 0
fi
sleep 60
done

Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…asedHardware#5438)

Adds workflow concurrency and waits for prior 'Release OMI Desktop
(Swift)' check to complete before creating the next tag, preventing
release/tag pile-up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant