feat: handle successive review requests in PRs #165

Open
opened 2026-07-20 12:39:28 +00:00 by davide · 2 comments
Owner

Added the tool in the #99 PR, now it would be useful to give some more context in the prompt for successive review requests.

Originally posted by @davide in #67 (comment)

> Added the tool in the #99 PR, now it would be useful to give some more context in the prompt for successive review requests. > > _Originally posted by @davide in https://git.zarantonello.dev/projects/forgejo-agent/issues/67#issuecomment-25696_
Author
Owner

@ci-bot can you give some suggestions on how to handle the case? I think the agent should be made aware of what it has already reviewed, and any resolutions applied.

@ci-bot can you give some suggestions on how to handle the case? I think the agent should be made aware of what it has already reviewed, and any resolutions applied.
Member

Here's how I'd handle successive review requests, and I've implemented it in PR #263.

Approach

On a pull_request_review_requested event, the agent should be given the history of its previous reviews on that PR, so it can:

  1. Know what it already reviewed — the previous reviews (verdict, summary, reviewed commit) and the inline comments (path, line, body).
  2. Check resolutions — for each previously raised issue, inspect the current code to see whether it has been fixed.
  3. Focus the new review — acknowledge fixed issues, re-raise unresolved ones, and look for new issues introduced since the last review.

Implementation (PR #263)

  • src/schemas.ts — extended prReviewSchema (author, verdict, commit, submitted_at) and prReviewCommentSchema (author, path, line, created_at); added prReviewWithCommentsSchema.
  • src/forgejo/index.ts — new getPrReviewsWithComments() that fetches all PR reviews together with their inline comments.
  • src/context.ts — on pull_request_review_requested, fetches the previous reviews and exposes them in the event context.
  • src/prompt.ts — renders a "previous reviews" section (state, commit, body, and each inline comment with path/line) and adds guidance for successive reviews: check whether previously raised issues are resolved, re-raise what's still open, and look for new issues.

The reviews are only fetched for review-request events, so other event types keep the same behavior and API footprint.

Here's how I'd handle successive review requests, and I've implemented it in PR #263. ## Approach On a `pull_request_review_requested` event, the agent should be given the history of its previous reviews on that PR, so it can: 1. **Know what it already reviewed** — the previous reviews (verdict, summary, reviewed commit) and the inline comments (path, line, body). 2. **Check resolutions** — for each previously raised issue, inspect the current code to see whether it has been fixed. 3. **Focus the new review** — acknowledge fixed issues, re-raise unresolved ones, and look for new issues introduced since the last review. ## Implementation (PR #263) - **`src/schemas.ts`** — extended `prReviewSchema` (author, verdict, commit, submitted_at) and `prReviewCommentSchema` (author, path, line, created_at); added `prReviewWithCommentsSchema`. - **`src/forgejo/index.ts`** — new `getPrReviewsWithComments()` that fetches all PR reviews together with their inline comments. - **`src/context.ts`** — on `pull_request_review_requested`, fetches the previous reviews and exposes them in the event context. - **`src/prompt.ts`** — renders a "previous reviews" section (state, commit, body, and each inline comment with path/line) and adds guidance for successive reviews: check whether previously raised issues are resolved, re-raise what's still open, and look for new issues. The reviews are only fetched for review-request events, so other event types keep the same behavior and API footprint.
Sign in to join this conversation.
No labels
No milestone
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
projects/forgejo-agent#165
No description provided.