fix: add PR merge conflict check and review reading to dev agent workflow
Dev agent should: 1. Check if PR has merge conflicts before asking for review 2. Read review comments and incorporate feedback 3. Understand review states: APPROVED = ready to merge, COMMENT = feedback to address This prevents approving a PR that has conflicts, and ensures dev agents respond to reviewer comments appropriately.
This commit is contained in:
@@ -280,6 +280,11 @@ Workflow:
|
|||||||
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
||||||
2. Check if a PR already exists for this issue
|
2. Check if a PR already exists for this issue
|
||||||
- If PR exists and is open, review it and learn from it
|
- If PR exists and is open, review it and learn from it
|
||||||
|
- CRITICAL: Check if PR has merge conflicts before asking for review:
|
||||||
|
- Use: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
|
- If "mergeable": false, there ARE conflicts - you MUST resolve them FIRST
|
||||||
|
- To resolve: cd to worktree, git fetch origin, git rebase origin/main, resolve conflicts, git rebase --continue, git push --force-with-lease
|
||||||
|
- Only after resolving conflicts (mergeable: true) can you ask for review
|
||||||
- If PR makes sense to continue, work on it instead
|
- If PR makes sense to continue, work on it instead
|
||||||
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
||||||
3. Read README.md (if exists) to understand the general concept of this repository
|
3. Read README.md (if exists) to understand the general concept of this repository
|
||||||
@@ -314,6 +319,11 @@ Workflow:
|
|||||||
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
||||||
2. Check if a PR already exists for this issue
|
2. Check if a PR already exists for this issue
|
||||||
- If PR exists and is open, review it and learn from it
|
- If PR exists and is open, review it and learn from it
|
||||||
|
- CRITICAL: Check if PR has merge conflicts before asking for review:
|
||||||
|
- Use: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
|
- If "mergeable": false, there ARE conflicts - you MUST resolve them FIRST
|
||||||
|
- To resolve: cd to worktree, git fetch origin, git rebase origin/main, resolve conflicts, git rebase --continue, git push --force-with-lease
|
||||||
|
- Only after resolving conflicts (mergeable: true) can you ask for review
|
||||||
- If PR makes sense to continue, work on it instead
|
- If PR makes sense to continue, work on it instead
|
||||||
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
||||||
3. Read README.md (if exists) to understand the general concept of this repository
|
3. Read README.md (if exists) to understand the general concept of this repository
|
||||||
@@ -331,6 +341,8 @@ Tools for PR interaction:
|
|||||||
- Post issue/PR comment: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your comment"}'
|
- Post issue/PR comment: curl -X POST "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN" -H "Content-Type: application/json" -d '{"body":"Your comment"}'
|
||||||
- List PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
- List PR comments: curl -s "https://$instance/api/v1/repos/$owner/$repo/issues/$number/comments" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
- List PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
- List PR reviews: curl -s "https://$instance/api/v1/repos/$owner/$repo/pulls/$number/reviews" -H "Authorization: Bearer \$GITEA_TOKEN"
|
||||||
|
- IMPORTANT: After listing reviews, READ the review comments and incorporate feedback
|
||||||
|
- Check for review state: "APPROVED" means ready to merge, "COMMENT" means feedback to address
|
||||||
- Merge PR (only with approval): tea pr merge --repo $owner/$repo $number --style merge
|
- Merge PR (only with approval): tea pr merge --repo $owner/$repo $number --style merge
|
||||||
- MERGING requires approval first! Check for: approval in reviews, OR "lgtm"/"approved" in comments
|
- MERGING requires approval first! Check for: approval in reviews, OR "lgtm"/"approved" in comments
|
||||||
- If no approval, ask reviewer to approve first before merging
|
- If no approval, ask reviewer to approve first before merging
|
||||||
|
|||||||
Reference in New Issue
Block a user