fix(agents): pr-reviewer label match — comma-separated, no anchored regex #78

Merged
navigator merged 1 commit from fix/pr-reviewer-label-detect into main 2026-05-25 21:11:40 -03:00
Owner

Summary

After #70 landed, pr-reviewer kept re-reviewing PR #77 every 120 s — four times in seven minutes, all producing the same review:findings verdict and posting the same comment. The PR was already labelled review:findings, so the gate should have skipped it.

Root cause: needs_review did anchored regex (grep '^review:pass$') against a labels string the main loop built from jq '... | join("\n")' + awk 'gsub(/\n/, "\t", $2)'. The multi-line jq output broke the read loop's record framing — labels arrived split across read iterations, so the variable contained one token at a time and the anchored regex didn't see what the function intended.

Net: claude usage burned 4× on a PR with an already-filed verdict.

Change

  • jq joins labels with , (single line per PR).
  • Read loop drops the awk pass.
  • needs_review does strict case membership against ,labels, sentinel — no regex, no word-boundary surprises.

Test plan

  • bash -n clean
  • Inline case smoke test against ,ready-for-review,review:findings, correctly reports skip
  • After merge + service restart: confirm no further review comments on #77 (it already has review:findings)

Notes

Off-limits per ADR-017 (infra/ops/agents/**) — manually merged.

## Summary After #70 landed, `pr-reviewer` kept re-reviewing PR #77 every 120 s — four times in seven minutes, all producing the same `review:findings` verdict and posting the same comment. The PR was already labelled `review:findings`, so the gate should have skipped it. Root cause: `needs_review` did anchored regex (`grep '^review:pass$'`) against a labels string the main loop built from `jq '... | join("\n")'` + `awk 'gsub(/\n/, "\t", $2)'`. The multi-line jq output broke the read loop's record framing — labels arrived split across `read` iterations, so the variable contained one token at a time and the anchored regex didn't see what the function intended. Net: claude usage burned 4× on a PR with an already-filed verdict. ## Change - `jq` joins labels with `,` (single line per PR). - Read loop drops the awk pass. - `needs_review` does strict `case` membership against `,labels,` sentinel — no regex, no word-boundary surprises. ## Test plan - [x] `bash -n` clean - [x] Inline `case` smoke test against `,ready-for-review,review:findings,` correctly reports `skip` - [ ] After merge + service restart: confirm no further review comments on #77 (it already has `review:findings`) ## Notes Off-limits per ADR-017 (`infra/ops/agents/**`) — manually merged.
fix(agents): pr-reviewer label match — comma-separated, no anchored regex
All checks were successful
build / scalafmt-check (pull_request) Successful in 3s
build / sbt-compile (pull_request) Successful in 3s
build / shell-lint (pull_request) Successful in 19s
786be7876c
The earlier `needs_review` used `grep '^review:pass$'` against a labels
string the main loop assembled from a jq `join("\n")` plus an awk
`gsub(/\n/, "\t", $2)` round-trip. In practice the gsub did not see the
embedded newlines as boundaries the way the regex assumed, and the
multi-line jq output broke up records so the read loop saw labels split
across iterations — leaving `labels` as a single token like
`ready-for-review` even when the PR also carried `review:findings`.

Net effect: pr-reviewer kept re-reviewing PR #77 every poll cycle even
after labelling it `review:findings` four times — burning claude usage
on a verdict that was already filed.

Fix: jq now joins labels with `,`, the read loop drops the awk pass,
and `needs_review` does strict shell case membership against
`,labels,` sentinel — no regex anchors, no word-boundary surprises.
fluidpop-bot approved these changes 2026-05-25 21:11:15 -03:00
Dismissed
fluidpop-bot left a comment
Collaborator

CI green (head 786be7876c), auto-approving

CI green (head 786be7876c2c01c4fea0609d7822a6841ef7b3ad), auto-approving
navigator force-pushed fix/pr-reviewer-label-detect from 786be7876c
All checks were successful
build / scalafmt-check (pull_request) Successful in 3s
build / sbt-compile (pull_request) Successful in 3s
build / shell-lint (pull_request) Successful in 19s
to 19d4d0147e
All checks were successful
build / scalafmt-check (pull_request) Successful in 3s
build / sbt-compile (pull_request) Successful in 3s
build / shell-lint (pull_request) Successful in 10s
2026-05-25 21:11:18 -03:00
Compare
fluidpop-bot left a comment
Collaborator

CI green (head 19d4d0147e), auto-approving

CI green (head 19d4d0147e5541e686b8739dbc54f0a3607d0174), auto-approving
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
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
Fluid/fluidpop-v1!78
No description provided.