Skip to content

feat: count pushes after a blocked head for the seam trigger - #24520

Merged
iamwhatever merged 1 commit into
mainfrom
feat/blocked-push-seam-trigger
Oct 27, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/blocked-push-seam-trigger

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A pull request that keeps getting blocked is told to change its approach after the 3rd blocked push, whether or not its author wrote any disposition marker.

The D5 seam rule counts only writer <!-- ai-review-disposition --> comments. Replaying the shipped functions on the 15 PRs with 10+ review loops showed that 10 of them have no usable marker, so the rule could not fire on them (they hold 148 of the 218 loops). Authors answered in plain text, or a human requested changes by review.

Why it matters

The spiral PRs are 51.1% of all review loops in the latest-150 study. A trigger that reads pushes instead of bookkeeping reaches every one of them.

Not a goal

  • Turning on enforcement. SWEEP_ENFORCED stays False; nothing newly fails a PR's checks.
  • A change to AGENTS.md, codex-review.yml or any lane prompt.
  • A new flag or any new text in SKILL.md (it is near its 56,000-byte budget). The prose is in references/seam-protocol.md.
  • Counting rebases, cancelled or timed-out lanes, or red test shards.

What changed (motivation → approach → change)

The marker count stays first. Only when it finds no seam, the PR's own history is counted.

  • _review_contract.blocked_push_count(repo, number, run): reads issues/{n}/timeline and each earlier head's check runs. A push counts once when the head it replaced had a failed lane check run (Opus, GPT, Design, UX, First Principles) or a CHANGES_REQUESTED review. GET only; run is injected, so tests need no network. It returns None when GitHub cannot be read, never 0.
  • pr_findings.py --rounds: 3 such pushes print SEAM REPEAT (pr-level) and exit 30; 5 print SEAM LIMIT (pr-level). A resolution: line in a disposition restarts the count from that round's head.
  • sweep_check.py: the same count feeds _seam_problems (existing finding text, "push of this PR after a blocked head" in place of "fix of one span") and the no-sweep-file path.
  • references/seam-protocol.md: a "PR-level count" section.

The helper is in _review_contract.py as the design asks. That file was already 1,801 lines and is now 1,930, under the 2,000 cap.

Backwards compatibility

Compatible: run() in sweep_check.py gains an optional argument; rounds_view prints one extra line (blocked pushes (pr-level): N) and can exit 30 where it exited 0 before. Both only advise. A new gh api read (timeline, check runs) can fail or be slow; it then reads as unknown and changes nothing.

Removes nothing: no flag, key, function or output line is removed or renamed.

Tests

  • test/test_prepare_pr_rounds_view.py: the helper against a fake run (counting, green head, red test shard, each lane name, cancelled/timed-out/skipped, review states and dismissal, committed events, repeated head, multi-commit push, since, stop_at, paging, GET-only, unreadable reads are None), and the view (exit 30 at 3, SEAM LIMIT at 5, nothing at 2 or unknown, no markers at all, marker seam wins, resolution: restart).
  • test/test_sweep_check.py: thresholds and text, table and resolution answers, marker count first, the no-file path in warn and enforced mode, and four end-to-end cases through the fake gh (timeline and check runs added to it).
  • Existing helpers (_check, _wire) now inject the push count so no test reaches gh.

Proof: not provable -- other: a feature change, not a fix, so there is no failing-before test to revert to

Manual verification

False-positive check. The saved thread data in code-quality/latest150/design/raw/ holds issue comments only (lane comments are edited in place, no timeline, review or check-run data), so it cannot feed this helper. I replayed the helper with live read-only gh api calls on the same 15 PRs (313 calls, none failed):

Threshold PRs that trip
3 blocked pushes 13 of 15
5 blocked pushes 10 of 15

Counts per PR: 23563: 28, 23716: 13, 23719: 8, 23717: 8, 23697: 8, 23538: 8, 23606: 5, 19628: 1, 10925: 8, 23321: 3, 22149: 2, 20459: 3, 21618: 4, 23333: 15, 23223: 10.

These are the spiral PRs themselves, so this shows reach, not the false-positive rate. The rate on the other 135 PRs was not measured. #19628 (12 loops) counts 1, which may be older check names or purged check data; not checked.

Screenshots / video

N/A — no user-visible UI.

Related Issues

None.

Sibling sweep

Swept: git grep -nE "SEAM_(REPEAT|LIMIT)_FIXES|fix_rounds(|fix_counts_from" -- src
Sibling: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/scripts/pr_findings.py -- changed here
Sibling: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/scripts/sweep_check.py -- changed here
Sibling: src/kiro_crew/builtin_skills/kirocrew-dev/kirocrew-prepare-pr/scripts/_review_contract.py -- changed here

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

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 26, 2026 18:11
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision c25afe8b5a2e23250c0a5047e74ab786baa00a45 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 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the change only advises (SWEEP_ENFORCED stays False), it falls back to the marker count, and it treats an unreadable GitHub read as unknown.

