From 4a6f269d361812dd0265673a20ba2955e3a507e5 Mon Sep 17 00:00:00 2001 From: eowca <4008965+eowca@users.noreply.github.com> Date: Thu, 26 Nov 2026 01:03:37 +0100 Subject: [PATCH 1/3] Judge review eligibility only on the leading machine block Eligibility, readiness coverage and the review-budget count now read the review marker only from the first line of the publisher's leading machine block. Marker text quoted in model-written findings no longer voids a genuine review that the budget already counts; a retired pair marker in the leading block is still rejected. Closes #1105 Co-Authored-By: Claude Opus 5.5 --- src/loopzero/cli.py | 2 +- src/loopzero/eligibility.py | 16 ++++++++++++---- tests/test_cli.py | 20 +++++++++++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/loopzero/cli.py b/src/loopzero/cli.py index 7e70e258..60be7419 100644 --- a/src/loopzero/cli.py +++ b/src/loopzero/cli.py @@ -250,7 +250,7 @@ def _pr_markers(reviews: list[dict], head: str, if not eligibility.review_projection(review, head, repo, number)[0] and any( runners.codex_fatal_startup(item) for item in eligibility.review_envelopes(body)[1]): continue - match = REVIEW_MARKER_RE.search(body) + match = eligibility.leading_marker(body) if not match or review.get("commit_id") != match.group(1): continue if not trusted: diff --git a/src/loopzero/eligibility.py b/src/loopzero/eligibility.py index 981c0bed..4de8fb3d 100644 --- a/src/loopzero/eligibility.py +++ b/src/loopzero/eligibility.py @@ -18,6 +18,14 @@ CONTEXT = "Loop-zero Eligibility" +def leading_marker(body: str) -> re.Match[str] | None: + """The review marker opening the publisher's leading machine block; prose never counts.""" + block, span = runners.leading_review_block(body if isinstance(body, str) else "") + if not block or len(REVIEW_MARKER_RE.findall(span)) != 1: + return None + return REVIEW_MARKER_RE.fullmatch(block[0]) + + def review_envelopes(body: str) -> tuple[str, list[dict]]: """Decode only the publisher's raw-output block, not quoted findings/prose.""" if not isinstance(body, str): @@ -40,7 +48,7 @@ def review_projection(review: dict, head: str, repo: str, number: int): block, span = runners.leading_review_block(body) positions = [i for i, line in enumerate(block) if line.lstrip().startswith("