Skip to content

feat(inbox): add feedback dropdown to Create PR button#2541

Open
rafaeelaudibert wants to merge 2 commits into
mainfrom
posthog-code/inbox-create-pr-feedback-dropdown
Open

feat(inbox): add feedback dropdown to Create PR button#2541
rafaeelaudibert wants to merge 2 commits into
mainfrom
posthog-code/inbox-create-pr-feedback-dropdown

Conversation

@rafaeelaudibert

Copy link
Copy Markdown
Member

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 a Popover with a TextArea; 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 optional feedback, trims it, and appends an "Additional feedback from the user" section to the agent prompt when present.
  • useCreatePrReport.tscreatePrReport now takes an optional feedback argument and threads it into the prompt builder.
  • analytics.ts — added has_feedback / feedback_text to InboxReportActionProperties (mirrors the existing has_question / question_text from Discuss), populated truncated to 500 chars.
  • buildCreatePrReportPrompt.test.ts — added coverage for the feedback being appended, trimmed, and omitted when blank.

Testing

  • `pnpm --filter code typecheck` ✅
  • `pnpm --filter code test run src/renderer/features/inbox/utils/buildCreatePrReportPrompt.test.ts` ✅ (7 passed)
  • biome check ✅

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
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit badf2de.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix 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);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant