Skip to content

ci(pr-automation): reconcile lifecycle state - #2068

Merged
Benoît Cortier (CBenoit) merged 5 commits into
masterfrom
cbenoit-pr-automation-lifecycle-reconciliation
Oct 8, 2026
Merged

Benoît Cortier (CBenoit) merged 5 commits into
masterfrom
cbenoit-pr-automation-lifecycle-reconciliation

Conversation

@CBenoit

Copy link
Copy Markdown
Member

Derive next-actor labels from current PR, CI, lease, and trusted exact-head review state instead of individual event transitions.

Preserve already-admitted valid reviews across draft and closed-unmerged states while stale, merged, ambiguous, and partial states fail closed.

Derive next-actor labels from current PR, CI, lease, and trusted exact-head review state instead of individual event transitions.

Preserve already-admitted valid reviews across draft and closed-unmerged states while stale, merged, ambiguous, and partial states fail closed.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 16:18
@github-actions github-actions Bot added automation-failed Exact-head automated classification or review failed or was unavailable risk/unknown Risk could not be determined automatically; needs maintainer-level scrutiny scope/tooling Build, CI, release, or developer tooling size/XXL Size: 1300 or more counted lines or 50 or more files labels Oct 1, 2026

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Removing the oversized-review authorization no longer stops an active run from using its stale elevated evidence limit.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Centralizes PR lifecycle reconciliation around live PR, CI, lease, and review-receipt state.

Changes:

  • Adds lifecycle reconciliation and trusted review outcome receipts.
  • Serializes PR mutations while retaining queued wake-ups.
  • Strengthens review admission and closed/draft publication guards.
File Description
.github/​workflows/​pr-automation.yml Adds lifecycle events, serialization, and reconciliation.
.github/​workflows/​pr-automation.intent.md Defines the revised lifecycle contract.
.github/​pr-automation/​write-state.js Guards and sequences result publication.
.github/​pr-automation/​review-outcome.js Encodes trusted review receipts.
.github/​pr-automation/​resolve-state.js Delegates actor labels to reconciliation.
.github/​pr-automation/​resolve-pr.js Preserves PR identity for lifecycle-only runs.
.github/​pr-automation/​lifecycle.js Derives and writes actor labels.
.github/​pr-automation/​current-head.js Supports guarded closed-unmerged continuation.
.github/​pr-automation/​ci-state.js Orders same-generation CI states.
.github/​pr-automation/​automation.test.js Expands lifecycle and publication coverage.
.github/​pr-automation/​automation-lease.js Revalidates admission and publication leases.
.github/​PR_AUTOMATION.md Documents lifecycle behavior and safeguards.

Comment thread .github/workflows/pr-automation.yml
Remove the label-based 4 MiB evidence override and keep one fixed 1 MiB fail-closed evidence limit.

Preserve per-label lifecycle scheduling and avoid a redundant CI-route pull request lookup.
@CBenoit

Benoît Cortier (CBenoit) commented Oct 7, 2026 •

Copy link
Copy Markdown
Member Author

PR automation is failing because of a picky-krb 0.12.5 incompatibility, fixed on master by #2074. Please rebase on master to fix it.

Update: no rebase needed anymore. picky-krb 0.12.5 was yanked from crates.io (re-released as 0.13.0), so the API check builds again without changes to this branch. PR automation has been re-run here and passes.

@github-actions github-actions Bot added risk/low Self-contained change with no cross-crate behavioral effect and removed risk/unknown Risk could not be determined automatically; needs maintainer-level scrutiny automation-failed Exact-head automated classification or review failed or was unavailable labels Oct 7, 2026
Keep the former opt-in maximum as the fixed classification and review diff cap without restoring the deleted authorization label.

@github-actions github-actions Bot 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.

