fix(queue): render the unified comment from the LIVE merge-state, matching the disposition (#4220) - #1374
Merged
Merged
Conversation
…ching the disposition (#4220) The public review comment built mergeReadiness from the STORED pr.mergeableState while the auto-close disposition (planAgentMaintenanceActions) reads the LIVE merge-state. GitHub recomputes mergeable_state asynchronously, so the stored value lags: a base-conflicting PR could read `clean` in the comment ("✅ safe to merge") while the disposition reads the live `dirty` and AUTO-CLOSES it — the exact #4220 contradiction (comment says merge-safe, action closes the PR). Fetch the live merge-state in the comment path (the same fetchLivePullRequestMergeState + token the disposition uses) and feed it to deriveUnifiedStatus, fail-safe to the stored value. Now `dirty` → "blocked" and `behind` → "held" in the comment, matching the action.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (66.66%) is below the target coverage (97.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1374 +/- ##
=======================================
Coverage 95.33% 95.34%
=======================================
Files 192 192
Lines 20750 20752 +2
Branches 7500 7501 +1
=======================================
+ Hits 19783 19785 +2
Misses 383 383
Partials 584 584
🚀 New features to boost your workflow:
|
Merged
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adversarial-audit finding (high, 3/3 verifiers) — the exact #4220 class you hit. The public review comment built
mergeReadinessfrom the storedpr.mergeableState, while the auto-close disposition reads the live merge-state. GitHub recomputesmergeable_stateasynchronously, so the stored value lags: a base-conflicting PR could readcleanin the comment ("✅ safe to merge") while the disposition reads the livedirtyand auto-closes it — the comment and the action directly contradict each other.Fix
Fetch the live merge-state in the comment path (the same
fetchLivePullRequestMergeState+ token the disposition uses) and feed it toderiveUnifiedStatus, fail-safe to the stored value. Nowdirty→ "blocked" andbehind→ "held" in the comment, matching the action.Validation
npm run test:ciexit 0 (4413 tests);npm auditcleandirtymerge-state the comment no longer headlines "safe to merge"ciToken ?? GITHUB_PUBLIC_TOKENfallback when the installation-token fetch fails mid-comment) is left uncovered — it's effectively unreachable once the gate check-run has already minted/cached the token;codecov/patchis advisory here (not a required check)Note — deferred siblings (#8/#9)
The audit also flagged two related comment/action mismatches: the headline reads "Closed" on (a) a guarded-path PR the disposition actually HOLDS and (b) an owner/automation-bot PR that's never closed. Both require threading the actual disposition (held-vs-closed) / author classification into the comment path — the current
heldForReviewflag is only the guardrail-path check and would mislabel a red-CI guardrail PR (which does close). Deferred to a focused follow-up to avoid a mislabel regression.