Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@

## Proposed

- Skip target-repository old-head Actions inventory when review execution is
centralized. Same-repository stale-run cleanup remains enabled; central
review lifecycle is handled in the configured dispatch repository, avoiding
an unauthoritative API read that can exhaust the cross-repository App quota.

- Run Python Security and Agent Review Runtime Quality CI for stacked pull
requests by removing their pull-request base-branch filters. Extend the
permanent stacked-workflow contract so all four owner review workflows
Expand Down
35 changes: 35 additions & 0 deletions docs/doctoring/central-review-target-inventory-suppression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Central review target-inventory suppression

Decision date: **2026-09-07**

## Problem

When the trusted reviewer is hosted centrally, target-repository old-head
workflow runs are not the authority for the central current-head verdict.
Enumerating those target runs before dispatch consumes the cross-repository
Actions credential and can exhaust its App quota before useful review work
starts.

## Decision

Compare the configured review dispatch repository with the target repository.
If they differ, do not enumerate or cancel target old-head runs from this
decision path. The central reviewer owns its own run lifecycle in the dispatch
repository. If they are the same repository, retain existing stale-run cleanup.

## Failure scenes

- Central review of a target repository: no target Actions inventory read occurs.
- Same-repository review: stale old-head runs are still cancelled.
- Repository name casing differs: case-insensitive identity prevents accidental
cross-repository classification.

## Evidence and follow-up

RED commit: `08a16caa4fdb0d0d86c44bb8cd7aed611beaab7b`.
Fresh exact-head hosted checks and independent review remain required.

## Reference

GitHub. (2026). *REST API endpoints for workflow runs*.
https://docs.github.com/en/rest/actions/workflow-runs
15 changes: 15 additions & 0 deletions docs/product-technical-gap-baseline.md
Original file line number Diff line number Diff line change
Expand Up @@ -3401,3 +3401,18 @@ same name in another file can carry the opposite safety property.**
workflows at exact head `e2204eeb1ec2789ff791036140ba1672995d25f5`;
RED commit `890bac2f69ff1a51f774ddf5d6c5d819afed4ac9`; fresh exact-head
hosted checks remain required.


### Central review target-inventory suppression

- **Status:** Proposed
- **Owner:** `ContextualWisdomLab/.github`
- **Problem:** Before dispatching a central current-head review, the scheduler
enumerated target-repository old-head Actions runs that are not central
admission authority, spending the cross-repository App quota.
- **Action:** Skip only that target enumeration when the configured review
dispatch repository differs from the target; preserve same-repository
stale-run cleanup.
- **Evidence:** RED commit
`08a16caa4fdb0d0d86c44bb8cd7aed611beaab7b`; fresh exact-head hosted checks
remain required before integration.
6 changes: 5 additions & 1 deletion scripts/ci/pr_review_merge_scheduler_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,11 @@ def inspect_pr(
pass
run(["gh", "pr", "close", str(number), "--repo", repo])
return Decision(number, "close_empty", "base 대비 실제 변경 0건")
cancel_stale_pr_runs(repo, pr, dry_run=dry_run)
# A central reviewer owns run lifecycle in its dispatch repository.
# Target old-head runs are not admission authority, and enumerating them
# spends the cross-repository installation quota before current-head review.
if repository_dispatch_target(repo).casefold() == repo.casefold():
cancel_stale_pr_runs(repo, pr, dry_run=dry_run)
if base_ref != base_branch:
# Stacked/cascade PR (base is another feature branch). Org required
# workflows are only injected for default-branch-target PRs, so these
Expand Down
21 changes: 21 additions & 0 deletions tests/test_pr_review_merge_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10866,3 +10866,24 @@ def test_withheld_mutation_guidance_uses_recorded_reason_after_environment_chang
assert "workflow GITHUB_TOKEN" in "\n".join(
sched.head_mutation_credential_upgrade_summary([decision])
)


def test_central_dispatch_skips_non_authoritative_target_actions_inventory(
monkeypatch,
):
"""Central review dispatch must not spend App quota on target old-head runs."""
monkeypatch.setenv(
"SCHEDULER_REQUIRED_WORKFLOW_REPOSITORY",
"ContextualWisdomLab/.github",
)
monkeypatch.setattr(
sched,
"cancel_stale_pr_runs",
lambda *args, **kwargs: pytest.fail(
"central dispatch must not enumerate target Actions runs"
),
)

decision = inspect(make_pr(baseRefName="feature-base"), trigger_reviews=False)

assert decision.action == "skip"
Loading