Skip to content

Build round 2 and later on the last code review - #9

Merged
catalan-adobe merged 40 commits into
mainfrom
review-incremental-rounds
Nov 28, 2026
Merged

catalan-adobe merged 40 commits into
mainfrom
review-incremental-rounds

Conversation

@catalan-adobe

@catalan-adobe catalan-adobe commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

What this does

Round 2 and later build on the last code review instead of starting over. Open blocking findings can now reach zero, and the loop check from the previous PR reads open counts instead of found counts. Stacked on the previous PR (records and loop check).

1. Earlier findings are re-checked by ID

  • The reviewer gets the open findings of the last code review (context/previous-findings.md, ID · severity · file:line · title) and that review's text.
  • Each comes back fixed, open or declined. Declined needs a reason from the PR discussion, quoted (a reason field in the findings block; without one the finding stays open). A finding fixed earlier that comes back is regressed: the file also lists the findings fixed in that round, so one that returns keeps its ID.
  • IDs belong to the script: new findings get the next F<n>, Later items L<n>. A finding the reply leaves out is kept open with "unverified": true. Duplicates, unknown IDs and bad statuses are handled, and an ID is never given twice (last_ids).

2. What changed since then is reviewed in full

lib/delta.sh picks how to show it:

  • incremental: git diff <previous head>..<head>.
  • The author merged the base branch in: the diff starts from the previous head merged onto the new base (git merge-tree --write-tree), so what the base brought is left out. If that merge conflicts, a full round (a range-diff would hide the resolution).
  • rebased: git range-diff of the old and new versions of the PR.
  • full: anything else (previous head gone after a force-push, no earlier code review, a record whose findings list was cut, a file list that can't be built, …), and it says why. Previous SHAs are used only as full hex commit IDs.

A missing previous commit is fetched by SHA once; a shallow clone is deepened once when needed.

3. Only Critical findings outside what changed

In code the delta didn't touch, the reviewer raises only Critical findings and says why earlier rounds missed them. Important and Minor issues there go to a folded Later list, which doesn't block.

4. The owner pass carries its verdict

It gets its previous Approach section and what changed, and keeps the verdict in one short section unless something changes it. After a Rethink it judges afresh. The verdict line still decides.

5. The progress line, and --full

  • The posted review opens with a progress line, counted from the record:
    ### Round 3 · since round 2 / 5 fixed · 2 still open · 2 new (2 in the new commits) · 1 declined · open blocking: 3 (was 7) · loop: converging.
    It replaces the loop line, and adds the suggested move when the loop is Nit loop or Churning.
  • "Ready to merge? Yes" while blocking findings are open posts as a comment (ready_overridden in the record).
  • --full forces a full review; earlier findings are still re-checked, so IDs and counts stay comparable.

Tests

  • tests/delta.sh (33 checks, real git on local bare repos, no network): new commits, a merged base (clean and with conflicts), a rebase onto a moved base, a force-push with the old head gone, no previous round, a shallow clone, GIT_AUTH set and unset.
  • tests/records.sh (125): every status rule, a round 3 on a round 2 with every status, the progress line, and backfill not carrying the round before.
  • tests/flow.sh (98): the prompts per mode (rules 1 to 3, rule 1 only, none on round 1), the context files, the owner's previous verdict, statuses and IDs in round.json, the progress line, the ready override, unverified findings, --full.
  • The whole suite passes on macOS and in an Ubuntu 24.04 container (git 2.43, mawk, jq 1.7).

Checked on a real PR

adobe/skills#823, round 3 on top of two backfilled rounds:

  • Preview: incremental since round 2 (the author had merged main). 8 of 8 earlier findings accounted for: 5 fixed, 2 open, 1 declined with the author's reason quoted. 2 new. Open blocking 3 (was 7), label converging. The progress line matched round.json.
  • Posted as a comment: rounds reads round 3 back from its marker, and --check then says "no new commits since round 3" (exit 5).
  • The checks found two bugs, fixed here with tests: backfill carried every earlier finding forward, and a merge of main counted as the author's change (32 files instead of 11).

Limits

  • No real rebase between two rounds was at hand; tests/delta.sh covers it with real git.
  • Regressions are caught for findings fixed in the last code review, not older ones.
  • Until local worktrees land, the checkout is still a fresh depth-50 clone per run.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Approach

What it does: Later rounds re-check earlier findings by ID and review what changed since the last code review. The progress summary and loop check use the same open-finding counts.

Fit with the repo: The module split fits: lib/delta.sh selects the Git comparison, lib/records.jq owns finding IDs and counts, and lib/loop.jq needs no change. One contract is missing. The base plan, docs/superpowers/plans/2026-11-26-review-tracking-pr2-incremental-rounds.md, calls for a full review when the previous record is unusable. A size-capped marker can retain the SHA and blocking count but omit the findings. gh-pr-review treats that like an empty list: it can restrict review to the delta even though known blockers were never re-checked.

Strongest case for the approach as built: A complete record gives the reviewer both a baseline and a checklist without a second tracking system. The posted round on adobe/skills#823 accounted for all eight prior findings and reported “open blocking: 3 (was 7).”

Alternatives: Keep this design, but distinguish a missing findings list from a present, empty one before selecting incremental mode. A full review costs more on a truncated round; as-is, the cheaper round can report progress that the record cannot support.

Questions for the author: Can a counts-only marker be paired with its complete findings before the prompt is built? Either that guarantee or the full-review fallback would resolve my concern.

Missing context: None material to this decision.

Approach: Questionable

Strengths

  • lib/delta.sh:31–41 — Comparing the current head with the previous head merged onto the new base correctly excludes upstream-only changes. tests/delta.sh:118–125 checks the actual file list, not just the selected mode.
  • lib/records.jq:119–143 — Omitted open findings retain their IDs, stay blocking, and are marked unverified. The progress summary and loop check can use the same counts.
  • All nine test scripts passed locally. The issues below concern cases the suite does not distinguish.

Issues

🚨 Critical (Must Fix Before Merge)

  • gh-pr-review:472–487 — A counts-only marker can turn unresolved blockers into an automatic approval. lib/records.jq:240 deliberately drops findings when the marker is too large; tests/records.sh:243–246 confirms that the blocking count survives. On the next run, .findings[]? yields zero entries, but the retained head still selects incremental mode. An untouched Important blocker is then outside the review scope, and an empty reply can produce open blocking: 0 (was 3) and an approval without re-checking it. Recover the complete record or select full with an explicit reason. Distinguish a missing list from a verified empty one before building either prompt.

⚠️ Important (Should Fix)

  • lib/delta.sh:69–71 — The conflict fallback can omit the author’s conflict resolution. In a local Git test where the merge commit introduced a new resolution, the selected range-diff showed only the original feature commit marked =. Ordinary range-diff skips merge commits; the owner can therefore carry its verdict without seeing the change. Include a merge-resolution diff or fall back to full. Extend tests/delta.sh:147–149 to assert that the resolution text is visible, not just that the command starts with git range-diff.

  • lib/delta.sh:122–136 — Marker values reach Git without being validated as commit IDs. The previous head and base come from review-body JSON. A symbolic revision can resolve against the current checkout, and an unresolved value is passed to git fetch, where Git can interpret it as an option or refspec rather than an object ID. Validate full hexadecimal object IDs before either operation; use GitHub’s review commit metadata to check the claimed head where available.

  • gh-pr-review:504–518 — Fixing the last open finding disables regression tracking for the next round. If round 2 fixes F1 and nothing remains open, neither context file is written. If round 3 reintroduces the problem, the reviewer has no regression checklist and can report it under a new ID. Emit context when there are open or recently fixed findings. At gh-pr-review:1005–1007, distinguish mandatory open IDs from fixed IDs that should appear only if they regress.

  • gh-pr-review:1094–1099 — The Markdown fallback double-counts earlier findings. With a missing or invalid JSON block, parsing a later-round bullet such as F1 · [file:line] loses its ID. _track allocates a new ID and also carries F1 as unverified, counting one blocker twice. Folded Fixed and Later bullets can also be parsed under the preceding Minor heading. Make the fallback recognize the later-round format and exclude folded sections from the open list.

  • lib/records.jq:99–112 — Invalid model output can remove a blocker from the approval calculation. A known ID marked declined is accepted without a quote, and a new Critical finding marked later: true goes to the nonblocking list, even in --full mode. The latter produces open_blocking: 0 and ready_overridden: false. Require discussion evidence for a decline, and allow Later only for eligible non-Critical findings outside the delta; otherwise keep the finding open.

  • gh-pr-review:457–460 — The CLI exits before shallow-history recovery can run. When the PR/base merge-base is just beyond depth 50, the script exits before calling pick_delta. The shallow test bypasses this exact condition by supplying the known base at tests/delta.sh:242–245. Deepen the PR and base histories once and retry the initial merge-base lookup before refusing the review.

  • lib/delta.sh:154–158 and gh-pr-review:487 — An unreliable file list is treated as proof that files were untouched. I reproduced a rebase that changed a binary fixture: stripping the index line made the old and new binary diff summaries identical, so changed_files returned nothing. The caller also silently substitutes an empty file if enumeration fails. Compare binary changes using blob information or binary patches, propagate enumeration errors, and select full rather than applying the Critical-only rule to an unknown scope.

  • gh-pr-review:1117–1126 — Record construction can fail without triggering its warning. Because write_round_record is called under if !, Bash does not stop on intermediate failures. If build_record or the final jq fails, the trailing rm -f can still return success, leaving an empty record and no functioning approval guard. Check each required step explicitly, validate the finished record before publishing it, and default to a comment if the blocking count cannot be established.

  • lib/records.jq:90–95 — Existing histories can still reuse finding IDs after upgrade. Older markers have no last_ids. If round 1 used F1 and the last pre-upgrade review had an empty findings array, the next new finding is assigned F1 again. Seed the counters from the maximum IDs in the available history when the previous record has no last_ids; keep using only the last code review for status tracking.

💡 Minor (Nice to Have)

  • README.md:196–199 — The loop-check section still says a warning posts the old **Loop:** line, contradicting the new progress-line example. Show the progress line and **Next:** suggestion instead.

Recommendations

Add end-to-end fixtures that carry the serialized GitHub marker into the next run, especially for a capped marker and a round with only fixed findings. For Git comparisons, assert what content the reviewer actually receives. A successful command and a plausible mode name are not enough to establish that the review covered the change.

Assessment

Ready to merge? No

Reasoning: The normal incremental path works, but incomplete records can produce an approval without re-checking known blockers, and the conflict fallback can hide the change the reviewer most needs to see. Both need conservative fallbacks before the recorded progress can be trusted.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

Integration on top of the conflict resolutions:
- New finding IDs start after both the history's ID floor (#8) and the last code review's numbers (#9's statuses).
- write_round_record keeps #9's baseline and this round's loop label, with #8's step checks and record validation.
- The body is assembled again when a round is renumbered before posting, so the progress line names the new round.
- round_body finds generated reviews with the same first-line test as fetch_round_records.
- findings_block_ok lets an entry with an earlier ID give only its status; the rest comes from the last record.
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for the review. All items are addressed in the commits pushed since; each fix has a test. This branch also merges the fixes of #8's review.

Critical: a record without its findings list. A last code review whose findings list is missing, or was cut from the marker (findings_dropped), is not a baseline: the round is full, with the reason "the last record lost its findings to the size cap". No IDs are re-checked, nothing is carried, and there is no "(was N)". A present but empty list stays incremental. The marker also cuts in steps now (locations before the list), so the list survives longer.

Important

  • Conflict fallback: a base merge that conflicts now gives a full round. The test checks that the resolution is in what the reviewer gets.
  • SHAs from markers: a previous head or base is used only as a full 40- or 64-character hex ID, checked before any git call. --end-of-options guards rev-parse and fetch. On read, GitHub's commit_id overrides the marker's head.
  • Regression tracking: the context is written when the last review has open or fixed findings. Open IDs must each come back with a status; fixed IDs are reported only if the problem is back. With only fixed findings, rule 1 asks whether any came back.
  • Markdown fallback: parse_findings reads **F1 · file:line** items with their ID, and leaves the folded sections out of the open findings. The Fixed section gives its IDs as fixed, or declined with the quoted reason. Later items are left out rather than parsed: their bullets carry no severity.
  • Model output can't drop a blocker: Later applies only to a new Important or Minor finding outside the delta, in an incremental or rebased round. A decline needs a non-empty reason (new field in the findings block); otherwise the finding stays open and unverified.
  • Shallow merge-base: the PR branch and the base are deepened once (separately; one fetch with both refs left the base shallow) and the merge-base is retried before refusing.
  • File list: binary files are compared by blob ID. A failed enumeration makes the round full instead of writing an empty list.
  • Record construction: every step is checked and the record validated before use; without one, an automatic approve posts as a comment (fixed in Record each review round, and stop review loops that don't converge #8, where that code lives).
  • IDs after the upgrade: new IDs start after the highest ID in the whole history, seeded from older markers' IDs (fixed in Record each review round, and stop review loops that don't converge #8).

Minor: the README's loop-check section now shows the progress line with **Next:**, and the one-line **Loop:** form only as the fallback without a record.

Recommendation: the end-to-end test from #8 now carries a posted body through the REST stub into the next command. The capped-marker and fixed-only rounds have their own flow tests.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Approach

What it does: Later rounds re-check earlier findings by ID, review what changed since the last code review, and report how many blockers remain.

Fit with the repo: The module split matches docs/superpowers/plans/2026-11-26-review-tracking-pr2-incremental-rounds.md: lib/delta.sh selects the Git comparison, lib/records.jq owns IDs and counts, and lib/loop.jq needs no change. One inherited policy no longer fits. tests/flow.sh explicitly allows a review based on round 1 to post as round 3 after another reviewer posts round 2. Renumbering prevents ID collisions, but a blocker first raised in round 2 can disappear from round 3’s open count without being checked. The plan promises: “Nothing disappears silently.”

Strongest case for the approach as built: One round record serves both the reviewer and the loop check. The reported run on adobe/skills#823 accounted for all eight prior findings. The earlier concern about a size-capped marker is also resolved: a missing findings list now triggers a full review.

Alternatives: Keep the design, but use the existing exit-6 path in interactive runs too when an intervening code review changes the baseline. That costs a rerun. Posting as-is saves the model call but makes the latest record incomplete.

Questions for the author: Is there a reason to keep “Post anyway” for incremental reviews? I’d support it if blockers introduced by the intervening round remained open as unverified.

Missing context: None material.

Approach: Questionable

Strengths

  • lib/delta.sh:40–55 — Comparing against the synthetic merge tree excludes upstream-only changes. The conflict test at tests/delta.sh:147–155 checks that the reviewer can actually see the author’s resolution, not merely that the script selected full.
  • lib/records.jq:183–189 — An omitted open finding normally keeps its ID and remains unverified. That gives the progress line and approval decision a common source of truth rather than relying on the model’s prose.
  • All nine test scripts passed locally under Bash 5.3. The findings below concern cases the passing suite does not distinguish.

Issues

🚨 Critical (Must Fix Before Merge)

  • gh-pr-review:512–513, gh-pr-review:1330 — A push during the review can mark an unreviewed commit as reviewed. The model reviews checkout A, but the post does not specify A as the review commit. If the author pushes B before submission, GitHub can attach the review—including an approval—to B. On readback, lib/rounds.sh:34–36 replaces the marker’s A with GitHub’s B. --check can then report nothing new, and a later incremental round starts at B, skipping A→B entirely.

    • Fix: Submit the review with commit_id explicitly set to HEAD_SHA. Add a flow test that advances the remote head during the model call and verifies B still needs review.
  • lib/records.jq:292–297, gh-pr-review:1322–1325 — Losing the entire marker can still erase an open blocker. The earlier fix correctly handles a present marker with no findings list. It does not handle a later-round body that leaves no room for a marker at all. I round-tripped a 59,776-character body whose record carried one omitted Important finding: the original open_blocking was 1, backfill reconstructed 0, and has_findings_list returned true. The Markdown mentions the unverified count but has no issue bullet for backfill to recover. The next incremental round can approve without rechecking it.

    • Fix: Distinguish markerless incremental reviews from historical standalone reviews. Preserve a minimal “baseline unavailable” marker, or recognize the later-round body on readback and force a full review rather than treating its reconstructed empty array as verified.

⚠️ Important (Should Fix)

  • gh-pr-review:1295–1303 — Renumbering after an overlapping review loses intervening blockers. This path refreshes RECORDS and ID_FLOOR, but write_round_record still uses the original FINDINGS_BASE. If round 2 introduced an Important F5, the pending review can post as round 3 with a new F6, no F5, and an approval. tests/flow.sh:442–445 explicitly expects the approval and the round-1 baseline.

    • Fix: Take the existing exit-6 path when the last code review changed, including in a terminal. If posting anyway is retained, reconcile intervening findings as unverified and recompute the decision before posting.
  • lib/records.jq:104–106, lib/records.jq:172 — An invented ID can make a visible finding disappear. The block validator treats any string ID as known and permits missing severity. I checked {"id":"F999","status":"open","title":"Nil dereference"} against an empty baseline: validation succeeded, then _track dropped the entry. Even if the Markdown lists it under Critical, the fallback never runs and the record reports zero blockers.

    • Fix: Allow status-only entries only for IDs actually present in the selected baseline. An unknown ID must meet the new-finding requirements or trigger Markdown fallback.
  • lib/records.jq:162–169 — An invalid decline can still remove a blocker from the count. The new reason check keeps the status open, but the same rejected entry can lower the severity. For a previously Critical F1, I tested {"id":"F1","status":"declined","severity":"minor"} with no reason. The result was open, unverified: true, open_blocking: 0, and ready_overridden: false.

    • Fix: When a status update is rejected as unverified, retain the previous severity rather than accepting a downgrade from that entry.
  • lib/records.jq:134–135, lib/records.jq:173–176 — Later eligibility is not checked against the actual changed files. Missing or malformed in_delta becomes false. An Important finding marked later:true can therefore become nonblocking even when its file is explicitly in delta-files.txt. The new Critical/full-mode guards work, but they do not protect this changed-file case.

    • Fix: Check Later candidates against the computed file list. A touched or unidentified path should stay in the findings list unless the script can establish that it is outside the delta.
  • lib/delta.sh:43–60 — Retargeting a stacked PR can exclude newly in-scope files. I tested a child PR originally targeting its parent branch, then retargeted it to main and added a child commit. The selector returned incremental with only child.txt; the new PR also contained parent.txt, which was outside the previous review. An Important issue there is now assigned to Later as though the file had already been reviewed.

    • Fix: Compare the previous and current merge bases before choosing the plain head-to-head diff. If the base moved backward or sideways and expanded the PR, use a full review.
  • lib/delta.sh:188–195 — Rebase normalization can hide a change moved to the wrong location. The binary-file fix does not cover repeated text. In a real Git rebase test, I moved an edit from the first of two identical indented blocks to the second. The hunk moved from line 1 to line 9, but stripping the hunk coordinates made the patches identical and changed_files returned an empty list.

    • Fix: At minimum, when the file’s base blob is unchanged, compare the old and new head blobs directly. When a moved hunk cannot be confidently attributed to upstream movement, include the file rather than excluding it.

💡 Minor (Nice to Have)

  • tests/delta.sh:308 — ${prev_head^^} is unsupported by macOS’s system Bash 3.2. Running /bin/bash tests/delta.sh printed bad substitution but returned success, skipping the invalid-SHA loop. Use tr to construct the uppercase fixture so those checks actually run.

Recommendations

Extend the producer-to-consumer tests through one more code-review round, not just rounds or --check. Assert that the next reviewer receives the correct commit range and enough information to identify each carried blocker. In particular, a marker that does fit can still strip an omitted finding’s file and title because neither appears in the current body (lib/records.jq:316–322); recover those public details from an earlier round by ID when building the checklist.

Assessment

Ready to merge? No

Reasoning: The normal incremental path works, but a concurrent push or a markerless round can establish a false baseline that later reviews trust. Those paths need to preserve the reviewed commit and unresolved blockers before the progress line can safely drive approvals.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

Integration on top of the conflict resolutions:
- The findings block is accepted when it is valid against the last code review's IDs and covers every blocker the
  Markdown shows; status-only entries take their severity from the last review for that check (with_base_severity).
- The overlap path is #8's: no renumbering, nothing posted when another round landed (exit 6).
- The flow tests' git stub takes its head from the same heads file as the pr view stub, so the reviewed commit and
  the PR head agree unless a test moves the head on purpose.
- The markerless later-round test uses a body that leaves no room even for #8's minimal marker, and the review's
  59,776-character case now checks that minimal marker.
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for the second round. All items are addressed in the commits pushed since; each fix has a test. This branch merges #8's second-round fixes too.

Approach (posting over an intervening round): agreed. "Post anyway as round N?" is gone: when another round landed while this one ran, nothing is posted, in a terminal too (exit 6). The rerun builds on the new round, so its blockers are checked.

Critical

  • A push during the review: fixed in Record each review round, and stop review loops that don't converge #8. The review is posted with commit_id = the reviewed commit, a moved head is never approved, and the record keeps the reviewed SHA, so the new head stays eligible.
  • A round without any marker:
    • When even the counts don't fit, Record each review round, and stop review loops that don't converge #8 now posts a minimal marker with findings_dropped, so the next round is full.
    • When nothing fits at all, backfill_record recognizes a later-round body (the progress line, or the folded Fixed/Later sections) and gives it no findings list: the next round is full, with the reason. It also keeps the progress line's open blocking count, so your 59,776-character case reads back as 1 blocker, not a verified 0.

Important

  • Invented IDs: a status-only entry is accepted only for an ID the last code review has. Any other ID needs a severity and a title, or the round falls back to the Markdown. Status-only entries take their severity from the last review for the Markdown cross-check, so an open earlier blocker still counts.
  • Rejected decline: an unverified status update keeps the previous severity.
  • Later vs changed files: a Later candidate is accepted only when its file is known and outside the files the delta touched.
  • Retargeted stacked PR: if the previous base isn't an ancestor of the current base, the round is full ("the PR's base changed"). Real-git test with a child PR retargeted to main.
  • Moved hunk after a rebase: when the base left a file alone, its old and new head versions are compared directly.

Minor: the uppercase fixture uses tr. Every test file now fails if it stops before its end: under /bin/bash 3.2, 19 checks of tests/delta.sh had been skipped silently.

Recommendation: a flow test runs three posted rounds, each read back through the REST stub. It checks the commit range of round 3, and that a carried finding whose file and title the last marker omitted gets them back from earlier rounds by ID in previous-findings.md.

The moved-head note now follows the review's head block (the progress
lines, or the loop line), since #9 replaces the loop line with them.
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Merged #8's round-3 fixes in (25a0e57). One change specific to #9: when the PR moves during a review, the note now comes right after the review's head block. That block is the progress lines here, or the loop line when there's no record. Before, it was placed only after a **Loop:** line, which #9 replaces. 693 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04.

The findings-block check takes both sides: exactly one array, empty
Markdown sections are authoritative (#8), and status-only entries for
the last code review's IDs take its severity (#9).
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Merged #8's round-4 fixes in (a69aaf3). The findings-block check combines both: exactly one array and authoritative empty Markdown sections (#8), plus severities from the last code review for status-only entries (#9). 739 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04.

#8's stored_status/stored_findings made one function decide the status a
findings-block entry is stored with, for the builder and the block checks.
Here the builder is _track, so its per-entry decision moves into
entry_outcome($known; $later_files), used by _track and by
stored_findings($base; $later_files). write_round_record judges the block
with stored_findings before block_covers_markdown and block_respects_empty:
a declined entry without a reason or an unhonoured Later is open, one stored
fixed, declined or Later is not. Carried findings take no part.
with_base_severity is gone (entry_outcome takes the base severity), and the
block checks and _findings_counts read a stored list as it is.

parse_findings keeps #9's IDs and <details> sections and counts #8's plain
bullets. A minimal marker on a later round keeps the backfill counts from
its progress line instead of recounting the Markdown, which leaves out
carried findings.
round_body picked the n-th generated review from the discussion without
the trusted-reviewer filter the rounds use, so an outsider's review
posted before the previous round shifted it out of place.
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Merged #8's round-5 fixes in (a08e13f), plus one fix of my own (943a157).

  • One decision for storage and checks: entry_outcome now decides how a findings-block entry is stored. That covers fixed, declined only with a reason, open or regressed against the last code review, and Later only for a new Important or Minor finding outside the delta. Both _track and the block checks (stored_findings) use it, so the checks judge the entries exactly as the record stores them. This is Record each review round, and stop review loops that don't converge #8's F24 fix carried over to later rounds. New tests cover a declined Critical with and without a reason, a Later Critical, a fixed Critical and a carried finding.
  • The previous round's text skips outsiders: round_body now applies the same trust filter as the rounds. Before, an outsider's generated review posted before the previous round shifted which review was read as the previous one. The new test fails on the old code.

All 776 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04.

#8 splits writing a record from the model's block from reading a posted
one. Here the write side stays entry_outcome and stored_findings($base;
$later_files); block_covers_markdown and block_respects_empty take
($base; $later_files) and judge the block as stored_findings stores it,
built on #8's shared _open, _covers_markdown and _respects_empty.
findings_block_ok keeps #9's $ids. The read side is #8's record_findings,
record_counts, record_covers_markdown and record_respects_empty. Only
with_counts uses them. _findings_counts and _stored_open are gone.

For #9's later rounds: record_findings keeps the unverified flag, and
record_respects_empty skips unverified findings. The Markdown leaves
carried findings out, so its "none found" says nothing about them, yet
they still count. with_counts takes the progress line's open blocking
count (progress_blocking, shared with backfill_record) as a visible
blocker count. The critical + important sum, and a kept list's open
blockers, must reach it, and the Markdown fallback uses it.
markdown_counts now counts the parsed statuses (_counts): an ID shown
in the Fixed section is fixed or declined, not new. So round 5's
damaged-marker case with F28 set to fixed reads 5 fixed, as its
progress line says, not 0. A minimal marker keeps its backfill counts
on a later round (#9) and its null counts on a Rethink (#8).
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Merged #8's round-6 fixes in (356961f). #8's read/write split maps onto #9 like this:

  • Write (the model's block → a record): Build round 2 and later on the last code review #9's entry_outcome and stored_findings($base; $later_files). block_covers_markdown and block_respects_empty now take $base and $later_files and always judge stored_findings(…), never the raw block.
  • Read (a posted marker → a record): Record each review round, and stop review loops that don't converge #8's record_findings, record_counts, record_covers_markdown and record_respects_empty, used only by with_counts. Two changes for later rounds:
    • Carried (unverified) findings still count, but the empty-section check skips them, since the Markdown leaves them out.
    • A new progress_blocking reads the progress line's "open blocking" number, which the rebuilt counts must reach.
  • Shared: _drop_findings keeps both last_ids.F and last_ids.L, from the findings, the later list and any existing last_ids.
  • markdown_counts now counts the statuses the Markdown shows, so an ID in the Fixed section counts as fixed or declined, not new. This stops a later round's fixed items from pushing up the ID floor.

New tests cover a round-2 marker with fixed, declined, carried and new findings plus a Later item, with its counts, list or last_ids damaged. 805 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04.

@catalan-adobe
catalan-adobe changed the base branch from review-records-loop-check to main November 27, 2026 15:58
#10 reads a posted round in one way: a complete marker (numeric
open_blocking, critical, important and minor, open_blocking = critical +
important; or a Rethink) as it is, and any other marker from the
Markdown after the code-review boundary line, with findings_dropped and
#10's ID floor. Its decisions win where the two branches overlap.

Reading: #10's complete_marker path replaces #9's minimal-marker and
with_counts recovery. Gone with #10's deletions: with_counts,
markdown_counts, _drop_findings, record_findings, record_counts,
record_covers_markdown, record_respects_empty and _counts, with #9's
additions to them (the progress-line clauses, the unverified filter,
the status-aware markdown_counts). #9's later-round rule stays in
backfill_record: a later round's open blocking count is its progress
line's (progress_blocking), read on the whole body since the progress
line comes before the boundary. Findings and sections come from
code_review_part. The L floor is #10's (marker and backfill); backfill
now reserves one L ID per item of a later round's folded Later list, so
a marker without last_ids keeps its Later IDs as #10 keeps F IDs.

Writing: #9's entry_outcome, stored_findings($base; $later_files) and
block checks, fed from review-body.md, with #10's no_sections (null
counts in build_record), known_blockers (fail-closed automatic approve,
kept after #9's ready_overridden check) and posted_record (rebuilt after
the final downgrade). progress_line now prints "open blocking: unknown"
for null counts, so a parsed later round with no severity section never
reads back as 0.

Parser: #10's _lines (Issues scope, <details> folds with fence tracking,
indented headings, * and + items). _lines also tags a fold's own lines
with its kind (f: fixed/later/other, same Issues rule), and
parse_findings reads the Fixed fold from those lines: IDs as fixed, or
declined with the quoted reason. "**F1 · …" items keep their ID as open;
the Later fold stays out. A heading inside an unclosed <details> no
longer ends the fold (#10's rule).

Posted body: #10's assemble_review <head> <approach> <code review> with
the boundary; assemble_body passes the progress lines (+ **Next:**) or
the loop line as the head. The moved-head note still goes right after
REVIEW_HEAD, marker_line sizes the exact body, and round_body keeps the
trust filter and drops every '<!-- gh-pr-review' line, the boundary
included.

Tests: #9 tests of removed functions dropped or moved to #10's rule
(later-round marker shapes: full as written; every partial shape reads
the Markdown, 3 blockers via the progress line, findings dropped, F5/L1
floor kept). New: a producer-to-reader flow for a later round (fixed,
declined, carried, new and Later) read back with the full and both
minimal markers, and progress_line with unknown counts. Not fixed here:
issue #11.
@catalan-adobe

Copy link
Copy Markdown
Owner Author

Merged main in (bfb1206), which brings in #10 ("Read partial markers from the Markdown, and severity sections only in the Issues section"). Where the two overlap, #10's decisions win:

New tests: a round 2 with fixed, declined, carried, open, new and Later items, posted with the boundary and read back with the full and minimal markers.

900 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04. rounds output is unchanged against #9's previous head for gh-pr-review#8 and #10, and adobe/skills#813, #823, #831, #763 and #764.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Round 3 · since round 2

5 fixed · 4 still open · 4 new (4 in the new commits) · open blocking: 8 (was 8) · loop: churning · full review (the base branch was merged in with conflicts)
Next: Split the PR: each part converges on its own

Approach

What it does: Later rounds re-check findings from the last code review by ID, review what changed, and report how many blockers remain.

Fit with the repo: The round-2 concern is resolved. When the pre-post check sees an intervening round, gh-pr-review posts nothing and exits 6 rather than offering “Post anyway.” tests/flow.sh covers both terminal and scripted runs. The rerun starts from the intervening review, so its blockers are checked rather than silently skipped.

Strongest case for the approach as built: The split matches the incremental-rounds plan in docs/superpowers/plans/: lib/delta.sh selects the Git comparison, lib/records.jq owns finding IDs and counts, and lib/loop.jq uses those counts unchanged. The reported run on adobe/skills#823 accounted for all eight earlier findings.

Alternatives: Keeping the stale review would save a model call, but would require reconciling findings the reviewer never saw. A rerun is the simpler policy.

Questions for the author: None.
Missing context: None material.

Approach: Sound

Strengths

  • lib/delta.sh:63–74 excludes upstream-only changes when a base merge is clean and falls back to the whole PR when it conflicts. tests/delta.sh:147–155 checks that the reviewer can actually see the conflict resolution.
  • gh-pr-review:1415–1426 now refuses to post when the final history read sees an intervening round, and gh-pr-review:1486 pins the submission to the commit reviewed. These fix the two distinct posting races reported last round.
  • All 900 existing checks passed locally. The three-round test at tests/flow.sh:1215–1250 is especially useful: it verifies that a carried finding remains identifiable after its latest marker drops its title and path.

Issues

🚨 Critical (Must Fix Before Merge)

  • F13 · gh-pr-review:1250–1261 — A record-build failure can still erase blockers from the next review. The size-cap case is fixed, but when write_round_record fails, the posted body has neither a marker nor a progress line. If the reviewer omitted the earlier blockers and had no Fixed or Later fold, later_round_body cannot distinguish this from a standalone review. I exercised this with two earlier blockers: the failed-record round correctly posted a comment, but the next round ran incrementally and approved with zero findings.
    • Emit a later-round indicator independently of record construction. On readback, treat that round as having an unknown count and no usable findings list.

⚠️ Important (Should Fix)

  • F17 · gh-pr-review:1196–1208 — The changed-file check works, but Markdown fallback can undo it. I put one Important finding for d.js in the Later fold and its JSON entry, with d.js in delta-files.txt. The entry was correctly promoted to open, then rejected because the Markdown’s Important section said “none.” The parser ignored the Later fold, and the run posted APPROVE with source: parsed and zero blockers.

    • Preserve the promoted blocker when it matches a visible Later bullet, or treat the contradiction as unknown and post a comment. Test the final event, not just entry_outcome.
  • F18 · lib/delta.sh:42–58 — Retarget detection still skips backfilled reviews, which have no base_sha. I reran the stacked-PR fixture with the previous base absent: the whole PR contained child.txt and parent.txt, but the selector returned incremental with only child.txt. An Important issue in the newly in-scope parent code is then treated as already reviewed.

    • Recover the historical base when possible; otherwise use full when the previous review scope cannot be established.
  • F19 · lib/delta.sh:132–140 — A moved edit is still hidden if upstream touched the same file. The direct blob comparison fixes the unchanged-base case. I added an unrelated line at EOF in the fixture’s base commit and moved the PR edit between two identical blocks. The hunk moved from line 5 to line 10, but changed_files returned an empty list.

    • Compare against the old change applied to the new base, or conservatively include the file when the hunk movement cannot be attributed to upstream.
  • lib/records.jq:301 — Any nonblank decline reason is accepted, even if nobody said it. With no such reasons in the discussion, I supplied already covered and by design for an Important and a Critical finding. The run recorded both as declined and approved. The missing-reason check works; it does not establish the required discussion evidence.

    • Require the quoted passage to match an identifiable discussion comment or review. If it cannot be matched, retain the finding as open and unverified.
  • gh-pr-review:512 — Two submissions that both pass the final check before either lands can leave an incomplete baseline on readback. This is distinct from F14’s fixed “Post anyway” path. I supplied two records claiming round 2: the first introduced an Important F1, and the second had no blockers. reconcile_record renumbered the second round, but the next run selected it alone, received no previous-findings.md, and approved. Two distinct Later items also retained the same L1, because lib/records.jq:423–428 renumbers only new F findings.

    • When reading simultaneous submissions, carry intervening blockers as unverified or mark the later baseline unusable. Reconcile L IDs as well as F IDs.
  • lib/records.jq:570 — Recovering only the blocking total can change the loop’s advice from Churning to Approve. I round-tripped a third round with two carried blockers, one Critical. Its minimal marker recovered open_blocking: 2 from the progress line but critical: 0 from the empty visible section. lib/loop.jq:38 consequently classified it as a Nit loop and suggested approval rather than flagging the unresolved Critical.

    • Preserve the Critical count alongside the total, or treat the severity breakdown as unknown and withhold the Nit-loop recommendation when visible findings do not account for the total.
  • gh-pr-review:1371 — A failed override lookup is treated as “not overridden.” I made only that jq invocation fail: the posted event was APPROVE even though the record said open_blocking: 1 and ready_overridden: true. The final check at gh-pr-review:1458 accepts any numeric count, including 1.

    • Make automatic approval require a successful positive check that .counts.open_blocking == 0 on the final record. A nonzero count, an unknown count, and a read failure should all produce a comment.

💡 Minor (Nice to Have)

(none found)

Fixed since the last round (5)
  • F12 — The POST specifies the reviewed commit_id; a detected push downgrades approval, and the new head remains eligible.
  • F14 — An intervening round seen at the final history check now exits 6 without posting, in both terminal and scripted runs.
  • F15 — Only a baseline ID may omit severity and title; an invented status-only ID triggers Markdown fallback.
  • F16 — A rejected decline retains the earlier severity, so the rejected entry cannot downgrade a Critical blocker.
  • F20 — The uppercase SHA fixture now uses tr, and the test checks that it reached the end.

Recommendations

Extend the existing producer-to-consumer tests by combining failure paths: record construction fails and then another round runs; a changed-file Later entry conflicts with an empty severity section and then a decision is posted. Assert the next checklist and the posted event. Those two outputs exposed failures that the individual parser and record tests passed.

Assessment

Ready to merge? No

Reasoning: The ordinary incremental path and the commit-pinning fix work. The remaining failures can still hide newly in-scope code, lose known blockers between rounds, or post an approval that contradicts the final record.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for round 3, and for moving the approach to Sound. The loop check read this round as churning (10 → 8 → 8) and suggested a split. We chose instead to fix the five items below with conservative rules, and to move three to #12. If round 4 churns again, the loop check stops round 5 and we split. Five commits on top of bfb1206; each new test fails on bfb1206.

Critical

  • F13 — a failed record still marks a later round (86210e4)
    • When write_round_record fails in round 2 or later, the review still posts with a minimal marker: the round, findings_dropped: true, the history's last_ids, and counts with null values. marker_line's smallest fallback keeps the null count.
    • On readback, that round has unknown counts and no findings list. So the next round is full ("the last round has no record of its findings"), with no previous-round rules and no previous-findings.md. A full review re-reads the whole PR, so earlier blockers that still exist are found again.
    • Chain test: rounds 1–2 leave F1 and F3 open, round 3's record fails and it comments, and round 4 runs full.

Important

  • F17 — a promoted Later finding survives the cross-check (81c680d). An entry the model put under Later, but whose file is in the delta, is stored open. A matching bullet in the Markdown's Later fold (same file, and line or range when both have one) now covers it, so the block is kept. If a rejected block had such an entry anyway, the counts are unknown and the round comments. Your case gives source: model, 1 open blocker, posted COMMENT.
  • F18 — unknown previous base → full (78a5269). With no base_sha in the previous record (a backfilled round), pick_delta returns full ("the previous round's base is unknown"). The stacked-PR fixture without the base now reviews the whole PR.
  • F19 — a file the base also changed is always listed (d16d8c9). In a rebased round, a PR file the base changed between the two bases is listed whatever the hunks say. Files the base didn't touch are still compared by content. Your moved-edit fixture now lists the file. The patch comparison became dead code and is removed.
  • Approve only on a positive zero (c701fa7). An automatic approve now needs a successful read showing .counts.open_blocking is the number 0, both at the verdict and right before posting. A nonzero count, an unknown count or any failed check posts as comment, and the run says why. Your case (the ready_overridden lookup failing, 1 open blocker) gives COMMENT. An approve chosen at the prompt or with --decision approve is left alone.

Moved to #12, each needing a rare event or a design change:

  • Decline reasons not matched against the discussion: a design question.
  • Two submissions landing at the same instant, including the L IDs.
  • A minimal marker losing the Critical/Important split: only when body plus marker exceed 60,000 characters.

921 checks pass on macOS (bash 5 and 3.2) and Ubuntu 24.04, and shellcheck and shfmt are clean. rounds output (table and --json) is unchanged for gh-pr-review#8, #9 and #10, and adobe/skills#813, #823, #831, #763 and #764.

@catalan-adobe catalan-adobe left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Round 4 · since round 3

3 fixed · 2 still open · 1 new (1 in the new commits) · 3 declined · open blocking: 3 (was 8) · loop: converging

Approach

Unchanged since round 3: lib/delta.sh falls back to a full review when the previous base is unknown, and gh-pr-review requires the round record to show zero blockers before approving automatically, keeping scope selection and posting policy in their existing places.

Approach: Sound

Strengths

  • lib/delta.sh:28–31 and lib/delta.sh:132–139 fix the two scope errors from round 3: an unknown previous base selects a full review, and a rebased edit stays in scope when upstream also changed its file.
  • gh-pr-review:1492 checks the record being posted for zero blockers. I reproduced the failed ready_overridden lookup from round 3: with one blocker, the event and the record both said comment.
  • All 921 existing checks passed locally. The findings below come from additional cases exercised through the flow stubs, including reading the posted body back as the next round sees it.

Issues

🚨 Critical (Must Fix Before Merge)

(none found)

⚠️ Important (Should Fix)

  • F13 · gh-pr-review:1510–1512 — A failed record still reads back as a verified zero if the fallback marker does not fit. With two earlier blockers, a failed round-3 record build, and a 60,170-character posted body, the tool correctly posted COMMENT but emitted neither a marker nor a progress line. rounds --json then reported ready with [1,2,0]. This is less severe than last round: the missing base now forces round 4 to be full. But its progress line still claims (was 0) when the count was unknown.

    • Reserve room for an explicit unknown-count indicator independently of record construction, or decline to post when it cannot be preserved. Test the failed-record chain with a body that exceeds the marker budget.
  • F17 · lib/records.jq:323 and gh-pr-review:1215–1219 — The fix protects a new finding wrongly put under Later, but not a regressed one. I returned a previously fixed F1 as open, Important, and later: true, with a matching Later bullet at d.js:2 in the delta. entry_outcome classified it as regressed, so the .status == "new" check did not mark it as promoted. The empty Important section rejected the block, the Markdown fallback omitted the Later bullet, and the final event was APPROVE with source: parsed and zero blockers. A rejected two-array block containing a new Important for the same bullet also approved.

    • Match ineligible Later bullets against the delta independently of whether the block parses. Preserve a matched open or regressed ID; if a touched-file bullet cannot be accounted for, record an unknown count rather than zero.
  • lib/records.jq:343–347 — One visible Later bullet can validate multiple blockers that the Markdown says it does not have. With one bullet at d.js:2–6, I supplied an Important entry at line 2 and a different, unreported Critical entry at line 6. Both matched the same bullet via any; the record kept two blockers, one Critical, despite the explicitly empty Critical section. The extra finding gets an ID and becomes mandatory next round.

    • Match promoted entries to Later bullets one-to-one, as the ordinary blocker-location check already does. A bullet used to explain one exception to an empty section should not explain another.

💡 Minor (Nice to Have)

(none found)

Fixed since the last round (6)
  • F18 — An absent base_sha now selects full before the ancestor shortcut can exclude newly in-scope files.
  • F19 — Rebase file selection now includes a PR file whenever its base blob changed; identical-looking moved hunks no longer exclude it.
  • F21 — declined for this PR: “Decline reasons not matched against the discussion: a design question.” The verification policy is tracked in #12.
  • F22 — declined for this PR: “Two submissions landing at the same instant, including the L IDs.” The remaining simultaneous-post case is tracked in #12.
  • F23 — declined for this PR: “A minimal marker losing the Critical/Important split: only when body plus marker exceed 60,000 characters.” That severity-breakdown limitation is tracked in #12; F13 above concerns losing the total.
  • F24 — Automatic approval now requires a successful numeric-zero check both at verdict selection and immediately before posting.

Recommendations

Extend the existing flow fixtures along two dimensions: new versus regressed for a touched-file Later bullet, and marker fits versus does not fit for a failed record. Assert both the submitted event and the next reader’s count; either assertion alone misses one of the failures above.

Assessment

Ready to merge? No

Reasoning: The Git scope fixes and final approval guard work. The guard still receives a false zero when Markdown fallback drops a reported regression, and a markerless failed round can still appear ready in the history.


Review generated by gh pr-review · model: azure-openai-direct/gpt-6.2-astra

@catalan-adobe

Copy link
Copy Markdown
Owner Author

Thanks for round 4: converging, blocking down from 8 to 3, F18, F19 and F24 fixed, and the three moved items accepted. We're merging #9 here, the same way as #10. The three items left are in #12 with your suggested fixes and tests: F13's residual case (a failed record on a body near the size cap), F17's regressed-under-Later case, and the one-to-one matching of promoted entries to Later bullets. Each needs unusual model output or a double failure, and fixing F17 and the matching would grow the code those findings came from.

@catalan-adobe
catalan-adobe merged commit 666fbee into main Nov 28, 2026
1 check passed
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.

1 participant