feat(inbox): add feedback dropdown to Create PR button#2541
Open
rafaeelaudibert wants to merge 2 commits into
Open
feat(inbox): add feedback dropdown to Create PR button#2541rafaeelaudibert wants to merge 2 commits into
rafaeelaudibert wants to merge 2 commits into
Conversation
The inbox "Create PR" button now has a split dropdown (mirroring the existing "Discuss" split button) where the user can add extra feedback before kicking off the PR task. This is useful for answering questions raised in the report thread. The feedback is folded into the agent prompt via buildCreatePrReportPrompt, and surfaced in analytics as has_feedback / feedback_text on the create_pr inbox action. Clicking the primary button still creates the PR with no feedback, and the Cmd/Ctrl+Enter shortcut is unchanged. Generated-By: PostHog Code Task-Id: 4fc33827-c505-4662-a75d-4ee23091ad8a
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
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/inbox/utils/buildCreatePrReportPrompt.test.ts:54-66
The two blank-feedback scenarios (whitespace-only and `undefined`) are tested with local variables rather than `it.each`. Given that the file already uses `it.each` for the `isDevBuild` variants, parameterising here keeps the pattern consistent and makes it easy to add further cases (e.g. empty string `""`).
```suggestion
it.each([
{ label: "undefined", feedback: undefined },
{ label: "empty string", feedback: "" },
{ label: "whitespace only", feedback: " " },
])(
"omits the feedback section when feedback is $label",
({ feedback }) => {
const base = buildCreatePrReportPrompt({
reportId: "abc123",
isDevBuild: false,
});
const prompt = buildCreatePrReportPrompt({
reportId: "abc123",
isDevBuild: false,
feedback,
});
expect(prompt).toBe(base);
expect(prompt).not.toMatch(/Additional feedback/i);
},
);
```
Reviews (1): Last reviewed commit: "feat(inbox): add feedback dropdown to Cr..." | Re-trigger Greptile |
Comment on lines
+54
to
+66
| it("trims feedback and omits the section when it's blank", () => { | ||
| const withWhitespace = buildCreatePrReportPrompt({ | ||
| reportId: "abc123", | ||
| isDevBuild: false, | ||
| feedback: " ", | ||
| }); | ||
| const withoutFeedback = buildCreatePrReportPrompt({ | ||
| reportId: "abc123", | ||
| isDevBuild: false, | ||
| }); | ||
| expect(withWhitespace).toBe(withoutFeedback); | ||
| expect(withWhitespace).not.toMatch(/Additional feedback/i); | ||
| }); |
Contributor
There was a problem hiding this comment.
The two blank-feedback scenarios (whitespace-only and
undefined) are tested with local variables rather than it.each. Given that the file already uses it.each for the isDevBuild variants, parameterising here keeps the pattern consistent and makes it easy to add further cases (e.g. empty string "").
Suggested change
| it("trims feedback and omits the section when it's blank", () => { | |
| const withWhitespace = buildCreatePrReportPrompt({ | |
| reportId: "abc123", | |
| isDevBuild: false, | |
| feedback: " ", | |
| }); | |
| const withoutFeedback = buildCreatePrReportPrompt({ | |
| reportId: "abc123", | |
| isDevBuild: false, | |
| }); | |
| expect(withWhitespace).toBe(withoutFeedback); | |
| expect(withWhitespace).not.toMatch(/Additional feedback/i); | |
| }); | |
| it.each([ | |
| { label: "undefined", feedback: undefined }, | |
| { label: "empty string", feedback: "" }, | |
| { label: "whitespace only", feedback: " " }, | |
| ])( | |
| "omits the feedback section when feedback is $label", | |
| ({ feedback }) => { | |
| const base = buildCreatePrReportPrompt({ | |
| reportId: "abc123", | |
| isDevBuild: false, | |
| }); | |
| const prompt = buildCreatePrReportPrompt({ | |
| reportId: "abc123", | |
| isDevBuild: false, | |
| feedback, | |
| }); | |
| expect(prompt).toBe(base); | |
| expect(prompt).not.toMatch(/Additional feedback/i); | |
| }, | |
| ); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/inbox/utils/buildCreatePrReportPrompt.test.ts
Line: 54-66
Comment:
The two blank-feedback scenarios (whitespace-only and `undefined`) are tested with local variables rather than `it.each`. Given that the file already uses `it.each` for the `isDevBuild` variants, parameterising here keeps the pattern consistent and makes it easy to add further cases (e.g. empty string `""`).
```suggestion
it.each([
{ label: "undefined", feedback: undefined },
{ label: "empty string", feedback: "" },
{ label: "whitespace only", feedback: " " },
])(
"omits the feedback section when feedback is $label",
({ feedback }) => {
const base = buildCreatePrReportPrompt({
reportId: "abc123",
isDevBuild: false,
});
const prompt = buildCreatePrReportPrompt({
reportId: "abc123",
isDevBuild: false,
feedback,
});
expect(prompt).toBe(base);
expect(prompt).not.toMatch(/Additional feedback/i);
},
);
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Addresses Greptile review feedback: consolidate the undefined / whitespace-only blank-feedback assertions into a single it.each block (matching the existing isDevBuild pattern) and add an empty-string case. Generated-By: PostHog Code Task-Id: 4fc33827-c505-4662-a75d-4ee23091ad8a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When clicking Create PR on an inbox report, you can now open a dropdown to add extra feedback before the PR task is created. This lets you answer questions that were raised in the body of the report thread (or give any other steering) without having to wait for the task, jump in, and re-prompt the agent.
The new control mirrors the existing Discuss split button right next to it: a primary button that fires immediately, plus a caret that opens a popover with a feedback text area.
What changed
ReportDetailPane.tsx— the Create PR button is now a split button. The caret opens aPopoverwith aTextArea; submitting (button or ⌘/Ctrl+↵) creates the PR task with the typed feedback. The primary button still creates a PR with no feedback, and the existing global ⌘/Ctrl+↵ shortcut is unchanged.buildCreatePrReportPrompt.ts— accepts optionalfeedback, trims it, and appends an "Additional feedback from the user" section to the agent prompt when present.useCreatePrReport.ts—createPrReportnow takes an optionalfeedbackargument and threads it into the prompt builder.analytics.ts— addedhas_feedback/feedback_texttoInboxReportActionProperties(mirrors the existinghas_question/question_textfrom Discuss), populated truncated to 500 chars.buildCreatePrReportPrompt.test.ts— added coverage for the feedback being appended, trimmed, and omitted when blank.Testing