Repository navigation
[Fix] Conflicted PRs keep awaiting-author alongside the has-conflicts flag - #2102
Conversation
…conflicts flag Implements steps 3-4 of issue #2089. has-conflicts leaves the exclusive stateLabels group: reconcileConflictFlag sets it only on a known dirty read and removes it only on a known read that is not dirty, while unknown mergeability freezes it together with the turn labels. Both conflict branches force the awaiting-author turn label, so a conflicted PR can never carry a maintainer-queue label.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review statusThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging. Current step: Required CI passed. Waiting for automated review of the latest commit. If automated review does not start, a maintainer must restart it. Review-state labels are managed by this workflow; do not edit them manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Address review findings on #2102: - Parameterize fork read-only coverage for reconcileConflictFlag in both directions: a known dirty read with the flag absent and a known clean read with the flag present. Assert no label writes and no failure, because the guard is an early return, not a failure. - Cover the tolerated 404 on flag removal. The run keeps reconciling the turn label and does not fail. - Carry run-1 label results into run 2 of the consecutive-runs test through the shared-state harness instead of hard-coded labels. Mutation checks: each new test fails when its guard or the 404 tolerance is removed, and passes with production code restored.
Related GitHub Issue
Part of #2089 (steps 3–4). PR #2091 carries steps 1–2 (mergeability retry and the unknown-read freeze). This PR does not close the issue on its own.
Description
The workflow kept
has-conflictsinside the exclusivestateLabelsgroup. That group holds the turn labels (awaiting-author,awaiting-coderabbit,awaiting-ready,awaiting-maintainer). Two different facts competed for one label slot: whose turn it is, and whether the branch has conflicts. The old conflict branch sethas-conflictsinstead of a turn label, so a conflicted PR lost itsawaiting-authorstate. A legacyhas-conflicts+awaiting-maintainerpair could also survive on the same PR.Changes in
.github/workflows/label-pr-review-state.yml:has-conflictsis no longer a member ofstateLabels. Turn labels reconcile among themselves only.reconcileConflictFlaghelper owns the flag. A knowndirtyread sets it. A known read that is notdirtyremoves it. While mergeability is unknown, no caller runs, so the flag freezes together with the turn labels (the [Fix] Review-state labels swap on unchanged PRs while GitHub computes mergeability #2091 behavior now covers the flag too).dirtyread and the maintainer-handoff recheck) set the flag and force the turn label toawaiting-author. A conflicted PR can never carryawaiting-maintainer.preserveStateLabels, so cleanup keeps the current labels exactly like the unknown-read freeze.Unchanged behavior: known clean reads reconcile turn labels exactly as before. The
conflictreview gate, its guide text, and CodeRabbit deactivation in the conflict branch keep their current wording and effect. The stale-pr-clock workflow (#2077) is untouched;stale-pr-clock-workflow.test.ts:593keeps passing because the stale step only reads labels.Test Procedure
New tests in
src/services/__tests__/pr-review-state-workflow.test.ts:carries awaiting-author and has-conflicts together, stable across consecutive runs (#2089): a knowndirtyread sets both labels, and a second run with the samedirtyread writes no label at all.removes the has-conflicts flag on a known clean read without touching the turn label (#2089): the flag goes;awaiting-maintainerstays.keeps state labels when removing the has-conflicts flag fails (#2089): the failed flag write preserves the current labels and fails the run.Updated tests: the conflict-branch tests now also assert
awaiting-author; the flag-add-failure test asserts the new fail-closed message; the outer-cleanup test uses a turn label, because the flag no longer takes part in turn-label reconciliation. The unknown-mergeability tests from #2025 and #2091 already pin the flag freeze, and they pass unchanged.Checks run locally:
pnpm --dir src run test:workflow— 308 passed (4 files).pnpm --dir src run test:services— 1465 passed.pnpm --dir src run check-types— passed.pnpm --dir src exec eslint --prune-suppressions --max-warnings=0 services/__tests__/pr-review-state-workflow.test.ts— passed. No suppression count changed.pnpm testfrom the repository root — passed on re-run (13/13 turbo tasks). One run showed the 2 knownextension.spec.tsparallel-load flakes. They pass in isolation and on re-run, with and without these changes (same pattern as the [Fix] Review-state labels swap on unchanged PRs while GitHub computes mergeability #2091 run).Pre-Submission Checklist
Visual Snapshots
Not applicable — this change touches CI workflow logic only.
Videos (interaction / animation only)
Not applicable.
Documentation Updates
Re-verified during this change:
Zoo-Code-Docsdoes not document the review-state labels or their exclusivity rules. A search across its docs, src, and sidebar files finds no mention ofhas-conflicts, theawaiting-*labels,coderabbit-review-active, orcommunity-approved. No docs PR pairs with this change.Additional Notes
Reviewer notes on the new semantics:
blocked,unstable, orbehind, not only a literalmergeable_state: "clean". A resolved conflict therefore does not keep a stale flag while CI runs.has-conflicts+awaiting-maintainerpair survives until some run reads a known value. A knowndirtyread then forcesawaiting-author; a known non-dirty read removes the flag.pushtrigger (tracked in a separate issue) and the stale-pr-clock workflow ([Fix] Stale PR clock resets on bot activity so stale PRs never close #2077).Get in Touch
Discord: 0x7777777_