Repository navigation
ci(pr-automation): reconcile lifecycle state - #2068
Benoît Cortier (CBenoit) merged 5 commits into
Conversation
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.
There was a problem hiding this comment.
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
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. |
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.
|
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. |
Keep the former opt-in maximum as the fixed classification and review diff cap without restoring the deleted authorization label.
There was a problem hiding this comment.
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.
- [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.
Share canonical classification, closed-unmerged, and label normalization rules while preserving the distinct receipt and cleanup lease checks.
There was a problem hiding this comment.
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…
Drop unused exports and duplicate actor-label and forced-classification rules while retaining distinct receipt and cleanup lease checks.

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.