---
name: review-retro
description: >
  For an MR I reviewed that another reviewer also reviewed: compares the
  threads the other reviewers started with my saved review reports, marks
  each caught, missed, or no report, and logs the misses to
  ~/projects/notes/review-gap-candidates.md for /skills-retro. Read-only on
  GitLab. Edits no skill.
argument-hint: "<mr-url-or-iid>"
disable-model-invocation: true
---

# Review retro

Find what another reviewer raised on an MR that my own review reports missed,
and log it. This is the reviewer-side twin of the skill-gap log that
`/address-reviewer-inputs` keeps for my own MRs. Post nothing, on any MR.

The target is `$ARGUMENTS`. If it is empty, ask for the MR.

## 1. Resolve the MR

Take the project and IID from the URL, or use the current repository's project
for a bare IID.

```bash
~/.claude/skills/glab-read/scripts/glab-read.py mr <iid> -R <group>/<project> \
  --fields iid,title,state,author,sha
glab api user | jq -r .username
```

When the MR's author is the glab user, stop: this is my own MR, and
`/address-reviewer-inputs` logs its gaps.

## 2. Find my reports

My reports for this MR sit in `~/projects/notes/mr-reviews/` as
`mr-<iid>-*.md`. The name holds no project, so a report counts only when the
MR title in its heading matches this MR's. The filename says which skill wrote
it (`review-branch`, `review-spec`, `review`, `self-review`). Note the head SHA
each report reviewed.

Stop and say so when the directory doesn't exist or no report matches: there
is nothing to compare, and the log would only repeat the threads.

## 3. Read the other reviewers' threads

```bash
~/.claude/skills/glab-read/scripts/glab-read.py threads <iid> -R <group>/<project> --max 1500
```

Resolved threads count, since a reviewer's finding is a finding after it's
fixed. Keep a thread whose first note's author is none of: the glab user, the
MR's author, a bot (`bot` as a word in the username, `GitLabDuo`, `duo-*`,
`ai-*`). Drop approvals, review summaries, thanks, and questions with no
defect behind them.

## 4. Classify

Mark each kept thread with the same four values `/address-reviewer-inputs`
uses:

- `caught`: a report holds a finding for the same defect. Cite its ID.
- `missed`: reports exist and none holds one.
- `no report`: none matches, or every matching report reviewed a head older
  than the code the thread names.
- `n/a`: a preference or a question that no check could ask.

When a report's `Held` or `Not verified` entry names the area a missed thread
is about, say which in the row's `Gap`: a `Held` entry means the check ran and
passed, a `Not verified` entry means it never ran.

Print one table:

| Thread | Reviewer | Anchor | What they found | Report and ID | State |
| --- | --- | --- | --- | --- | --- |

## 5. Log

Append one line for each `missed` or `no report` row to
`~/projects/notes/review-gap-candidates.md`, skipping a row whose project, MR
iid, and discussion id are already there. Create the file with this header when
it is missing:

```markdown
| Date | Project | MR | Thread | Gap | Report | Report state |
| --- | --- | --- | --- | --- | --- | --- |
```

`Project` is `<group>/<project>`. `Gap` is one sentence naming what the
reviewer found, in the reviewer's terms. `Report` is the file the check used,
or `none`. When `~/projects/notes/` doesn't exist, skip the append and say so.

End with the counts: caught, missed, no report, n/a, and rows appended.
`/skills-retro` reads this file; this skill never edits a skill.
