Skip to content

Judge review eligibility only on the leading machine block - #1215

Merged
mergify[bot] merged 2 commits into
mainfrom
lean178/1105-leading-block-eligibility
Nov 26, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
lean178/1105-leading-block-eligibility

Conversation

@eowca

@eowca eowca commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Judge review eligibility only on the leading machine block

Context and goal

  • Goal: A genuine review stays valid when its own findings quote review-marker text, so a PR is no longer stuck with a spent review budget and no eligible review.
  • Problem: Eligibility searched the whole published review body for the hidden review marker and rejected the review when it found more than one, or any retired "pair" marker. The body includes model-written finding text, so a finding that quoted a marker (for example from a test fixture, or text a PR plants for the model to repeat) voided the review. The review-budget counter still counted that review, so loop-zero refused a new review at the same head.
  • Context: Each published review opens with a machine block: hidden <!-- loopzero:... --> lines written by the publisher, starting with the review marker that names the head and review kind. Everything after that block is a summary and model prose.

Closes #1105

Acceptance

  • A publisher review whose leading block is valid stays eligible when finding text or other prose contains review-marker text, with or without source=pair.
  • A retired pair marker in the leading block is still rejected.
  • The review-budget count (_pr_markers), eligible_review and readiness_review read the same marker: the first line of the leading block, with exactly one review marker in that block.
  • A test renders a real body through github.review_payloads with a suggestion quoting a marker and asserts eligibility, readiness coverage and the budget count.

Notes

  • Design pass (trust boundary): the publisher's leading block is trusted; model prose after it is untrusted. Invariant: only the leading block decides whether a review exists, which head and kind it covers and whether it is retired; a newer publisher review that mentions a marker anywhere still blocks older evidence from reviving (unchanged selection rule, covered by the existing transport tests).
  • Review round one (Codex): publication recovery (loopzero review --repost) also matched markers quoted in reviews on other commits; it now uses the leading marker for that cross-commit match (regression test fails at the reviewed head). Added the suggested test that a second review marker inside the leading block voids the review and is not counted.
  • Regression proof: tests/test_cli.py::test_review_marker_quoted_in_prose_neither_voids_nor_hides_a_review fails on pre-fix source (eligible_review returns None) and passes after.

Base

main @ b0ab7dd
Base: b0ab7dd

Validation

Recorded for e633fbf32938

  • uv run --group dev ruff check src tests: exit 0
  • uv run --group dev tach check: exit 0
  • uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0
  • scripts/size_budget.sh: exit 0
  • uv run --group dev pytest -q: exit 0

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Review

  • primary, codex, 4a6f269, request_changes
  • delta, codex, e633fbf, approve

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 <noreply@anthropic.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero primary review by codex on 4a6f269d361812dd0265673a20ba2955e3a507e5, 29.9s: request_changes (0 critical, 1 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: 8f623f33f264433c6a735827778fe1beb5e50ed47489f0aa4dedfa2bc19dc772

Comment thread src/loopzero/cli.py Resolved
Comment thread tests/test_cli.py
assert cli.eligibility.eligible_review([review], head, (LOGIN,)) is review
assert cli.eligibility.readiness_review(
[review], head, (LOGIN,), repo=REPO, number=7, base_branch="main") is review
assert cli._pr_markers([review], head, (LOGIN,)) == [cli.Marker(head, "primary", "COMMENTED")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Exercise the budget counter with two markers inside the leading block

The new budget assertion also passes with the old whole-body search because the genuine marker comes first. Add a case with a second review marker on the next machine-block line and assert that _pr_markers returns an empty list and both eligibility readers return None. This pins the boundary that distinguishes duplicate metadata from a quoted marker.

Publication recovery now matches reviews on other commits only by the
review marker opening their leading block, so a marker quoted in another
review's findings no longer blocks or conflicts with a repost. A test
pins that a second marker inside the leading block voids the review.

Refs #1105

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@loopzero-feder-positronics loopzero-feder-positronics Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loopzero delta review by codex on e633fbf32938b9e5cc598c88b4d7aa80d36eda03, 20.4s: approve (0 critical, 0 important, 1 suggestion)

Settings per native call (launch configuration and CLI claims, not backend attestation):

  • Call 1: requested model gpt-6.2-astra (effort medium); CLI-reported model gpt-6.2-astra (effort medium); configured model gpt-6.2-astra (effort medium)

Findings without a file location:

  • suggestion: Remove the unused CLI marker-regex alias — Switching recovery to eligibility.leading_marker removes the last production use of cli.REVIEW_MARKER_RE. Only two assertions in tests/test_cli.py still use the alias. Point them at runners.REVIEW_MARKER_RE and remove the CLI alias.
Raw reviewer output
Native Codex transcript retained in the restricted local review receipt; public evidence is publisher-derived, not backend attestation. Exact raw SHA256: 4eae5d5677602299cbbf7633b58b8dc52c3e51200b836d92f2a55b0a147635f8

@eowca
eowca marked this pull request as ready for review November 26, 2026 01:38
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

✅ Merged into main as 5bbce07 at 01:43 UTC

4 min in the queue, 3 min of it CI.

So far

  • ✅ Entered the queue Thu 26 Nov, 01:39 · rule main · triggered by @eowca with the @mergifyio queue command
  • ✅ Passed · draft #1317
  • ✅ Merged 01:43 · 5bbce07 · squash
3 merge conditions met
  • github-review-approved · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = checks
    • check-neutral = checks
    • check-skipped = checks
  • any of · required by GitHub repository ruleset rule main: PR only, Mergify queue, existing checks required:
    • check-success = Loop-zero Eligibility
    • check-neutral = Loop-zero Eligibility
    • check-skipped = Loop-zero Eligibility

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot added the queued label Nov 26, 2026
@eowca

eowca commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

No description provided.

@mergify
mergify Bot merged commit 5bbce07 into main Nov 26, 2026
13 checks passed
@mergify mergify Bot removed the queued label Nov 26, 2026
@eowca
eowca deleted the lean178/1105-leading-block-eligibility branch November 26, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: Judge review eligibility on the leading machine block, not model prose

1 participant