This is an automated email from the ASF dual-hosted git repository.

hello-stephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a836f2211a3 [chore](build) Honor dismissals of automated reviews with 
P0 or P1 findings (#70901)
a836f2211a3 is described below

commit a836f2211a334c6a62c47df7d27806a95643e4b8
Author: shuke <[email protected]>
AuthorDate: Tue Nov 24 18:02:30 2026 +0800

    [chore](build) Honor dismissals of automated reviews with P0 or P1 findings 
(#70901)
    
    ### Background
    
    The review runner requests changes for P0 and P1 findings and publishes
    a separate commit status for the PR and base it reviewed. The required
    `code-review` status aggregates those results across open PRs sharing a
    head commit.
    
    ### What problem does this PR solve?
    
    Issue Number: None
    Related PR: #68622 (example of a dismissed P1 result)
    PR Type: Build/CI/Chore
    
    Problem Summary:
    
    A maintainer can dismiss the bot's review on GitHub and still see a
    failing code-review check. This change lets a maintainer accept a
    converged review with P0 findings, P1 findings, or both using GitHub's
    Dismiss review button. The check links to the dismissed review, and the
    runner's original failure and findings remain available.
    
    ### Details
    
    - **Change map:** 226 changed production lines wire review identity
    through delivery, verify the dismissal from a trusted workflow, and
    recompute the gate. 139 changed test lines cover eligibility,
    authorization, and timing.
    - **Affected:** The automated review runner and status workflows in
    GitHub Actions, including reviews on fork PRs.
    - **Behavior change:** Dismissal applies to the latest eligible review
    for its PR, head, and base. Incomplete coverage, another active AI
    change request on the same head, and blockers on another open PR sharing
    the commit still block this path.
    - **Developer and release impact:** A review produced before rollout
    must be rerun to publish its review ID.
    - **CI permissions and secrets:** The fork workflow has an empty
    permissions set. The default-branch workflow uses numeric IDs as lookup
    hints, reads the PR and dismissal timeline, matches the human actor, and
    checks repository write/admin permission before recording a status
    scoped to the review. Existing repository permissions suffice.
    - **License and third-party:** None.
    - **Rollback:** Revert the change. The previous resolver ignores
    dismissal records. Recalculate affected checks to restore the previous
    verdict.
    
    ### Testing
    
    - Ran the Python script suite locally on macOS with
    `RUN_GH_HTTP_TESTS=1`: 437 passed, 20 skipped. Pure P0 and mixed P0/P1
    cases failed on the previous PR head and pass with this change. Cases
    also cover pure P1, early dismissal, reruns, incomplete reviews, other
    active reviews, and shared heads.
    - Replayed #68622 with its GitHub review, timeline, and collaborator
    permission. Simulated the open PR context and intercepted the status
    write locally. The old run link kept the check red. The verified review
    link turned it green.
    - Validated the four workflows with actionlint, excluding its existing
    diagnostic for `concurrency.queue`. Live fork event delivery requires
    the new workflows on the default branch.
    
    ### Release note
    
    None.
    
    ### Check List (For Author)
    
    - Behavior changed: Yes (see Details).
    - Does this need documentation: No.
    - Pre-submission status: Partially verified: live fork event delivery
    awaits deployment to the default branch.
    
    ### AI Disclosure
    
    - Tool: OpenAI Codex (GPT-6.2 Astra).
    - Generated: Implementation, tests, and PR description.
    - Human review: The requester approved the proposed behavior. Human
    review of the generated patch is pending.
---
 .github/scripts/record_review_dismissal.py         |  81 ++++++++++++++
 .github/scripts/resolve_code_review_status.py      |  67 +++++++++++-
 .github/scripts/submit_review.py                   |  12 ++-
 .github/scripts/test_record_review_dismissal.py    | 120 +++++++++++++++++++++
 .github/scripts/test_review_checkout_workflow.py   |   2 +-
 .../scripts/test_review_convergence_workflow.py    |   8 +-
 .github/scripts/test_submit_review.py              |  11 ++
 .github/workflows/code-review-aggregate-status.yml |   4 +-
 .github/workflows/code-review-dismissed.yml        |  17 +++
 .github/workflows/code-review-runner.yml           |   9 +-
 .github/workflows/code-review-sync-result.yml      |  35 +++++-
 11 files changed, 353 insertions(+), 13 deletions(-)

diff --git a/.github/scripts/record_review_dismissal.py 
b/.github/scripts/record_review_dismissal.py
new file mode 100644
index 00000000000..6acbd9fb7ea
--- /dev/null
+++ b/.github/scripts/record_review_dismissal.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Record who dismissed a specific AI review. Eligibility is decided by the 
runner."""
+
+import os
+import re
+from pathlib import Path
+from urllib.parse import quote
+
+from review_github_api import decode_json, run_gh
+
+
+def api(path, *args):
+    command = ["gh", "api", path, *args]
+    result = run_gh(command, capture_output=True, text=True, check=True, 
timeout=90)
+    return decode_json(result, command)
+
+
+def record_dismissal(repo, server, title, run_actor_id):
+    # The signal runs in a PR context. Treat its title only as a lookup hint.
+    match = re.fullmatch(r"Dismiss review ([1-9][0-9]*) on PR ([1-9][0-9]*)", 
title)
+    if not match:
+        return None
+    review_id, number = match.groups()
+    root = f"repos/{repo}"
+    pr = api(f"{root}/pulls/{number}")
+    if pr["state"] != "open":
+        return None
+    head = pr["head"]["sha"]
+    review = api(f"{root}/pulls/{number}/reviews/{review_id}")
+    if (review["state"] != "DISMISSED" or review["commit_id"] != head
+            or review["user"]["login"] != "github-actions[bot]"):
+        return None
+
+    pages = api(f"{root}/issues/{number}/timeline?per_page=100", "--paginate", 
"--slurp")
+    for page in pages:
+        for event in page:
+            if event["event"] != "review_dismissed":
+                continue
+            dismissal = event["dismissed_review"]
+            if (str(dismissal["review_id"]) != review_id or dismissal["state"] 
!= "changes_requested"
+                    or dismissal.get("dismissal_commit_id")):
+                continue
+            actor = event["actor"]
+            if not actor or actor["type"] != "User" or actor["id"] != 
run_actor_id:
+                continue
+            login = actor["login"]
+            permission = api(f"{root}/collaborators/{quote(login, 
safe='')}/permission")
+            if permission["permission"] not in ("write", "admin") or 
permission["user"]["id"] != actor["id"]:
+                continue
+
+            api(f"{root}/statuses/{head}", "-X", "POST", "-f", "state=success",
+                "-f", 
f"context=code-review/dismissal/pr-{number}/review-{review_id}",
+                "-f", f"description=Review dismissed by {login}.",
+                "-f", 
f"target_url={server}/{repo}/pull/{number}#pullrequestreview-{review_id}")
+            return head
+    return None
+
+
+if __name__ == "__main__":
+    head = record_dismissal(os.environ["GITHUB_REPOSITORY"], 
os.environ["GITHUB_SERVER_URL"],
+                            os.environ["RUN_TITLE"], 
int(os.environ["RUN_ACTOR_ID"]))
+    if head:
+        with Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:
+            print(f"head_sha={head}", file=output)
diff --git a/.github/scripts/resolve_code_review_status.py 
b/.github/scripts/resolve_code_review_status.py
index 5bc50f32417..f52da39c82a 100644
--- a/.github/scripts/resolve_code_review_status.py
+++ b/.github/scripts/resolve_code_review_status.py
@@ -6,6 +6,8 @@ from __future__ import annotations
 import argparse
 import json
 import re
+import subprocess
+import sys
 from dataclasses import dataclass
 from pathlib import Path
 
@@ -24,10 +26,18 @@ class ResolutionError(ValueError):
 class Resolution:
     state: str
     description: str
+    target_url: str = ""
+
+
+def list_reviews(helper, repository, number):
+    command = [sys.executable, helper, "api", "--paginate", "--slurp",
+               f"repos/{repository}/pulls/{number}/reviews?per_page=100"]
+    pages = json.loads(subprocess.check_output(command, text=True))
+    return [review for page in pages for review in page]
 
 
 def resolve_status(
-    pulls: list[object], statuses: list[object], *, head_sha: str
+    pulls: list[object], statuses: list[object], *, head_sha: str, repo_url: 
str = "", reviews_for_pr=None
 ) -> Resolution:
     if SHA_RE.fullmatch(head_sha) is None:
         raise ResolutionError("head SHA is not a full SHA")
@@ -71,6 +81,17 @@ def resolve_status(
         if previous is None or status_id > int(previous["id"]):
             latest_by_context[context] = item
 
+    # Join two independent records. A dismissal alone can never satisfy a PR.
+    dismissed = set()
+    for context, item in latest_by_context.items():
+        match = 
re.fullmatch(r"code-review/dismissal/pr-([1-9][0-9]*)/review-([1-9][0-9]*)", 
context)
+        if match and item["state"] == "success" and repo_url:
+            number, review_id = match.groups()
+            url = f"{repo_url}/pull/{number}#pullrequestreview-{review_id}"
+            if item.get("target_url") == url and (item.get("creator") or 
{}).get("login") == "github-actions[bot]":
+                dismissed.add((int(number), url))
+
+    accepted_dismissals = {}
     approved_contexts: set[tuple[int, str]] = set()
     blocked_contexts: set[tuple[int, str]] = set()
     incomplete_contexts: set[tuple[int, str]] = set()
@@ -81,15 +102,23 @@ def resolve_status(
         elif (match is not None and item["state"] == "failure"
               and context.startswith("code-review/source/automated/")):
             key = (int(match.group(1)), match.group(2).casefold())
+            url = item.get("target_url")
+            description = item.get("description") or ""
+            counts = re.fullmatch(rf"Review completed for PR #{key[0]}: 
P0=(0|[1-9][0-9]*), P1=(0|[1-9][0-9]*)\.",
+                                  description)
+            if (key in open_contexts and (key[0], url) in dismissed
+                    and counts and counts.groups() != ("0", "0")
+                    and (item.get("creator") or {}).get("login") == 
"github-actions[bot]"):
+                accepted_dismissals[key] = url
+                continue
             blocked_contexts.add(key)
-            # State remains the sole gating signal. Use the runner's 
description
-            # only to explain an already-blocking result, never to grant a 
pass.
-            description = item.get("description")
             if isinstance(description, str) and description.startswith("Review 
did not converge after "):
                 incomplete_contexts.add(key)
 
     # Preserve the authorized local PASS / skip override. Otherwise a completed
     # automated review with P0/P1 or incomplete coverage blocks instead of 
pending.
+    accepted_dismissals = {key: url for key, url in 
accepted_dismissals.items() if key not in approved_contexts}
+    approved_contexts.update(accepted_dismissals)
     blocked = sorted((open_contexts - approved_contexts) & blocked_contexts)
     if blocked:
         number, base_sha = blocked[0]
@@ -101,6 +130,24 @@ def resolve_status(
             "failure", f"Review completed with P0/P1 for PR #{number} at 
{base_sha[:12]}.",
         )
 
+    # Another submitted AI review of this same head may still request changes.
+    for key, url in sorted(accepted_dismissals.items()):
+        number = key[0]
+        if reviews_for_pr is None:
+            raise ResolutionError("dismissal requires current GitHub review 
states")
+        matching_dismissal = False
+        for review in reviews_for_pr(number):
+            if (review["commit_id"] != head_sha or review["user"]["login"] != 
"github-actions[bot]"
+                    or "<!-- code-review-completion:" not in 
(review.get("body") or "")):
+                continue
+            review_url = 
f"{repo_url}/pull/{number}#pullrequestreview-{int(review['id'])}"
+            if review["state"] == "CHANGES_REQUESTED":
+                return Resolution("failure", f"An active AI review still 
requests changes for PR #{number}.", review_url)
+            if review_url == url and review["state"] == "DISMISSED":
+                matching_dismissal = True
+        if not matching_dismissal:
+            return Resolution("failure", f"Could not verify the dismissed AI 
review for PR #{number}.", url)
+
     missing = sorted(open_contexts - approved_contexts)
     if missing:
         number, base_sha = missing[0]
@@ -111,6 +158,11 @@ def resolve_status(
             f"Awaiting code review for PR #{number} at 
{base_sha[:12]}{suffix}.",
         )
 
+    if accepted_dismissals:
+        key = min(accepted_dismissals)
+        number, url = key[0], accepted_dismissals[key]
+        return Resolution("success", f"Code review passed after manual review 
dismissal for PR #{number}.", url)
+
     count = len(open_contexts)
     noun = "context" if count == 1 else "contexts"
     return Resolution(
@@ -131,15 +183,20 @@ def main() -> int:
     parser.add_argument("--pulls-file", type=Path, required=True)
     parser.add_argument("--statuses-file", type=Path, required=True)
     parser.add_argument("--head-sha", required=True)
+    parser.add_argument("--repo-url", default="")
+    parser.add_argument("--repository")
+    parser.add_argument("--github-api-helper")
     args = parser.parse_args()
 
     resolution = resolve_status(
         load_list(args.pulls_file, "pulls"),
         load_list(args.statuses_file, "statuses"),
-        head_sha=args.head_sha,
+        head_sha=args.head_sha, repo_url=args.repo_url,
+        reviews_for_pr=lambda number: list_reviews(args.github_api_helper, 
args.repository, number),
     )
     print(f"state={resolution.state}")
     print(f"description={resolution.description}")
+    print(f"target_url={resolution.target_url}")
     return 0
 
 
diff --git a/.github/scripts/submit_review.py b/.github/scripts/submit_review.py
index 909ef2e4717..27e159a8f26 100644
--- a/.github/scripts/submit_review.py
+++ b/.github/scripts/submit_review.py
@@ -440,10 +440,20 @@ def _verify_completion(context, run, remaining, *, 
submit=False, submission=None
         ))
     review = matching[0]
     expected_state = "CHANGES_REQUESTED" if payload["event"] == 
"REQUEST_CHANGES" else "COMMENTED"
+    # A maintainer can dismiss between submission and the runner's readback.
+    # Verify the original disposition. This still delivers a blocking result.
+    state = review.get("state")
+    if state == "DISMISSED" and expected_state == "CHANGES_REQUESTED":
+        timeline = 
api(f"repos/{run['repository']}/issues/{run['pr_number']}/timeline",
+                       remaining, paginated=True)
+        if any(e.get("event") == "review_dismissed"
+               and str(e["dismissed_review"]["review_id"]) == str(review["id"])
+               and e["dismissed_review"]["state"] == "changes_requested" for e 
in timeline):
+            state = expected_state
     if (review.get("user", {}).get("login") != "github-actions[bot]"
             or review.get("commit_id") != run["head_sha"]
             or (review.get("submitted_at") or "") < run["started_at"]
-            or review.get("state") != expected_state
+            or state != expected_state
             or review.get("body") != payload["body"]):
         raise ValueError("Final review author, head, timestamp, state or 
summary did not match")
     verify_inline_comments(root, review, payload, run, remaining)
diff --git a/.github/scripts/test_record_review_dismissal.py 
b/.github/scripts/test_record_review_dismissal.py
new file mode 100644
index 00000000000..1e2a9ce26b9
--- /dev/null
+++ b/.github/scripts/test_record_review_dismissal.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from unittest.mock import patch
+
+from record_review_dismissal import record_dismissal
+from resolve_code_review_status import resolve_status
+from test_resolve_code_review_status import HEAD_SHA, OTHER_BASE_SHA, pull, 
status
+
+SERVER = "https://github.com";
+REPO = "apache/doris"
+REPO_URL = f"{SERVER}/{REPO}"
+TITLE = "Dismiss review 99 on PR 123"
+BOT = {"login": "github-actions[bot]"}
+URL = REPO_URL + "/pull/123#pullrequestreview-99"
+
+
+class ReviewDismissalTest(unittest.TestCase):
+    def setUp(self):
+        self.pr = pull(123)
+        self.review = {"state": "DISMISSED", "commit_id": HEAD_SHA, "user": 
BOT}
+        self.event = {"event": "review_dismissed", "actor": {"login": "alice", 
"id": 42, "type": "User"},
+                      "dismissed_review": {"review_id": 99, "state": 
"changes_requested"}}
+        self.permission = {"user": {"id": 42}, "permission": "write"}
+        self.posts = []
+        self.api = self.enterContext(patch("record_review_dismissal.api", 
side_effect=self.fake_api))
+
+    def fake_api(self, path, *args):
+        self.assertTrue(path.startswith(f"repos/{REPO}/"))
+        path = path.removeprefix(f"repos/{REPO}/")
+        if path == "pulls/123":
+            return self.pr
+        if path == "pulls/123/reviews/99":
+            return self.review
+        if path == "issues/123/timeline?per_page=100":
+            self.assertEqual(("--paginate", "--slurp"), args)
+            return [[{"event": "reviewed"}], [self.event]]
+        if path == "collaborators/alice/permission":
+            return self.permission
+        if path == f"statuses/{HEAD_SHA}":
+            self.assertEqual(("-X", "POST"), args[:2])
+            self.posts.append(dict(arg.split("=", 1) for arg in args[3::2]))
+            return {}
+        self.fail(path)
+
+    def 
test_receipt_matches_only_latest_eligible_source_on_its_pr_and_head(self):
+        self.assertEqual(HEAD_SHA, record_dismissal(REPO, SERVER, TITLE, 42))
+        receipt = dict(self.posts[0], creator=BOT, id=1)
+        source = dict(status(2, source="automated", state="failure"), 
target_url=URL, creator=BOT,
+                      description="Review completed for PR #123: P0=0, P1=2.")
+
+        reviews = [dict(self.review, id=99, body="<!-- 
code-review-completion:t -->")]
+
+        def resolve(records, pulls=None):
+            return resolve_status(pulls or [self.pr], records, 
head_sha=HEAD_SHA, repo_url=REPO_URL,
+                                  reviews_for_pr=lambda number: reviews)
+
+        for records in ([receipt, source], [source, receipt]):
+            result = resolve(records)
+            self.assertEqual(("success", URL), (result.state, 
result.target_url))
+            self.assertIn("dismissal", result.description)
+        for p0, p1 in ((1, 0), (0, 2), (1, 2)):
+            with self.subTest(p0=p0, p1=p1):
+                finding = dict(source, description=f"Review completed for PR 
#123: P0={p0}, P1={p1}.")
+                self.assertEqual("failure", resolve([finding]).state)
+                self.assertEqual("success", resolve([finding, receipt]).state)
+        reviews.append(dict(self.review, id=87, state="CHANGES_REQUESTED", 
body="<!-- code-review-completion:t -->"))
+        self.assertEqual("failure", resolve([receipt, source]).state)
+        self.assertEqual("success", resolve([receipt, source, status(3, 
source="skip")]).state)
+        reviews[1]["state"] = "DISMISSED"
+        self.assertEqual("success", resolve([receipt, source]).state)
+        self.assertEqual("pending", resolve([receipt]).state)
+        self.assertEqual("pending", resolve([receipt, source], [pull(123, 
base=OTHER_BASE_SHA)]).state)
+        self.assertEqual("pending", resolve([receipt, source], [pull(123), 
pull(124)]).state)
+        self.assertEqual("failure", resolve([receipt, source, status(3, 
source="automated", pr_number=124,
+                         state="failure")], [pull(123), pull(124)]).state)
+        self.assertEqual("pending", resolve([receipt, source, dict(source, 
id=3, state="pending")]).state)
+        for changed in (dict(source, id=3, target_url=URL + "0"),
+                        dict(source, id=3, target_url=REPO_URL + 
"/actions/runs/42"),
+                        dict(source, id=3, description="Review completed for 
PR #123: P0=0, P1=0."),
+                        dict(source, id=3, description="Review did not 
converge after 3 rounds"),
+                        dict(source, id=3, creator={"login": "other"})):
+            self.assertEqual("failure", resolve([source, receipt, 
changed]).state)
+        for changed in (dict(receipt, creator={"login": "other"}), 
dict(receipt, state="pending"),
+                        dict(receipt, target_url=URL + "0")):
+            self.assertEqual("failure", resolve([source, changed]).state)
+
+    def test_ignores_unverified_and_automatic_dismissals(self):
+        for data, fields in (
+            (self.pr, {"state": "closed"}), (self.review, {"commit_id": "c" * 
40}),
+            (self.review, {"state": "CHANGES_REQUESTED"}), (self.review, 
{"user": {"login": "other"}}),
+            (self.event["dismissed_review"], {"review_id": 100}),
+            (self.event["dismissed_review"], {"state": "approved"}),
+            (self.event["dismissed_review"], {"dismissal_commit_id": 
HEAD_SHA}),
+            (self.event["actor"], {"type": "Bot"}), (self.event["actor"], 
{"id": 72}),
+            (self.permission, {"permission": "read"}), 
(self.permission["user"], {"id": 1}),
+        ):
+            with self.subTest(fields=fields), patch.dict(data, fields):
+                self.assertIsNone(record_dismissal(REPO, SERVER, TITLE, 42))
+                self.assertFalse(self.posts)
+
+    def test_untrusted_title_is_only_a_numeric_lookup_hint(self):
+        self.assertIsNone(record_dismissal(REPO, SERVER, TITLE + "\nextra", 
42))
+        self.api.assert_not_called()
diff --git a/.github/scripts/test_review_checkout_workflow.py 
b/.github/scripts/test_review_checkout_workflow.py
index 59e814e42ce..df8e7c9236f 100644
--- a/.github/scripts/test_review_checkout_workflow.py
+++ b/.github/scripts/test_review_checkout_workflow.py
@@ -138,7 +138,7 @@ class ReviewCheckoutWorkflowTest(unittest.TestCase):
         self.assertIn("uses: 
./.github/workflows/code-review-aggregate-status.yml", caller)
         self.assertIn("needs: resolve-event", caller)
         self.assertIn("fromJSON(needs.resolve-event.outputs.head_shas)", 
caller)
-        self.assertIn("workflows: [Pull Request Events]", sync)
+        self.assertIn("workflows: [Pull Request Events, Code Review 
Dismissal]", sync)
         github = self.pr_event()
         self.assert_trusted_default_checkout(github)
         head = github["event"]["pull_request"]["head"]["sha"]
diff --git a/.github/scripts/test_review_convergence_workflow.py 
b/.github/scripts/test_review_convergence_workflow.py
index 88620f1c453..dedf86e7f7d 100644
--- a/.github/scripts/test_review_convergence_workflow.py
+++ b/.github/scripts/test_review_convergence_workflow.py
@@ -75,15 +75,17 @@ class ReviewConvergenceWorkflowTest(unittest.TestCase):
         for converged, p0, p1, expected in (
             (True, 0, 0, "success"),
             (True, 1, 0, "failure"),
+            (True, 1, 2, "failure"),
             (True, 0, 1, "failure"),
             (False, 0, 0, "failure"),
             (False, 0, 1, "failure"),
+            (False, 1, 0, "failure"),
         ):
             with self.subTest(converged=converged, p0=p0, p1=p1), 
tempfile.TemporaryDirectory() as tmp:
                 root = Path(tmp)
                 (root / "review-result.json").write_text(json.dumps({
                     "state": expected, "p0": p0, "p1": p1, "converged": 
converged,
-                    "rounds": 3, "incomplete_reason": "" if converged else 
"Coverage incomplete",
+                    "review_id": 99, "rounds": 3, "incomplete_reason": "" if 
converged else "Coverage incomplete",
                 }))
                 env = {**os.environ, "status": "0", "REVIEW_CONTEXT_DIR": tmp,
                        "GITHUB_OUTPUT": str(root / "output"), 
"GITHUB_STEP_SUMMARY": str(root / "summary")}
@@ -97,10 +99,12 @@ class ReviewConvergenceWorkflowTest(unittest.TestCase):
                     "REVIEW_CONTEXT_OUTCOME": "success", "REVIEW_OUTCOME": 
"success",
                     "REVIEW_STATE": outputs["review_state"], "REVIEW_P0": 
outputs["p0"],
                     "REVIEW_P1": outputs["p1"], "REVIEW_CONVERGED": 
outputs["converged"],
-                    "REVIEW_ROUNDS": outputs["rounds"],
+                    "REVIEW_ID": outputs["review_id"], "REVIEW_ROUNDS": 
outputs["rounds"],
                 }, capture_output=True, text=True, check=True)
                 args = json.loads(result.stdout)
                 posted = dict(args[i + 1].split("=", 1) for i in 
range(len(args)) if args[i] == "-f")
+                eligible = converged and p0 + p1 > 0
+                self.assertEqual(eligible, 
posted["target_url"].endswith("/pull/123#pullrequestreview-99"))
                 self.assertEqual(expected, posted["state"])
                 self.assertIn("repos/apache/doris/statuses/" + "a" * 40, args)
                 resolution = resolve_status([{
diff --git a/.github/scripts/test_submit_review.py 
b/.github/scripts/test_submit_review.py
index 130885b347a..ef073bb50de 100644
--- a/.github/scripts/test_submit_review.py
+++ b/.github/scripts/test_submit_review.py
@@ -52,6 +52,7 @@ class FinalReviewTest(unittest.TestCase):
         self.comments = []
         self.existing = []
         self.posts = []
+        self.timeline = []
         self.thread_inputs = []
         self.final_events = []
         self.deletes = []
@@ -113,6 +114,8 @@ class FinalReviewTest(unittest.TestCase):
             return copy.deepcopy(self.reviews[-1])
         if path == self.root + "/reviews/99/comments":
             return copy.deepcopy(self.comments)
+        if path == 
f"repos/{self.run['repository']}/issues/{self.run['pr_number']}/timeline":
+            return self.timeline
         if path == self.root + "/comments":
             return copy.deepcopy(self.existing)
         self.fail(f"Unexpected API path {path}")
@@ -518,6 +521,14 @@ class FinalReviewTest(unittest.TestCase):
                 self.comments = comments
                 self.verify()
 
+    def test_dismissal_before_final_readback_keeps_blocking_verdict(self):
+        self.submit()
+        self.reviews[0]["state"] = "DISMISSED"
+        self.timeline = [{"event": "review_dismissed",
+                          "dismissed_review": {"review_id": 99, "state": 
"changes_requested"}}]
+        result = self.verify()
+        self.assertEqual(("failure", 1, 99), (result["state"], result["p1"], 
result["review_id"]))
+
     def test_changed_review_identity_or_summary_cannot_pass(self):
         self.submit()
         original = copy.deepcopy(self.reviews[0])
diff --git a/.github/workflows/code-review-aggregate-status.yml 
b/.github/workflows/code-review-aggregate-status.yml
index 6cca47278c7..fa60307f9e3 100644
--- a/.github/workflows/code-review-aggregate-status.yml
+++ b/.github/workflows/code-review-aggregate-status.yml
@@ -90,10 +90,12 @@ jobs:
           python3 .github/scripts/resolve_code_review_status.py \
             --pulls-file "$pulls" \
             --statuses-file "$statuses" \
+            --repository "$REPO" --github-api-helper "$REVIEW_GH_HELPER" 
--repo-url "$GITHUB_SERVER_URL/$REPO" \
             --head-sha "$HEAD_SHA" >> "$GITHUB_OUTPUT"
 
       - name: Publish aggregate code-review status
         env:
+          REVIEW_URL: ${{ steps.resolution.outputs.target_url }}
           DESCRIPTION: ${{ steps.resolution.outputs.description }}
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           HEAD_SHA: ${{ inputs.head_sha }}
@@ -105,7 +107,7 @@ jobs:
             -f state="$STATE" \
             -f context='code-review' \
             -f description="$DESCRIPTION" \
-            -f target_url="${{ github.server_url }}/${{ github.repository 
}}/actions/runs/${{ github.run_id }}"
+            -f 
target_url="${REVIEW_URL:-$GITHUB_SERVER_URL/$REPO/actions/runs/$GITHUB_RUN_ID}"
 
       - name: Preserve GitHub API failure diagnostics
         if: always()
diff --git a/.github/workflows/code-review-dismissed.yml 
b/.github/workflows/code-review-dismissed.yml
new file mode 100644
index 00000000000..49b93da40a8
--- /dev/null
+++ b/.github/workflows/code-review-dismissed.yml
@@ -0,0 +1,17 @@
+name: Code Review Dismissal
+run-name: Dismiss review ${{ github.event.review.id }} on PR ${{ 
github.event.pull_request.number }}
+
+on:
+  pull_request_review:
+    types: [dismissed]
+
+# Fork review events use an unprivileged token. The default-branch sync
+# workflow uses these IDs only to look up the actual dismissal on GitHub.
+permissions: {}
+
+jobs:
+  notify:
+    if: github.event.review.user.login == 'github-actions[bot]'
+    runs-on: ubuntu-latest
+    steps:
+      - run: echo 'Requesting a code review status update.'
diff --git a/.github/workflows/code-review-runner.yml 
b/.github/workflows/code-review-runner.yml
index 439f9c94edb..9ea24e5f2d3 100644
--- a/.github/workflows/code-review-runner.yml
+++ b/.github/workflows/code-review-runner.yml
@@ -1009,7 +1009,7 @@ jobs:
           # Execution succeeded even when verified findings block the PR check.
           # This result is written only after the runner's own API readback.
           jq -er 'select(.state == "success" or .state == "failure") |
-            
"review_state=\(.state)\np0=\(.p0)\np1=\(.p1)\nconverged=\(.converged)\nrounds=\(.rounds)"'
 \
+            
"review_state=\(.state)\np0=\(.p0)\np1=\(.p1)\nconverged=\(.converged)\nrounds=\(.rounds)\nreview_id=\(.review_id)"'
 \
             "$REVIEW_CONTEXT_DIR/review-result.json" >> "$GITHUB_OUTPUT"
 
       - name: Preserve failed final review diagnostics
@@ -1211,8 +1211,10 @@ jobs:
           REVIEW_P0: ${{ steps.review.outputs.p0 }}
           REVIEW_P1: ${{ steps.review.outputs.p1 }}
           REVIEW_CONVERGED: ${{ steps.review.outputs.converged }}
+          REVIEW_ID: ${{ steps.review.outputs.review_id }}
           REVIEW_ROUNDS: ${{ steps.review.outputs.rounds }}
         run: |
+          target_url="${{ github.server_url }}/${{ github.repository 
}}/actions/runs/${{ github.run_id }}"
           state="pending"
           summary="Automated review did not pass for PR #${PR_NUMBER} at 
${BASE_SHA:0:12}."
 
@@ -1225,6 +1227,9 @@ jobs:
                 summary="Review completed for PR #${PR_NUMBER}: 
P0=${REVIEW_P0}, P1=${REVIEW_P1}."
                 if [ "$REVIEW_CONVERGED" = "false" ]; then
                   summary="Review did not converge after ${REVIEW_ROUNDS} 
rounds for PR #${PR_NUMBER}: P0=${REVIEW_P0}, P1=${REVIEW_P1}."
+                elif [[ "$REVIEW_CONVERGED" == true && "$state" == failure && 
"$REVIEW_ID" =~ ^[1-9][0-9]*$ ]]; then
+                  # A converged review fails when it reports P0 or P1 findings.
+                  target_url="${{ github.server_url 
}}/${REPO}/pull/${PR_NUMBER}#pullrequestreview-${REVIEW_ID}"
                 fi
                 ;;
               *) echo "::error::Missing verified review verdict"; exit 1 ;;
@@ -1237,7 +1242,7 @@ jobs:
             -f state="${state}" \
             -f context="$source_context" \
             -f description="${summary}" \
-            -f target_url="${{ github.server_url }}/${{ github.repository 
}}/actions/runs/${{ github.run_id }}"
+            -f target_url="$target_url"
 
       - name: Record review I/O to Litefuse
         if: ${{ always() }}
diff --git a/.github/workflows/code-review-sync-result.yml 
b/.github/workflows/code-review-sync-result.yml
index b911fbc5bb4..c8b81a0ba73 100644
--- a/.github/workflows/code-review-sync-result.yml
+++ b/.github/workflows/code-review-sync-result.yml
@@ -2,7 +2,7 @@ name: Code Review
 
 on:
   workflow_run:
-    workflows: [Pull Request Events]
+    workflows: [Pull Request Events, Code Review Dismissal]
     types: [completed]
   issue_comment:
     types: [created]
@@ -13,6 +13,39 @@ permissions:
   statuses: write
 
 jobs:
+  record-dismissal:
+    if: >-
+      github.event_name == 'workflow_run' &&
+      github.event.workflow_run.event == 'pull_request_review' &&
+      github.event.workflow_run.path == 
'.github/workflows/code-review-dismissed.yml' &&
+      github.event.workflow_run.conclusion == 'success'
+    runs-on: ubuntu-latest
+    outputs:
+      head_sha: ${{ steps.record.outputs.head_sha }}
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          ref: ${{ github.sha }}
+          persist-credentials: false
+          sparse-checkout: |
+            .github/scripts/record_review_dismissal.py
+            .github/scripts/review_github_api.py
+          sparse-checkout-cone-mode: false
+      - name: Record verified manual dismissal
+        id: record
+        env:
+          GH_TOKEN: ${{ github.token }}
+          RUN_ACTOR_ID: ${{ github.event.workflow_run.actor.id }}
+          RUN_TITLE: ${{ github.event.workflow_run.display_title }}
+        run: python3 .github/scripts/record_review_dismissal.py
+
+  aggregate-after-dismissal:
+    needs: record-dismissal
+    if: needs.record-dismissal.outputs.head_sha != ''
+    uses: ./.github/workflows/code-review-aggregate-status.yml
+    with:
+      head_sha: ${{ needs.record-dismissal.outputs.head_sha }}
+
   accept-skill-review:
     name: Accept local skill review PASS
     runs-on: ubuntu-latest


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to