You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix the two runtime failure modes causing the 14.5% failure rate in dev-lead.yml: (1) checkout_pr_in_worktree crashing when a PR is merged and its branch deleted before checkout, and (2) push_with_merge_guard failing the workflow when a push is rejected due to concurrent runs.
Root Cause Analysis
From workflow run logs, two distinct runtime failures are responsible for the failure rate:
When a PR is merged and its branch deleted, but a dev-lead event (e.g., a bot review comment) was already queued, checkout_pr_in_worktree calls gh pr checkout which fails trying to fetch the deleted branch
hold_auto_merge only guards the race when auto-merge is enabled; when auto-merge is already OFF, it returns early without checking if the PR is open
When two dev-lead runs both commit to the same branch, the second push is rejected with "fetch first"; push_with_merge_guard treats this as a hard failure (returns 1) when PR is still open
Implementation Checklist
scripts/lib/pr-worktree.sh: in checkout_pr_in_worktree, catch gh pr checkout failures and check PR state β exit 0 cleanly if PR is closed/merged
scripts/lib/auto-merge.sh: in push_with_merge_guard, detect "fetch first" rejection and attempt git pull --rebase + retry; if retry fails, exit 0 (concurrent run handled it)
Tests to Write
tests/dev-lead/unit/test_pr_worktree.bats: new test β checkout exits 0 when gh pr checkout fails and PR is closed/merged
tests/dev-lead/unit/test_auto_merge.bats: new test β push_with_merge_guard retries with pull-rebase on fetch-first rejection and succeeds
tests/dev-lead/unit/test_auto_merge.bats: new test β push_with_merge_guard exits 0 cleanly when rebase/retry also fails (concurrent run scenario)
Test Command
bash scripts/dev-lead-lint.sh
(Full bats tests require sudo apt-get install bats which isn't available locally; the CI bats suite at .github/workflows/ci.yml covers the unit tests.)
β Auto-resolved by Fleet Monitor. This workflow's failure rate has been below the 10% threshold (or the workflow was removed) since 2026-06-04 (41 days) β the monitor stopped flagging it. Closing. It will reopen automatically if the workflow crosses the threshold again.
Activity
don-petry commentedon Jun 9, 2026
don-petry commentedon Jun 9, 2026
Dev-Lead Implementation Plan
Issue: #341 β [Fleet Monitor] petry-projects/.github-private β dev-lead.yml
Scope
Fix the two runtime failure modes causing the 14.5% failure rate in
dev-lead.yml: (1)checkout_pr_in_worktreecrashing when a PR is merged and its branch deleted before checkout, and (2)push_with_merge_guardfailing the workflow when a push is rejected due to concurrent runs.Root Cause Analysis
From workflow run logs, two distinct runtime failures are responsible for the failure rate:
1. Closed/merged PR checkout failure (
scripts/lib/pr-worktree.sh)fatal: couldn't find remote ref refs/heads/<branch>checkout_pr_in_worktreecallsgh pr checkoutwhich fails trying to fetch the deleted branchhold_auto_mergeonly guards the race when auto-merge is enabled; when auto-merge is already OFF, it returns early without checking if the PR is open2. Concurrent push rejection (
scripts/lib/auto-merge.sh)Updates were rejected because the remote contains work that you do not have locally.push_with_merge_guardtreats this as a hard failure (returns 1) when PR is still openImplementation Checklist
scripts/lib/pr-worktree.sh: incheckout_pr_in_worktree, catchgh pr checkoutfailures and check PR state β exit 0 cleanly if PR is closed/mergedscripts/lib/auto-merge.sh: inpush_with_merge_guard, detect "fetch first" rejection and attemptgit pull --rebase+ retry; if retry fails, exit 0 (concurrent run handled it)Tests to Write
tests/dev-lead/unit/test_pr_worktree.bats: new test β checkout exits 0 whengh pr checkoutfails and PR is closed/mergedtests/dev-lead/unit/test_auto_merge.bats: new test βpush_with_merge_guardretries with pull-rebase on fetch-first rejection and succeedstests/dev-lead/unit/test_auto_merge.bats: new test βpush_with_merge_guardexits 0 cleanly when rebase/retry also fails (concurrent run scenario)Test Command
bash scripts/dev-lead-lint.sh(Full bats tests require
sudo apt-get install batswhich isn't available locally; the CI bats suite at.github/workflows/ci.ymlcovers the unit tests.)don-petry commentedon Jul 15, 2026
β Auto-resolved by Fleet Monitor. This workflow's failure rate has been below the 10% threshold (or the workflow was removed) since 2026-06-04 (41 days) β the monitor stopped flagging it. Closing. It will reopen automatically if the workflow crosses the threshold again.