Repository navigation
fix(ci): count branch-filtered lanes on native-stack PRs in PR Readiness - #31597
Conversation
2c98dff to
c9cc7bb
Compare
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This fixes a linked issue (#31180) at the right level. Lane eligibility was judged against the wrong branch (the PR's own base instead of the stack's trunk), and the change corrects that one comparison without adding an API call. What this change shipsInventory (5 items) — 5 justifiedIntent: let a mid-stack PR in a GitHub-native stack get a readiness verdict that counts the CI, Fast Gate, Build and Internal Content Scan runs it actually has. FIX.
[FIRST-PRINCIPLES-REVIEWED] b9748eb Description read[DESCRIPTION-READ] 0dbb1ec359dca252fa4f5729f26ed9bc9ce7c3c835314d151e5d0b9dfe1177f4 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the trunk is read from the REST call the step already makes, and a PR outside a stack still gets the same verdict as before. Notes
[DESIGN-REVIEWED] b9748eb Description read[DESCRIPTION-READ] 74d67aa89ca6acadbd94a08d4ad000c5b05c69cbc40a93b1d2cec86fbdb7933c That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
Backend Tests (3.12, 2) and Backend Tests (Windows) (2) fail only on |
c9cc7bb to
0b1067d
Compare
0b1067d to
31060da
Compare
|
self-added: no
|
31060da to
b9748eb
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed at b9748eb. Thank you, this closes a real readiness gap: GitHub runs the trunk's pull_request workflows on every PR in a native stack, so a mid-stack PR's red CI was skipped and could read readiness: passed. The aggregator now judges the branches: filter against REST stack.base.ref when the PR is in a native stack and against its own base otherwise, and keeps CodeQL on the PR's own base since default setup does not follow the stack. The tests cover a red CI mid-stack, a hand-made stack and a native stack on a release trunk.
I read every .github/ hunk: no new secret or token use, no permissions: change, no new trigger, and no download or run of PR code; the added call is one gh api read of the same PR the step already read. The docs match.
Gates at this head: all 97 checks pass with none red or pending, there is no regex in product code, and no change request is open.
Problem / Motivation
Goal: A PR in the middle of a GitHub-native stack gets a
PR Readinessverdict that counts the CI, Fast Gate, Build and Internal Content Scan runs it actually has, so a red CI there cannot readreadiness: passed.PR Readinesstreats every PR whose base is notmainas stacked and drops CI, Fast Gate, Build, CodeQL and Internal Content Scan from the verdict as "(only runs on PRs to main)". That holds for a hand-made stack. It does not hold for a native stack: GitHub runs the trunk'spull_requestworkflows on every PR in the stack (docs). #6828 sat mid-stack in stack 719639 with basecursor/agentcore-3-aws-1b02, and its head4faaf420efc4carries CI, Fast Gate, Build and Internal Content Scan Gate runs, while readiness listed all four as not eligible.Why it matters
Native stacks are enabled on this repo and used. On a mid-stack PR the lanes run but the verdict ignores them, so a red CI or Fast Gate can sit under a green
readiness: passed, andPR Readinessis the one required status.Not a goal
mainbase.What changed (motivation → approach → change)
A mid-stack PR in a native stack on
mainnow has its CI, Fast Gate, Build and Internal Content Scan results counted byPR Readiness, the same as a PR opened straight againstmain. A hand-made stack (base set to a feature branch, no stack linked) and a native stack on a release trunk behave as before.The carve-out compared the PR's own base with the default branch. What decides whether a
branches: [main]lane starts on a native stack is the stack's trunk, which REST returns asstack.base.refon the PR. The context step already readsrepos/{repo}/pulls/{n}for the author; it now reads the trunk from the same response, so no API call is added. The verdict judges the four branch-filtered lanes against the trunk when there is one and against the PR's base otherwise. CodeQL keeps its own check against the PR's base. Theinternal-content-scan-gate.ymlheader comment that said a stacked PR never starts the scan now names hand-made stacks only, and the carve-out paragraph indocs/ci/ci-and-reviews.mddescribes the trunk rule and CodeQL's exception.Backwards compatibility
Compatible: a PR outside a native stack has no
stackobject, so the trunk is empty and every lane is decided by the PR's base exactly as today.Removes nothing: the change adds lanes to the verdict for one PR shape and drops none.
Tests
test/test_pr_readiness_native_stack.pyruns the real verdict step against stubbed state:feat/lower-layer, trunkmain) with red CI readsfailure/readiness: action required;success;release/1.2keeps the four lanes skipped.The new tests live in their own module because
test/test_pr_readiness_evaluate.pyis at the 2,000-line cap.Proof: PROVEN test/test_pr_readiness_native_stack.py::TestNativeStackLanesCount::test_red_ci_on_a_mid_stack_pr_blocks, test/test_pr_readiness_native_stack.py::TestNativeStackLanesCount::test_branch_filtered_lanes_are_evaluated_and_codeql_stays_ineligible (head b9748eb)
The two carve-out tests pass with and without the fix; they pin the unchanged behaviour.
Related tests:
run_scoped_tests.py --surface backendselected 12 files, 492 passed.test_pr_readiness_evaluate.pyandtest_ai_review_workflows.py: 206 passed.Manual verification
gh api repos/kirodotdev/KiroCrew/pulls/6828returnsstack: {id: 719639, base: {ref: "main"}, position: 4, size: 6}, so.stack.base.refismainfor a mid-stack PR. A PR outside a stack has nostackkey, which// ""turns into an empty trunk. The live path runs on the next mid-stack PR's readiness evaluation.Related Issues
Closes #31180
Sibling sweep
Swept: git grep -nE 'only runs on PRs to|BASE_REF.*DEFAULT_BRANCH|base.ref.*default_branch' -- .github scripts src/kiro_crew/builtin_skills, and git grep -n -i stacked -- .github/workflows
Sibling: .github/workflows/pr-readiness.yml -- changed here
Sibling: .github/workflows/internal-content-scan-gate.yml:10 -- changed here
Sibling: docs/ci/ci-and-reviews.md -- changed here
Sibling: .github/workflows/issue-gate.yml:67 -- not affected -- reads the default branch on purpose, independent of stack shape
Pattern harvest
Not generalizable: the defect is one assumption, that a
branches:filter is matched against the PR's own base, and it lived in one carve-out.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)