Notes

  • sweep_check.py never resets the push count: "sweep_check.py does not read it". A PR with no sweep file stays flagged for good once it hits 3 blocked pushes. When SWEEP_ENFORCED flips, it gets refused unless the author adds a sweep entry. Settle how the count restarts before enforcement turns on.
  • The false-positive rate on the other 135 PRs was not measured, so the threshold of 3 is not calibrated yet. Measure it before this count drives any enforced exit.

[DESIGN-REVIEWED] c25afe8

Description read

[DESCRIPTION-READ] 86bdc90c03c849b759f02f2bafca7098bcf72527f7b0ab30f571ed19e688bdb6

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 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c25afe8b5a2e23250c0a5047e74ab786baa00a45 — 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

Nothing blocks. Each item traces to the stated reach gap (10 of 15 spiral PRs carry no marker). It stays advisory while SWEEP_ENFORCED is False.

Notes

  • Item 5 — duplicate of _review_contract.BLOCKED_PUSH_REPEAT/BLOCKED_PUSH_LIMIT: sweep_check.py restates them ("Pinned equal to the contract") as a second copy, while pr_findings.py imports them. Grepping BLOCKED_PUSH_(REPEAT|LIMIT) = finds 2 definition sites. Subtraction: delete the two sweep_check.py constants and read them from the _sibling("_review_contract.py") this file already loads, then delete test_the_constants_match_the_contract_and_the_check_stays_warn_only's equality pin.

What this change ships

Inventory (9 items) — 8 justified

Intent: a PR that keeps getting blocked is told to change approach even when no disposition marker was written. This is an ADDITION.

  1. --rounds prints SEAM REPEAT (pr-level) and exits 30 after 3 blocked pushes — justified
  2. --rounds prints SEAM LIMIT (pr-level) after 5 blocked pushes — justified
  3. --rounds prints a new blocked pushes (pr-level): N line — justified
  4. A resolution: line in any disposition, even one with no span, restarts the push count — justified
  5. Sweep check findings fall back to the push count when no marker seam exists — duplicate of _review_contract.py thresholds
  6. A missing sweep file, or one with no entry, now warns at 3+ blocked pushes instead of staying silent — justified
  7. Each --rounds and sweep check run now makes extra GitHub timeline and check-run reads — justified
  8. sweep_check.run gains an optional blocked_pushes injection parameter — justified
  9. A new "PR-level count" section in seam-protocol.md — justified

[FIRST-PRINCIPLES-REVIEWED] c25afe8

Description read

[DESCRIPTION-READ] 2b3666e72978a19acfd20087e231d32ec16984444e908f2576e79c75a05b221c

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 Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c25afe8

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

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c25afe8

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

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

@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 Oct 26, 2026
@iamwhatever
iamwhatever force-pushed the feat/blocked-push-seam-trigger branch from 82b3a3e to 7eb0a97 Compare October 26, 2026 18:41
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 26, 2026
@iamwhatever
iamwhatever force-pushed the feat/blocked-push-seam-trigger branch from 7eb0a97 to b1040fe Compare October 27, 2026 01:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever
iamwhatever force-pushed the feat/blocked-push-seam-trigger branch from b1040fe to b3bff5c Compare October 27, 2026 07:51
The D5 seam trigger counted only writer disposition markers, so it never
fired on 10 of the 15 PRs with 10+ review loops. Add
blocked_push_count(repo, number, run) to the shared review contract: it
reads the PR timeline (GET only) and counts pushes whose previous head had
a failed review-lane check run or a CHANGES_REQUESTED review. A rebase or a
red test shard on a green head counts nothing.

pr_findings.py --rounds prints SEAM REPEAT (pr-level) and exits 30 from 3
such pushes, SEAM LIMIT (pr-level) from 5, when no span is a marker seam.
sweep_check.py applies the same count in its seam rules and when there is
no sweep file. SWEEP_ENFORCED stays False. The prose lives in
references/seam-protocol.md.
@iamwhatever
iamwhatever force-pushed the feat/blocked-push-seam-trigger branch from b3bff5c to c25afe8 Compare October 27, 2026 14:59
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 27, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) October 27, 2026 18:20
@iamwhatever
iamwhatever merged commit f0e5286 into main Oct 27, 2026
108 checks passed
@iamwhatever
iamwhatever deleted the feat/blocked-push-seam-trigger branch October 27, 2026 23:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 27, 2026
@buluoray

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]: Review findings that are still true on main after this merged are tracked in #25065 (two files past the 1,600-line split rule, and a second blocked-push count that disagrees with push_budget_count).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants