Repository navigation
Description
Summary
A dev-lead run can fail with a red ✗ on git push when its PR is auto-merged out from under it mid-run. The PR's branch is deleted on merge, so the straggler push is rejected:
! [remote rejected] fix/... -> fix/... (cannot lock ref 'refs/heads/fix/...':
unable to resolve reference 'refs/heads/fix/...')
##[error]git push failed — check remote access and branch permissions
Observed in run 27078382804: the review-changes run committed at 00:54:45 — 1 second after PR #449 auto-merged (00:54:44) and its branch was deleted.
Root cause
Two recently-landed features interact badly:
- feat(dev-lead): enable auto-merge (squash) by default on every PR it touches #447 — auto-merge (squash) enabled by default on every PR dev-lead touches.
- GitHub's auto-merge is asynchronous and is not gated by the workflow concurrency lane. So while dev-lead is mid-edit on a PR, a review approval landing can satisfy branch protection and make GitHub merge + delete the branch immediately — even though a dev-lead run still holds that branch and will push to it.
Per-PR concurrency serialization (#450) prevents two dev-lead runs from fighting, but it cannot stop GitHub's auto-merge, because the merge is not a dev-lead run.
Fix
- Hold auto-merge OFF while dev-lead works a PR. Disable auto-merge at the start of any PR-modifying run; restore it on the way out via an
EXITtrap (so it is restored on success, error, or timeout). This prevents a mid-flight approval from merging the branch out from under the agent. Auto-merge is only restored if the run disabled it — it never newly enables auto-merge on a PR that did not have it. - Push defensively. If
git pushis still rejected because the PR was merged/closed (branch deleted) mid-run, treat it as a benign no-op (::notice::, exit 0) instead of a hard failure. - Lock same-PR serialization with a test. The existing
test_concurrency_config.shstill asserted the pre-fix(dev-lead): per-issue/per-PR concurrency lanes so issue pickups aren't cancelled #450 repo-wide group and was stale (failing againstmain); update it to assert the per-PR/per-issue lanes +cancel-in-progress: falsethat serialize same-PR runs, on both the inline and reusable workflows.
Backstop for the rare hard-kill (SIGKILL escapes the trap): the existing enable-auto-merge-on-bot-approval intent re-enables auto-merge on the next approval.
Update — also fix: dev-lead resolves review threads without replying, and leaves fixed bot threads open
While validating this PR, two related defects in dev-lead's review-thread handling surfaced (they're why a Copilot thread on this very PR stayed open and blocked re-review):
- Silent resolves. The review prompts told the engine to resolve a fixed thread but never to reply with what it changed. Reviewers got a resolved thread with no explanation of the fix.
- Trigger-gated resolution.
fix-reviews.mdonly resolved threads whose author matched${TRIGGERING_REVIEWER}. So a thread fixed during a different reviewer's run (e.g. a Copilot thread addressed in a Codex-triggered run) was never resolved — and pr-review won't approve until all comments are resolved, so the PR stalls.
Fix (prompts): the three review prompts (fix-reviews, review-changes, fix-bot-comment) now instruct the engine to, for every thread it fixes, post a reply naming the specific file/function changed and how it addresses the concern (addPullRequestReviewThreadReply, body passed as a GraphQL variable), then resolve. fix-reviews now resolves every bot thread it fixed regardless of which reviewer triggered the run (human threads stay gated to the trigger). The rubber-duck phase verifies each fixed thread was replied-to and resolved. test_prompt_coverage.sh asserts these instructions are present.
Activity
fix(dev-lead): reply with the specific fix on each review thread, the…
fix(dev-lead): restore auto-merge against the PR's current head, re-f…
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
fix(dev-lead): reply with the specific fix on each review thread, the…
fix(dev-lead): restore auto-merge against the PR's current head, re-f…
fix(dev-lead): expose author.__typename in the review-changes thread …
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
23 remaining items
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
feat: implement advisory bot review gate in pr-review agent (#458)
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
fix(dev-lead): hold auto-merge while working a PR + push defensively (#…
feat: implement advisory bot review gate in pr-review agent (#458)
feat: implement advisory bot review gate in pr-review agent (#458)
feat: implement advisory bot review gate in pr-review agent (#458)