Skip to content

fix(ci): count branch-filtered lanes on native-stack PRs in PR Readiness - #31597

Merged
bolichen97 merged 1 commit into
mainfrom
fix/readiness-native-stack-lanes
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/readiness-native-stack-lanes

Conversation

@tim-finnigan

@tim-finnigan tim-finnigan commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A PR in the middle of a GitHub-native stack gets a PR Readiness verdict that counts the CI, Fast Gate, Build and Internal Content Scan runs it actually has, so a red CI there cannot read readiness: passed.

PR Readiness treats every PR whose base is not main as 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's pull_request workflows on every PR in the stack (docs). #6828 sat mid-stack in stack 719639 with base cursor/agentcore-3-aws-1b02, and its head 4faaf420efc4 carries 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, and PR Readiness is the one required status.

Not a goal

What changed (motivation → approach → change)

A mid-stack PR in a native stack on main now has its CI, Fast Gate, Build and Internal Content Scan results counted by PR Readiness, the same as a PR opened straight against main. 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 as stack.base.ref on the PR. The context step already reads repos/{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. The internal-content-scan-gate.yml header comment that said a stacked PR never starts the scan now names hand-made stacks only, and the carve-out paragraph in docs/ci/ci-and-reviews.md describes the trunk rule and CodeQL's exception.

Backwards compatibility

Compatible: a PR outside a native stack has no stack object, 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.py runs the real verdict step against stubbed state:

  • a mid-stack PR (base feat/lower-layer, trunk main) with red CI reads failure / readiness: action required;
  • the same PR, all green, lists CI, Fast Gate, Build and Internal Content Scan as passed and CodeQL as not eligible;
  • a hand-made stack (no trunk) with a red CI run still skips all five lanes and reads success;
  • a native stack on release/1.2 keeps the four lanes skipped.

The new tests live in their own module because test/test_pr_readiness_evaluate.py is 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 backend selected 12 files, 492 passed. test_pr_readiness_evaluate.py and test_ai_review_workflows.py: 206 passed.

Manual verification

gh api repos/kirodotdev/KiroCrew/pulls/6828 returns stack: {id: 719639, base: {ref: "main"}, position: 4, size: 6}, so .stack.base.ref is main for a mid-stack PR. A PR outside a stack has no stack key, 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@tim-finnigan
tim-finnigan requested review from a team and KiroCrewCaptain as code owners November 6, 2026 17:38
@tim-finnigan
tim-finnigan requested a review from Zedmor November 6, 2026 17:38
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@tim-finnigan
tim-finnigan force-pushed the fix/readiness-native-stack-lanes branch from 2c98dff to c9cc7bb Compare November 6, 2026 17:59
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b9748eb567ee7a16e281909a10972c661b04fd0e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 ships

Inventory (5 items) — 5 justified

Intent: 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.

  1. On a mid-stack PR in a native stack on main, CI, Fast Gate, Build and Internal Content Scan now count toward the verdict, so a red CI blocks — justified
  2. CodeQL is still skipped on any PR whose base is not main, now decided by its own check — justified
  3. The readiness context step now reads the stack trunk from the same pulls/{n} response, exposed as a new stack_trunk step output — justified
  4. The header comment in internal-content-scan-gate.yml and the carve-out paragraph in ci-and-reviews.md now describe the trunk rule — justified
  5. New test module pins the native-stack case, the hand-made-stack case and the release-trunk case — justified

[FIRST-PRINCIPLES-REVIEWED] b9748eb

Description read

[DESCRIPTION-READ] 0dbb1ec359dca252fa4f5729f26ed9bc9ce7c3c835314d151e5d0b9dfe1177f4

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of b9748eb567ee7a16e281909a10972c661b04fd0e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The premise that GitHub runs the trunk's workflows on mid-stack PRs comes from one stack, feat: AgentCore Workload Gateway integration #6828. If a mid-stack head ever lacks those runs, the counted lanes read (not started) and the verdict stays pending. The fix is a revert, so this is a note, not a block.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision b9748eb567ee7a16e281909a10972c661b04fd0e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of b9748eb567ee7a16e281909a10972c661b04fd0e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b9748eb

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b9748eb567ee7a16e281909a10972c661b04fd0e false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed b9748eb567ee7a16e281909a10972c661b04fd0e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b9748eb

Verdict parsed from the review's SHA-scoped output markers for commit b9748eb567ee7a16e281909a10972c661b04fd0e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b9748eb567ee7a16e281909a10972c661b04fd0e false-positive: <reason, 20 to 500 characters>

@tim-finnigan

Copy link
Copy Markdown
Contributor Author

Backend Tests (3.12, 2) and Backend Tests (Windows) (2) fail only on test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget, which this PR does not touch (it changes no file under src/). That is main's red, tracked in #31648 with the fix in #31625. Waiting for it to merge, then rebasing.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@tim-finnigan
tim-finnigan force-pushed the fix/readiness-native-stack-lanes branch from c9cc7bb to 0b1067d Compare November 6, 2026 21:29
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 6, 2026
@tim-finnigan
tim-finnigan force-pushed the fix/readiness-native-stack-lanes branch from 0b1067d to 31060da Compare November 6, 2026 22:04
@tim-finnigan

tim-finnigan commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=7818d10f0bb8 docs/ci/ci-and-reviews.md:4216 carve-out paragraph contradicts the native-stack rule

fixed in 31060da: the carve-out paragraph now says the branch-filtered lanes are judged against the native-stack trunk when the PR is in a native stack and against its own base otherwise, so a native stack on main counts CI, Fast Gate, Build and Internal Content Scan, a hand-made stack skips them, and CodeQL stays judged against the PR's own base.

@tim-finnigan

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in .github/workflows/pr-readiness.yml, docs/ci/ci-and-reviews.md since this head went green (7c364bc -> b9748eb parent); CI re-running. Three Windows jobs on the old head had sat queued since 22:09 UTC and were cancelled.

@tim-finnigan
tim-finnigan force-pushed the fix/readiness-native-stack-lanes branch from 31060da to b9748eb Compare November 7, 2026 00:56
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 7, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bolichen97
bolichen97 merged commit 305c221 into main Nov 7, 2026
97 of 106 checks passed
@bolichen97
bolichen97 deleted the fix/readiness-native-stack-lanes branch November 7, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(readiness): native-stack PRs drop CI, Fast Gate, Build and Internal Content Scan from the verdict although those lanes run

2 participants