feat: Add review submission tool with line-specific comments #67
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#67
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
The prompt builder (
src/prompt.ts) references asubmit-reviewtool forpull_request_review_requestedevents, but this tool does not exist. The agent can only create comments and PRs — it cannot formally submit a review (approve, request changes, or comment) through the Forgejo API.This means the agent's review capability is limited to posting regular comments rather than structured reviews that affect the PR review state.
Proposed Solution
Add a
submit-reviewtool that uses Forgejo's review API to submit formal PR reviews.API Endpoint to Add (
src/forgejo/index.ts)postReview(repo, prNumber, review)— Submit a review on a PRPOST /repos/{owner}/{repo}/pulls/{index}/reviewspostReviewComment(repo, prNumber, comment)— Post a single review commentPOST /repos/{owner}/{repo}/pulls/{index}/commentspostReviewCommentThread(repo, prNumber, comments)— Post a threaded review commentPOST /repos/{owner}/{repo}/pulls/{index}/commentspatchReview(repo, reviewId, body)— Edit an existing review commentPATCH /repos/{owner}/{repo}/pulls/comments/{comment_id}getReviewComments(repo, prNumber)— Fetch existing review commentsGET /repos/{owner}/{repo}/pulls/{index}/commentsTool to Add (
src/tools.ts)submit-review— Submit a formal review on a PRParameters:
Behavior:
eventis"APPROVE"or"REQUEST_CHANGES"with no line-specific comments, posts a general reviewcommentsarray is provided, posts line-specific review commentsPrompt Integration (
src/prompt.ts)Current prompt for review events:
Enhanced prompt should include:
Schema Updates (
src/schemas.ts)Add TypeBox schemas for:
reviewEventSchema— Union of "COMMENT", "APPROVE", "REQUEST_CHANGES"reviewCommentSchema— Line-specific review commentreviewResponseSchema— Response from posting a reviewreviewCommentResponseSchema— Response from posting a review commentExample Agent Workflow
submit-reviewwithREQUEST_CHANGESand line-specific commentssubmit-reviewwithAPPROVEand a positive bodysubmit-reviewwithCOMMENTFiles to Modify
src/forgejo/fetch.tssrc/forgejo/index.tssrc/schemas.tssrc/tools.tssubmit-review)src/prompt.tssrc/main.tscustomToolsarrayNotes
eventfield is case-sensitive: must be"COMMENT","APPROVE", or"REQUEST_CHANGES"pathandlineparametersreposcope to submit reviewssideparameter for left/right side of diff (Forgejo may support this)Added the tool in the #99 PR, now it would be useful to give some more context in the prompt for successive review requests.