Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Mid-stack PRs miss stack-aware `pull_request` triggers: PRs are created before the stack object exists

Đang mở
#425 0 bình luận 5 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
github, go
Lĩnh vực
api, cli

Hướng nghiên cứu

Bắt đầu từ luồng gh stack submit và tái hiện stack gồm bốn nhánh với workflow pull_request được lọc cho main. Theo dõi thời điểm các PR thành viên được tạo, thời điểm stack được đăng ký và cách quan sát hành vi kích hoạt workflow thông qua các check suite. Hoàn tất khi mọi PR thành viên đều nhận được lần chạy workflow như mong đợi, bao gồm cả các PR ở giữa stack được tạo trước khi stack được đăng ký.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug topic: ci
What happened

On gh stack submit, PRs are created a few seconds before the stack object itself exists. pull_request workflows with a branches: filter are evaluated against each PR's literal base at open time, so mid-stack PRs are filtered out and never dispatched. They are not re-evaluated once the stack is registered, so they permanently show no checks.

This contradicts the documented behaviour in Optimizing CI for stacked pull requests: "A workflow configured to run on pull_request events targeting main runs for every pull request in the stack."

Reproduction
  1. In a repo with the stacks preview enabled, add a workflow with:

    on:
      pull_request:
        branches: [ "main" ]
    
  2. Create a 4-branch stack and gh stack submit.

  3. Observe CI runs only on the bottom PR and the topmost PR. The middle PRs get a check suite with zero runs.

Observed timeline

Stack of 4 (PRs #10–#13, stack #14, stack.base.ref = main, size: 4):

Time (UTC) Event Workflow dispatched
13:24:13 PR #10 opened (7main) yes — literal base is already main
13:24:17 PR #11 opened (87) no — check suite 85146388656, latest_check_runs_count: 0
13:24:21 PR #12 opened (98) no — check suite 85146406327, latest_check_runs_count: 0
13:24:24 PR #13 opened (109) no — first check suite, 0 runs
13:24:26 stack #14 created (GET /repos/{owner}/{repo}/stacks/14created_at)
13:24:31 second check suite on PR #13's head yes — this is the run that appears

The bottom PR runs because its base is literally main, independent of any stack awareness. The top PR runs because its dispatch landed after stack registration at 13:24:26 and got a second check suite. PRs #11 and #12 had their opened events fully processed before the stack existed, were rejected by the branches: [main] filter, and nothing re-dispatched them afterwards.

Reproduced identically on an earlier stack of 3 in the same repo: bottom PR ran, middle skipped, top ran.

Expected behavior

Every PR in the stack is evaluated against stack.base.ref, as documented — either by creating the stack before its PRs, or by re-evaluating pull_request workflow triggers for all member PRs once the stack is registered.

Actual behavior

Only PRs whose trigger evaluation happens after stack registration get stack-aware treatment. Mid-stack PRs are silently left with no checks, which is indistinguishable from "queued" and blocks merge on repos with required checks.

Not a duplicate of
  • #319 — merge refs are healthy here: refs/pull/{10,11,12,13}/merge all exist and point at current commits, and all four PRs report mergeable: true.
  • #379 — that concerns paths filters being selected from the topmost PR. This is branches filters and a registration-ordering race; the affected PRs get a check suite with zero runs rather than a workflow selected from the wrong PR.
Workaround

Remove the branches: filter from the pull_request trigger so CI runs regardless of base.

Ngôn ngữ chính
Go
Star
1.5k
Fork
73
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
7

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/gh-stack

Tất cả issue của github/gh-stack

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.