Skip to content

Commit 30408e7

Browse files
committed
chore(project): address findings from review
1 parent 3fffcc2 commit 30408e7

7 files changed

Lines changed: 755 additions & 69 deletions

File tree

agent/prompts/pr_iteration.py

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@
88
99
Follow these steps in order:
1010
11-
1. **Understand the review feedback**
12-
Read all review comments and conversation comments on the PR carefully. \
13-
Understand what changes the reviewers are requesting. Check the current diff \
14-
to understand the state of the PR.
11+
1. **Understand and triage the review feedback**
12+
Read all review comment threads and conversation comments on the PR carefully. \
13+
For each review thread, classify it as:
14+
- **Actionable** — the request is clear and you can address it directly.
15+
- **Needs clarification** — the request is ambiguous, contradictory, or you \
16+
cannot determine what change is being asked for. Do not guess — ask for clarification.
17+
- **Won't address** — the request is out of scope for this iteration, or you \
18+
disagree with the suggestion (explain why in your reply).
1519
16-
2. **Address the feedback**
17-
Make focused changes to address the review feedback. Only change what the \
18-
reviewers requested — do not refactor unrelated code or add unrequested features.
20+
2. **Address the actionable feedback**
21+
Make focused changes to address the review feedback you classified as actionable. \
22+
Only change what the reviewers requested — do not refactor unrelated code or add \
23+
unrequested features.
1924
2025
3. **Test your changes**
2126
This step is MANDATORY — do NOT skip it.
2227
- Run the project build: `mise run build`
2328
- Run linters and type-checkers if available.
2429
- If the project has tests, run them (e.g., `npm test`, `pytest`, `make test`).
25-
- Report test and build results in your PR comment.
2630
2731
4. **Commit and push to `{branch_name}`**
2832
After each logical unit of work, commit and push:
@@ -37,13 +41,34 @@
3741
Do NOT accumulate large uncommitted changes — pushing frequently is your \
3842
durability mechanism.
3943
40-
5. **Update the PR**
41-
When done, add a summary comment to the existing PR. Do NOT create a new PR.
44+
5. **Reply to each review comment thread**
45+
For each review comment thread listed in the Review Comments section above, \
46+
reply directly to that thread using the GitHub API:
4247
```
43-
gh pr comment {pr_number} --repo {repo_url} --body "<summary of changes made>"
48+
gh api repos/{repo_url}/pulls/{pr_number}/comments/<comment_id>/replies \\
49+
-f body="<your reply>"
4450
```
45-
The comment must include:
46-
- Summary of what was changed to address feedback
47-
- Build and test results (what commands were run, output summary, pass/fail)
48-
- Any decisions made or questions for reviewers\
51+
Replace `<comment_id>` with the top-level comment ID shown next to each \
52+
thread (e.g. `reply with comment_id: 12345678`).
53+
54+
Your reply MUST follow these guidelines:
55+
- **If you addressed the comment**: Briefly explain what you changed, the rationale, and in \
56+
which commit. Example: "Fixed in abc1234 — added the null check as suggested."
57+
- **If you need clarification**: Explain what is unclear and ask a specific \
58+
question. Example: "I'm not sure what validation you'd like here — should this \
59+
reject empty strings, or only null/undefined values?"
60+
- **If you won't address it**: Explain why (out of scope, disagree, etc.). \
61+
Example: "This is outside the scope of this PR — I'll open a separate issue for it."
62+
- Keep replies concise and factual.
63+
64+
6. **Post a summary comment on the PR**
65+
When done, add a top-level summary comment to the PR:
66+
```
67+
gh pr comment {pr_number} --repo {repo_url} --body "<summary>"
68+
```
69+
The summary must include:
70+
- What was changed to address feedback
71+
- Which comments were addressed (brief list)
72+
- Which comments need clarification from reviewers
73+
- Build and test results (what commands were run, pass/fail)\
4974
"""

agent/tests/test_entrypoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,5 +402,6 @@ def test_selects_pr_iteration_prompt(self):
402402
"notes": ["All OK"],
403403
}
404404
prompt = _build_system_prompt(config, setup, None, "")
405-
assert "Update the PR" in prompt
405+
assert "Post a summary comment on the PR" in prompt
406+
assert "Reply to each review comment thread" in prompt
406407
assert "42" in prompt

agent/tests/test_prompts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ def test_new_task_returns_prompt_with_create_pr(self):
1515

1616
def test_pr_iteration_returns_prompt_with_update_pr(self):
1717
prompt = get_system_prompt("pr_iteration")
18-
assert "Update the PR" in prompt
18+
assert "Post a summary comment on the PR" in prompt
19+
assert "Reply to each review comment thread" in prompt
20+
assert "gh api" in prompt
21+
assert "comments/<comment_id>/replies" in prompt
1922
assert "{pr_number}" in prompt
2023
assert "{repo_url}" in prompt
2124
assert "{branch_name}" in prompt

0 commit comments

Comments
 (0)