PR 2068 replaces per-event actor-label deltas with snapshot-derived lifecycle reconciliation, removes the ai-review/allow-oversized machinery, and serializes admission, publication, and reconciliation through one per-PR mutation group. The change is a net deletion with careful fail-closed guards and strong test coverage; no correctness defects were found. Remaining review value is compression: the new guard closures in write-state.js duplicate one skeleton with a redundant ownership check, lifecycle.js re-reads a full snapshot per removed label, and small helpers (classification guard, closed-unmerged predicate, label-name mapping, unused export) duplicate existing ones. All six specialist findings were independently verified against the head and accepted as low-risk, behavior-preserving consolidations.

  1. [code-compressor] isOpenNonDraftAtHead is exported and imported but never called outside current-head.js — low 🟡 — .github/pr-automation/current-head.js
    The pure helper exists only as the body of isOpenNonDraftAtHeadNow, yet module.exports lists it and write-state.js imports it while using only isOpenNonDraftAtHeadNow (line 393); automation-lease.js likewise uses only the Now variant. Dropping the export and the unused import keeps the helper private with zero behavior change. Line range is null because the export statement is a modified rather than fully added line.

Comment thread .github/pr-automation/write-state.js
Comment thread .github/pr-automation/lifecycle.js
Comment thread .github/pr-automation/automation-lease.js Outdated
Comment thread .github/pr-automation/write-state.js
Comment thread .github/pr-automation/lifecycle.js Outdated
@github-actions github-actions Bot added ai-reviewed/1 One automated review completed needs-author-action The pull request author is the current next actor labels Oct 7, 2026
Share canonical classification, closed-unmerged, and label normalization rules while preserving the distinct receipt and cleanup lease checks.
@github-actions github-actions Bot added triage/overlap Possible overlap with another pull request; advisory only and removed needs-author-action The pull request author is the current next actor labels Oct 7, 2026

@github-actions github-actions Bot 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.

The PR reworks PR automation so next-actor labels are derived by lifecycle reconciliation from live PR, CI, lease, and trusted review-receipt state instead of per-event transitions, adds versioned review-outcome receipts, extends eligibility to closed-unmerged continuation, and removes the ai-review/allow-oversized feature. The change is large but internally consistent, fail-closed, and covered by focused tests; the author's review responses defend the phase-specific guards plausibly. The validated code-compressor candidates are all low-severity maintainability items: one unused export plus a dead import, a duplicated ACTOR_LABELS constant, and two verbatim guard duplications in write-state.js. Three are accepted as-is; the review-gate duplication candidate is refined because the two closures are not identical apart from the phase string: canPublishReviewReceipt performs an extra canMutate precondition that canCleanupReview deliberately omits, so the proposed factory must parameterize…

Comment thread .github/pr-automation/current-head.js
Comment thread .github/pr-automation/lifecycle.js Outdated
Comment thread .github/pr-automation/write-state.js Outdated
Comment thread .github/pr-automation/write-state.js
@github-actions github-actions Bot added ai-reviewed/2 Two automated reviews completed needs-author-action The pull request author is the current next actor labels Oct 7, 2026
@github-actions github-actions Bot removed the ai-reviewed/1 One automated review completed label Oct 7, 2026
Drop unused exports and duplicate actor-label and forced-classification rules while retaining distinct receipt and cleanup lease checks.
@github-actions github-actions Bot added needs-review A human reviewer is the current next actor and removed needs-author-action The pull request author is the current next actor triage/overlap Possible overlap with another pull request; advisory only labels Oct 7, 2026
@CBenoit
Benoît Cortier (CBenoit) merged commit 408a08b into master Oct 8, 2026
43 checks passed
@CBenoit
Benoît Cortier (CBenoit) deleted the cbenoit-pr-automation-lifecycle-reconciliation branch October 8, 2026 04:19
@github-actions github-actions Bot removed the needs-review A human reviewer is the current next actor label Oct 8, 2026

This branch was successfully deployed

1 active deployment
llm-providers — d6ee62a7 Deployed Oct 7, 2026 by CBenoit via Classify pull request #1820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-reviewed/2 Two automated reviews completed risk/low Self-contained change with no cross-crate behavioral effect scope/tooling Build, CI, release, or developer tooling size/XXL Size: 1300 or more counted lines or 50 or more files

Development

Successfully merging this pull request may close these issues.

2 participants