feat(code-review): batch review comments into a single agent prompt#1965
feat(code-review): batch review comments into a single agent prompt#1965
Conversation
|
Closes #1827. Inline review comments now have an "Add to review" checkbox: when checked, submitting the form queues the comment into a per-task draft instead of dispatching to the agent. A pinned PendingReviewBar at the bottom of the review panel lists every queued draft (file, line range, snippet) with edit / delete affordances and a single "Send to agent" action that combines all drafts into one prompt via buildBatchedInlineCommentsPrompt. Drafts also render inline on the diff at their line range as DraftCommentAnnotation, sharing the same edit flow as the comment textarea. Drafts are in-memory per task and clear on successful send, manual discard, or task unmount. Submitting a one-off comment (checkbox off) leaves any queued drafts intact. PR comment "Fix with agent" / "Ask agent" actions are unchanged. Generated-By: PostHog Code Task-Id: 53f42d57-7308-48a1-996f-836f1c7536eb
c9d031e to
5943896
Compare
ed65716 to
2b2e30e
Compare
- Mock @renderer/trpc/client and @features/sessions/service/service in ReviewShell.test.tsx so importing ReviewShell (which now transitively pulls in sendPromptToAgent → trpcClient) doesn't initialize the IPC link at module load time. Fixes the unit-test CI job. - Use bullets instead of "1.", "2." enumeration in buildBatchedInlineCommentsPrompt to match the team rule about avoiding numbered lists in agent prompts. - Send the batched prompt before clearing drafts in PendingReviewBar so drafts aren't lost if sendPromptToAgent throws. - Extract the duplicated handleEditDraft callback in InteractiveFileDiff.tsx into a shared useEditDraftHandler hook so the edit flow lives in one place. Generated-By: PostHog Code Task-Id: 53f42d57-7308-48a1-996f-836f1c7536eb
2b2e30e to
664fdd5
Compare
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
apps/code/src/renderer/features/code-review/components/CommentAnnotation.tsx:88-92
The user's explicit opt-out of batching is never persisted. When the user unchecks "Add to review" and sends a comment directly, `setBatchEnabled(taskId, false)` is never called. Because `isBatchEnabled` falls back to `(drafts.length > 0)` when no explicit value is stored, the next comment box will open with the batch checkbox re-checked as long as pending drafts exist — overriding the user's choice every time.
```suggestion
setBatchEnabled(taskId, false);
onDismiss();
sendPromptToAgent(
taskId,
buildInlineCommentPrompt(filePath, startLine, endLine, side, text),
);
```
Reviews (2): Last reviewed commit: "fix(code-review): address PR feedback on..." | Re-trigger Greptile |
| return `In file <file path="${escapedPath}" />, ${lineRef} (${sideLabel}):\n\n${comment}`; | ||
| } | ||
|
|
||
| export function buildBatchedInlineCommentsPrompt( |

problem
closes #1827
when giving agent feedback from a diff, users can only submit one comment at a time
changes
allows batching comments into a "review" for the agent
testing
manually