fix(ci): prevent staging-ci tag failure and chained PR auto-close#900
fix(ci): prevent staging-ci tag failure and chained PR auto-close#900henrypark133 merged 1 commit intostagingfrom
Conversation
- Use fetch-depth: 0 in update-tag to ensure current_head SHA is available even when staging receives new commits during the CI run - Only merge promotion PRs targeting main; leave chained PRs open to prevent delete_branch_on_merge from auto-closing downstream PRs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
Adjusts the staging CI workflow to make the “tested” tag update resilient to new commits arriving during a run, and to prevent the gate from merging “chained” promotion PRs (which can cascade-close downstream PRs via automatic branch deletion).
Changes:
- Update the
update-tagjob checkout tofetch-depth: 0so the previously-capturedcurrent_headcommit object is always present when movingstaging-tested. - Gate merge logic now merges promotion PRs only when the PR base branch is
main, leaving chained PRs open for GitHub’s retargeting behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zmanian
left a comment
There was a problem hiding this comment.
Found one blocking workflow issue here.
- .github/workflows/staging-ci.yml:421-447 now leaves chained promotion PRs open when they do not target
main, butupdate-tagstill force-advancesstaging-testedunconditionally once tests pass. If the upstream main-targeting promotion PR later fails or is closed, these commits have already been marked as processed and can be skipped permanently by later staging runs.staging-testedshould only advance when the batch was actually merged, or it should track the merge result explicitly.
henrypark133
left a comment
There was a problem hiding this comment.
Thanks for the review! I looked into this carefully and I believe the current behavior is correct. Here's why:
The staging-tested tag and the PR diff are decoupled:
staging-testedtag — only used incheck-changesto decide whether to run the CI at all (tests + e2e). It prevents redundant test reruns.- PR creation — controlled by
ahead-check, which comparesorigin/main..origin/staging. This is completely independent of the tag.
So even if the tag advances and a chain later breaks (bottom PR closed), the commits aren't "skipped permanently":
- Next CI run with new commits:
has_changes = true(new commits since tag) ahead-checkstill sees staging ahead of main (those unpromoted commits are still there)- A new promotion PR is created covering all unpromoted commits
The tag just says "we've already tested these commits." Re-running tests on the same code wouldn't help — if the gate failed due to a blocking review, that's tracked as a GitHub issue. Not advancing the tag would cause an infinite loop of re-testing the same commits every hour without new fixes.
…arai#900) - Use fetch-depth: 0 in update-tag to ensure current_head SHA is available even when staging receives new commits during the CI run - Only merge promotion PRs targeting main; leave chained PRs open to prevent delete_branch_on_merge from auto-closing downstream PRs Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…arai#900) - Use fetch-depth: 0 in update-tag to ensure current_head SHA is available even when staging receives new commits during the CI run - Only merge promotion PRs targeting main; leave chained PRs open to prevent delete_branch_on_merge from auto-closing downstream PRs Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Fix update-tag shallow clone: Changed
fetch-depth: 1tofetch-depth: 0in theupdate-tagjob so thecurrent_headSHA (captured bycheck-changes) is always available, even if staging receives new commits during the CI run. Previously failed withfatal: cannot update ref 'refs/tags/staging-tested': trying to write ref with nonexistent object.Only merge promotion PRs targeting main: The gate now checks the PR's base branch before merging. Chained PRs (targeting another promotion branch) are left open instead of merged. This prevents
delete_branch_on_mergefrom auto-deleting the head branch and cascading closures of downstream chained PRs. When the bottom of the chain merges into main, GitHub auto-retargets the next chained PR.Test plan
update-tagsucceedsmainARE still merged when gate passes🤖 Generated with Claude Code