feat: give context on previous reviews for successive review requests #263
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
projects/forgejo-agent!263
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/successive-review-context"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #165
When the agent is assigned as a reviewer again on a pull request it has already reviewed, it now gets the full history of its previous reviews in the prompt:
state), reviewed commit, and summary body.The prompt also instructs the agent to check the current code against each previously raised issue: acknowledge the ones that are fixed, re-raise the ones still open, and look for new issues introduced since the last review.
Changes
src/schemas.ts— extendedprReviewSchemaandprReviewCommentSchemawith author, verdict, commit, timestamps, path and line; addedprReviewWithCommentsSchema.src/forgejo/index.ts— addedgetPrReviewsWithComments()which fetches all PR reviews together with their inline comments.src/context.ts— fetches previous reviews (with comments) onpull_request_review_requestedevents and exposes them in the event context.src/prompt.ts— renders the previous reviews section and adds successive-review guidance when previous reviews exist.TODO: getPrReviews should skip reviews that are pending, since they don't add value.
@ci-bot in the main branch there was some work and now there's a testing infrastrucure that has been set up. Can you get this up to date with its own tests?
For integration tests, you can write, but not run them since you don't have access to a testing forgejo instance. I will verify them in a following review.
Done — the branch is now up to date with
mainand has its own tests.Changes
1. Pending reviews skipped (TODO from review)
getPrReviewsnow filters out reviews withstate === "PENDING"— drafts carry no verdict, so they add no value to the review history.getPrReviewsWithCommentsinherits this, so it never fetches comments for pending reviews.2. Merged
mainand adapted the featureThe branch was rebased onto the current
main(ApiContext refactor, search tools, vitest infrastructure). The feature was adapted to the new structure:getPrReviewsWithComments(apiCtx, repo, prId)follows the new client signatureprReviewSchema/prReviewCommentSchemaandprReviewWithCommentsSchemakeptpull_request_review_requestedevents3. Unit tests (all passing — 54 tests)
src/test/unit/forgejo.test.ts(new) — pending-review filtering andgetPrReviewsWithCommentscomposition (mocksforgejoFetch)src/test/unit/schemas.test.ts— review/comment/with-comments schemassrc/test/unit/prompt.test.ts— successive-review guidance and previous-reviews rendering (incl. comment without line)src/test/unit/context.test.ts— reviews fetched on review requests, not on other eventssrc/test/fixtures.ts— addedmockReviewandmockReviewRequestedEventCtx4. Integration tests (written, not run — no Forgejo instance here)
src/test/integration/forgejo.test.ts—getPrReviewsWithCommentsreturns reviews with their inline comments; pending reviews are skipped (posted via rawforgejoFetchsincepostPrReviewonly accepts submitted events)src/test/integration/context.test.ts—getEventContextincludes previous reviews with comments on a review request5. README — documented the successive-review feature.
Verified locally:
pnpm check,pnpm lint:check,pnpm format:check,pnpm test:unit,pnpm buildall pass. The integration tests are ready for you to verify against the real instance.