The review pass links the wrong issue when a PR body quotes an issue reference #498

Open
opened 2026-08-09 21:29:21 +00:00 by igor · 0 comments
Collaborator

review_closed_issue_number (lib/review.sh:55) takes the first
close/fix/resolve + #N match anywhere in the PR body:

grep -oiE '(^|[^[:alnum:]])(close[sd]?|fix(e[sd])?|resolve[sd]?)[[:space:]]+#[0-9]+' | head -1

On PR #497 that picked up #490 -- a README/Mirrors docs ticket -- because
the body's root-cause trace quotes the example phrase "This PR fixes #490 by
adding the missing guard" many lines above the actual Part of #496 line.
The shadow reviewer then read #490's text as the requirement and said so
explicitly: it could not verify the PR's deliverables against the real ticket.

It only bites PRs whose body discusses an issue reference rather than only
declaring one, which is rare but not exotic -- any fix to the closing-keyword
machinery is going to quote one. Two directions, both cheap:

  1. Prefer the last match instead of the first. The harness-appended
    Closes #N line goes at the bottom, so it would win over prose above it.
  2. Stamp an explicit <!-- agent-issue=N --> marker at PR open and read that
    first, falling back to the keyword scan.

(2) is unambiguous; (1) is a one-word change. Which do you want, or is this
not worth spending on?

Filed from the #497 rework round -- no code change made there.

<!-- agent:question --> `review_closed_issue_number` (`lib/review.sh:55`) takes the **first** close/fix/resolve + `#N` match anywhere in the PR body: ```sh grep -oiE '(^|[^[:alnum:]])(close[sd]?|fix(e[sd])?|resolve[sd]?)[[:space:]]+#[0-9]+' | head -1 ``` On PR #497 that picked up **#490** -- a README/Mirrors docs ticket -- because the body's root-cause trace quotes the example phrase "This PR fixes #490 by adding the missing guard" many lines above the actual `Part of #496` line. The shadow reviewer then read #490's text as the requirement and said so explicitly: it could not verify the PR's deliverables against the real ticket. It only bites PRs whose body *discusses* an issue reference rather than only declaring one, which is rare but not exotic -- any fix to the closing-keyword machinery is going to quote one. Two directions, both cheap: 1. Prefer the **last** match instead of the first. The harness-appended `Closes #N` line goes at the bottom, so it would win over prose above it. 2. Stamp an explicit `<!-- agent-issue=N -->` marker at PR open and read that first, falling back to the keyword scan. (2) is unambiguous; (1) is a one-word change. Which do you want, or is this not worth spending on? Filed from the #497 rework round -- no code change made there.
igor self-assigned this 2026-08-09 23:28:17 +00:00
igor added spent time 2026-08-09 23:36:32 +00:00
7 minutes 53 seconds
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Total time spent: 7 minutes 53 seconds
igor
7 minutes 53 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joshtronic/igor#498
No description provided.