Skip to content

fix: remove racy branch existence check in CLI coverage workflow#76

Merged
rgarcia merged 1 commit intomainfrom
fix/cli-coverage-clone-race
Feb 21, 2026
Merged

fix: remove racy branch existence check in CLI coverage workflow#76
rgarcia merged 1 commit intomainfrom
fix/cli-coverage-clone-race

Conversation

@rgarcia
Copy link
Contributor

@rgarcia rgarcia commented Feb 21, 2026

Summary

  • Replace the two-step git ls-remote + git fetch with a single git fetch that uses its exit code to determine if the branch exists
  • The old approach was racy: the branch could be deleted between the ls-remote and fetch calls (e.g. right after a PR merge), causing the workflow to fail
  • Also adds --state open to the PR existence check in the agent prompt

Test plan

  • Workflow should succeed when cli-coverage-update branch does not exist (creates from main)
  • Workflow should succeed when cli-coverage-update branch exists (checks it out and merges main)

Made with Cursor


Note

Low Risk
Workflow-only changes that improve robustness of git/gh checks without affecting production code paths.

Overview
Fixes a race in the update-cli-coverage GitHub Actions workflow by collapsing the remote-branch existence check into a single git fetch origin cli-coverage-update and branching based on its exit code, avoiding failures if the branch is deleted between separate checks.

Tightens the agent instructions for managing the evergreen PR by only considering open PRs (gh pr list --state open) when deciding whether to update or create one.

Written by Cursor Bugbot for commit 32639df. This will update automatically on new commits. Configure here.

The clone step used `git ls-remote` then `git fetch` as separate
operations, which fails when the branch is deleted between the two
calls (e.g. right after a PR merge). Replace with a single `git fetch`
whose exit code tells us whether the branch exists.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rgarcia rgarcia merged commit b6a60bb into main Feb 21, 2026
5 checks passed
@rgarcia rgarcia deleted the fix/cli-coverage-clone-race branch February 21, 2026 21:43
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