Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): add implement split button (#95321)

Mikayla Thompson4d1e10755ebc
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ebc65501481a..ac2eb6a503b2 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7640,14 +7640,6 @@ snapshots:
hash: v1.k794b7964.4ab1f8cb97f347a2aae442ca814c70c538c54e4a9efb1c3cdd6681a56cad5e90.wVmcanELl0wz7-rhcnN8K5MGXmKMMxXELkYcCEpCxKs
scenes-app-inbox-cards--skeleton--light:
hash: v1.k794b7964.24c19ab5df1e4ccb843b1ad726752e3a98aeadaa08595e66cb4b41aff1a9e9a1.Y3z44tkU4jsAYUyXxfl72fTuZ0MKA6_S6TTNCKt5jSg
- scenes-app-inbox-createprbutton--default--dark:
- hash: v1.k794b7964.ed3dcef6d62105108f3ce66a23623a5ce7ab39405dfd5b58cfbdf4e48130accb.8ndY7EDwZWW7bkU8B31ICU2QZIK6Og4NxbVBPBeSn1c
- scenes-app-inbox-createprbutton--default--light:
- hash: v1.k794b7964.451bf28e6745e87d652309ff7e700df19787f6a8eb1caea6511b3e167e267066.4wCG_I6-hdtHnB3OoYj3gV851OxePPZfWws6tpJ2mDk
- scenes-app-inbox-createprbutton--steering--dark:
- hash: v1.k794b7964.ed2c06f0785093b47269ea129ee4394971e399fe288dc9a394520a402456b260.moDVSzdoUZiJ8U-tm2T24s9NiTehnObGxIHlVOZOi24
- scenes-app-inbox-createprbutton--steering--light:
- hash: v1.k794b7964.90e380944266cf30b04a4066e14121297ea3b2a184face92194ec23350a384f1.As5SqMtAtiDIaP486BIfIfDUzkbg6xMi-ths87o8MeE
scenes-app-inbox-detail--pull-request--dark:
hash: v1.k794b7964.e3d35a1f32d39211cf8bd41914c83ec6e4ed9e0251e8b883a8fa62c048dc4165.na0HIQko2FwF9KTcKxD66kvttld6IbR_S0bejyK_1hs
scenes-app-inbox-detail--pull-request--light:
@@ -7704,6 +7696,14 @@ snapshots:
hash: v1.k794b7964.ee23fd931ed2324fdc42cbb44bb06176f40e1e47d5c03f9118ccc0f5f013201b.BmJiKZm5EO6qY8tSt5oSll_wmMMWh7IJ0dqN_bSQwa8
scenes-app-inbox-hotkeyradio--with-selection--light:
hash: v1.k794b7964.3e50641442cc87cebfb5e0380042c05c0e5f15e238011e5aab24f8e69da5ea8e.IarzlyKga2lc-4CZ8UpBjuU1D_75I4SRnyKDESA9drk
+ scenes-app-inbox-implementbutton--choices--dark:
+ hash: v1.k794b7964.f92d5686aae66110b8d50afdb16572300047046f49f2a1ecc9c44235d86218e5.nS3wP7CmKoWWDO2gXGzHUOiQMiI2VmTtPRzyJuDGrBA
+ scenes-app-inbox-implementbutton--choices--light:
+ hash: v1.k794b7964.a5e76b4728730d9ad98eab8e787718804ff25619a38fce6acbe6354ac7f04ae8.CU7kUOfZ59HG6vxqJDQSywe8luerIxfx7w16zcz92Pc
+ scenes-app-inbox-implementbutton--default--dark:
+ hash: v1.k794b7964.f2b5351f205a0abb1531706c02950c727ede9d9f7cf220869b571442805a5a24.NvzH40X-7cVbDTiW0u9CRIwI3ENeZ37ePippBtcZg2M
+ scenes-app-inbox-implementbutton--default--light:
+ hash: v1.k794b7964.3ae4db003fb100b088592e891f4f1dad7cc88fa9107562a7475bb2cb13e40416.IuzBG5uabdrl1YowQw8jUlTVOtRwExLrffxwo8ok2_4
scenes-app-inbox-pullrequestdiffview--default--dark:
hash: v1.k794b7964.564cd678d9da50089c918c63d37c816257091c6c9d7d2f957dc9c96f596d34dc.8ICzP4d5gRBF0h4CT87lZgk82tCHyXIOsszi6P3JQ-M
scenes-app-inbox-pullrequestdiffview--default--light:
diff --git a/products/signals/frontend/inbox/components/detail/CreatePrButton.stories.tsx b/products/signals/frontend/inbox/components/detail/CreatePrButton.stories.tsx
deleted file mode 100644
index 61694e38b273..000000000000
--- a/products/signals/frontend/inbox/components/detail/CreatePrButton.stories.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/react'
-import { waitFor, within } from '@testing-library/dom'
-import userEvent from '@testing-library/user-event'
-
-import { makeReport } from '../../__mocks__/inboxMocks'
-import { CreatePrButton } from './CreatePrButton'
-
-const meta: Meta<typeof CreatePrButton> = {
- title: 'Scenes-App/Inbox/CreatePrButton',
- component: CreatePrButton,
- parameters: { layout: 'centered' },
-}
-export default meta
-
-type Story = StoryObj<typeof CreatePrButton>
-
-const report = makeReport({ title: 'Exceptions spiked after the 18 June deploy' })
-
-/** The resting split button. The divider is the only cue that the chevron does something else. */
-export const Default: Story = {
- render: () => <CreatePrButton report={report} />,
-}
-
-// The note box is closed until the chevron is pressed, so the story opens it. `findByLabelText`
-// rather than `getByLabelText`: the button mounts a kea logic chain reaching organization and user
-// state, so on a slow runner the play function can reach an empty canvas and fail the story.
-export const Steering: Story = {
- parameters: { testOptions: { snapshotTargetSelector: '.Popover' } },
- render: () => <CreatePrButton report={report} />,
- play: async ({ canvasElement }) => {
- await userEvent.click(await within(canvasElement).findByLabelText('Add direction for the agent'))
- await waitFor(() => {
- if (!document.querySelector('.Popover')) {
- throw new Error('note box not open yet')
- }
- })
- },
-}
diff --git a/products/signals/frontend/inbox/components/detail/CreatePrButton.test.tsx b/products/signals/frontend/inbox/components/detail/CreatePrButton.test.tsx
deleted file mode 100644
index 09849bf77dae..000000000000
--- a/products/signals/frontend/inbox/components/detail/CreatePrButton.test.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-import '@testing-library/jest-dom'
-
-import { cleanup, render, screen, waitFor } from '@testing-library/react'
-import userEvent from '@testing-library/user-event'
-
-import { initKeaTests } from '~/test/init'
-
-import { captureInboxReportAction } from '../../inboxAnalytics'
-import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'
-import { SignalReport, SignalReportStatus } from '../../types'
-import { CreatePrButton } from './CreatePrButton'
-
-jest.mock('../../inboxAnalytics', () => ({
- ...jest.requireActual('../../inboxAnalytics'),
- captureInboxReportAction: jest.fn(),
-}))
-
-function makeReport(): SignalReport {
- return {
- id: 'report-1',
- title: 'Exceptions spiked',
- summary: 'summary',
- status: SignalReportStatus.READY,
- total_weight: 0,
- signal_count: 1,
- relevant_user_count: null,
- artefact_count: 0,
- is_suggested_reviewer: false,
- created_at: '2026-06-11T10:00:00Z',
- updated_at: '2026-06-11T10:00:00Z',
- } satisfies SignalReport
-}
-
-describe('CreatePrButton', () => {
- let createPrFromReport: jest.Mock
-
- beforeEach(() => {
- initKeaTests()
- inboxTaskKickoffLogic.mount()
- createPrFromReport = jest.fn()
- jest.spyOn(inboxTaskKickoffLogic.actions, 'createPrFromReport').mockImplementation(createPrFromReport)
- jest.mocked(captureInboxReportAction).mockClear()
- })
-
- afterEach(() => {
- cleanup()
- jest.restoreAllMocks()
- })
-
- async function openNoteBox(): Promise<ReturnType<typeof userEvent.setup>> {
- const user = userEvent.setup()
- render(<CreatePrButton report={makeReport()} />)
- await user.click(screen.getByTestId('inbox-report-create-pr-steer'))
- await waitFor(() => expect(screen.getByRole('textbox')).toHaveFocus())
- return user
- }
-
- it('starts an unsteered run from the main half, with no note box in the way', async () => {
- // The point of the split: the common case is one press. A regression that routes the main
- // half back into the popover shows up here as a missing call.
- const user = userEvent.setup()
- render(<CreatePrButton report={makeReport()} />)
-
- await user.click(screen.getByTestId('inbox-report-create-pr'))
-
- expect(createPrFromReport).toHaveBeenCalledWith(expect.objectContaining({ id: 'report-1' }), undefined)
- expect(screen.queryByRole('textbox')).not.toBeInTheDocument()
- expect(jest.mocked(captureInboxReportAction).mock.calls[0][0].extra).toEqual({ has_feedback: false })
- })
-
- it('passes a typed note to the agent and marks the action as steered', async () => {
- // The whole feature: a note in the box has to reach the prompt, or steering does nothing. The
- // `has_feedback` flag is how we compare steered runs against unsteered ones.
- const user = await openNoteBox()
-
- await user.type(screen.getByRole('textbox'), ' Put the fix behind a flag. ')
- await user.click(screen.getByTestId('inbox-report-create-pr-submit'))
-
- expect(createPrFromReport).toHaveBeenCalledWith(
- expect.objectContaining({ id: 'report-1' }),
- 'Put the fix behind a flag.'
- )
- expect(jest.mocked(captureInboxReportAction).mock.calls[0][0].extra).toEqual({ has_feedback: true })
- })
-
- it('submits the note on Enter without moving focus first', async () => {
- // Guards the two halves of the shortcut at once: the box takes focus when it opens, and plain
- // Enter submits. `onPressCmdEnter` would leave both typing and Enter with nothing to act on.
- const user = await openNoteBox()
-
- await user.keyboard('Backend only.{Enter}')
-
- expect(createPrFromReport).toHaveBeenCalledWith(expect.objectContaining({ id: 'report-1' }), 'Backend only.')
- })
-})
diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx
new file mode 100644
index 000000000000..4640bcf70949
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx
@@ -0,0 +1,34 @@
+import type { Meta, StoryObj } from '@storybook/react'
+import { waitFor, within } from '@testing-library/dom'
+import userEvent from '@testing-library/user-event'
+
+import { makeReport } from '../../__mocks__/inboxMocks'
+import { ImplementButton } from './ImplementButton'
+
+const meta: Meta<typeof ImplementButton> = {
+ title: 'Scenes-App/Inbox/ImplementButton',
+ component: ImplementButton,
+ parameters: { layout: 'centered' },
+}
+export default meta
+
+type Story = StoryObj<typeof ImplementButton>
+
+const report = makeReport({ title: 'Exceptions spiked after the 18 June deploy' })
+
+export const Default: Story = {
+ render: () => <ImplementButton report={report} />,
+}
+
+export const Choices: Story = {
+ parameters: { testOptions: { snapshotTargetSelector: '.Popover' } },
+ render: () => <ImplementButton report={report} />,
+ play: async ({ canvasElement }) => {
+ await userEvent.click(await within(canvasElement).findByLabelText('More implementation options'))
+ await waitFor(() => {
+ if (!document.querySelector('.Popover')) {
+ throw new Error('implementation choices not open yet')
+ }
+ })
+ },
+}
diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx
new file mode 100644
index 000000000000..bcbdf5534ea2
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx
@@ -0,0 +1,123 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+
+import { initKeaTests } from '~/test/init'
+
+import { captureInboxReportAction } from '../../inboxAnalytics'
+import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'
+import { SignalReport, SignalReportStatus } from '../../types'
+import { ImplementButton } from './ImplementButton'
+
+jest.mock('../../inboxAnalytics', () => ({
+ ...jest.requireActual('../../inboxAnalytics'),
+ captureInboxReportAction: jest.fn(),
+}))
+
+jest.mock('lib/utils/copyToClipboard', () => ({
+ copyToClipboard: jest.fn().mockResolvedValue(true),
+}))
+
+function makeReport(): SignalReport {
+ return {
+ id: 'report-1',
+ title: 'Exceptions spiked',
+ summary: 'summary',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ } satisfies SignalReport
+}
+
+describe('ImplementButton', () => {
+ let createPrFromReport: jest.Mock
+
+ beforeEach(() => {
+ initKeaTests()
+ inboxTaskKickoffLogic.mount()
+ createPrFromReport = jest.fn()
+ jest.spyOn(inboxTaskKickoffLogic.actions, 'createPrFromReport').mockImplementation(createPrFromReport)
+ jest.mocked(captureInboxReportAction).mockClear()
+ jest.mocked(copyToClipboard).mockClear()
+ })
+
+ afterEach(() => {
+ cleanup()
+ jest.restoreAllMocks()
+ })
+
+ async function openMenu(): Promise<ReturnType<typeof userEvent.setup>> {
+ const user = userEvent.setup()
+ render(<ImplementButton report={makeReport()} />)
+ await user.click(screen.getByTestId('inbox-report-create-pr-steer'))
+ await waitFor(() => expect(screen.getByText('Implement with PostHog')).toBeInTheDocument())
+ return user
+ }
+
+ it('starts a PostHog agent from the main action', async () => {
+ const user = userEvent.setup()
+ render(<ImplementButton report={makeReport()} />)
+
+ await user.click(screen.getByTestId('inbox-report-create-pr'))
+
+ expect(createPrFromReport).toHaveBeenCalledWith(expect.objectContaining({ id: 'report-1' }), undefined)
+ expect(jest.mocked(captureInboxReportAction).mock.calls[0][0].extra).toEqual({ has_feedback: false })
+ })
+
+ it('opens both implementation options without starting work', async () => {
+ await openMenu()
+
+ expect(screen.getByText('Implement with PostHog')).toBeInTheDocument()
+ expect(screen.getByText('Copy prompt for your agent')).toBeInTheDocument()
+ expect(createPrFromReport).not.toHaveBeenCalled()
+ expect(copyToClipboard).not.toHaveBeenCalled()
+ })
+
+ it.each([
+ [
+ 'the PostHog button',
+ (user: ReturnType<typeof userEvent.setup>) =>
+ user.click(screen.getByTestId('inbox-report-create-pr-submit')),
+ ],
+ ['Enter', (user: ReturnType<typeof userEvent.setup>) => user.keyboard('{Enter}')],
+ ])('passes steering instructions with %s', async (_method, submit) => {
+ const user = await openMenu()
+
+ await user.type(
+ screen.getByPlaceholderText('Add instructions for the PostHog agent (optional)'),
+ ' Keep the existing API '
+ )
+ await submit(user)
+
+ expect(createPrFromReport).toHaveBeenCalledWith(
+ expect.objectContaining({ id: 'report-1' }),
+ 'Keep the existing API'
+ )
+ expect(jest.mocked(captureInboxReportAction).mock.calls[0][0].extra).toEqual({ has_feedback: true })
+ })
+
+ it('copies a prompt that claims the report and attaches the finished pull request', async () => {
+ const user = await openMenu()
+
+ await user.click(screen.getByTestId('inbox-report-copy-implementation-prompt'))
+
+ const prompt = jest.mocked(copyToClipboard).mock.calls[0][0]
+ expect(prompt).toContain('report ID: report-1')
+ expect(prompt).toContain('inbox-report-artefacts-list')
+ expect(prompt).toContain('claim the report with inbox-reports-claim')
+ expect(prompt).toContain('pr_url to attach it')
+ expect(prompt).toContain('release=true')
+ expect(copyToClipboard).toHaveBeenCalledWith(prompt, 'implementation prompt')
+ expect(captureInboxReportAction).toHaveBeenCalledWith(
+ expect.objectContaining({ actionType: 'copy_implementation_prompt' })
+ )
+ })
+})
diff --git a/products/signals/frontend/inbox/components/detail/CreatePrButton.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
similarity index 55%
rename from products/signals/frontend/inbox/components/detail/CreatePrButton.tsx
rename to products/signals/frontend/inbox/components/detail/ImplementButton.tsx
index 75da27f8078d..9d5e13f9ebaf 100644
--- a/products/signals/frontend/inbox/components/detail/CreatePrButton.tsx
+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx
@@ -1,53 +1,37 @@
import { useActions, useValues } from 'kea'
import { useState } from 'react'
-import { IconPullRequest } from '@posthog/icons'
+import { IconCopy, IconPullRequest } from '@posthog/icons'
import { LemonButton, lemonToast } from '@posthog/lemon-ui'
import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+import { addProjectIdIfMissing } from 'lib/utils/kea-router'
+import { urls } from 'scenes/urls'
import { captureInboxReportAction } from '../../inboxAnalytics'
import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'
import { ImplementationSlotClaim, inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'
import { SignalReport } from '../../types'
+import { buildReportImplementationPrompt } from './buildReportImplementationPrompt'
-// Same string desktop uses, so the note reads the same on both surfaces.
-const PLACEHOLDER = 'Add direction for the agent (optional)…'
-
-// A report funds one implementation at a time. The two claims send the reader to the same task but
-// for different reasons, so they read differently: one run is still working, the other already
-// shipped the PR.
const SLOT_CLAIM_DISABLED_REASON: Record<ImplementationSlotClaim, string> = {
in_flight: 'A pull request run is already in progress for this report. Open it in the task log to follow it.',
shipped_pr: 'This report already has a pull request. Open it in the task log to continue it.',
}
-/**
- * The detail-pane "Create PR" action, as a split button.
- *
- * The main half starts the run immediately, because an unsteered run is the common case. The
- * chevron half opens a note box, so the reader can steer the agent (behind a flag, backend only,
- * skip the migration) at the moment they have the most context. A note is optional, so both halves
- * reach the same action and only the note differs.
- *
- * A component, not a `ReportDetailAction`, because actions collapse into a `LemonMenu` on narrow
- * layouts and a menu item cannot own a popover. `DiscussReportButton` is a component for the same
- * reason.
- */
-export function CreatePrButton({ report }: { report: SignalReport }): JSX.Element {
+export function ImplementButton({ report }: { report: SignalReport }): JSX.Element {
const { isCreatingPr, createPrDisabledReason } = useValues(inboxTaskKickoffLogic)
- // Already mounted by `ReportDetail`, so this reads the loaded value rather than starting a fetch.
const { implementationSlotClaim } = useValues(inboxReportDetailLogic({ reportId: report.id, report }))
const { createPrFromReport } = useActions(inboxTaskKickoffLogic)
- const [feedback, setFeedback] = useState('')
+ const [instructions, setInstructions] = useState('')
+ const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport('reports', report.id))}`
const disabledReason =
createPrDisabledReason ??
(implementationSlotClaim ? SLOT_CLAIM_DISABLED_REASON[implementationSlotClaim] : undefined)
const submit = (note: string): void => {
- // Enter submits straight from the textarea, so it never sees the button's `disabledReason`.
- // Each guard has to hold here too, or a keypress starts a paid run anyway.
if (isCreatingPr || implementationSlotClaim) {
return
}
@@ -65,6 +49,20 @@ export function CreatePrButton({ report }: { report: SignalReport }): JSX.Elemen
createPrFromReport(report, trimmed || undefined)
}
+ const copyImplementationPrompt = async (): Promise<void> => {
+ const copied = await copyToClipboard(
+ buildReportImplementationPrompt(report, reportUrl),
+ 'implementation prompt'
+ )
+ if (copied) {
+ captureInboxReportAction({
+ report,
+ actionType: 'copy_implementation_prompt',
+ surface: 'detail_pane',
+ })
+ }
+ }
+
return (
<LemonButton
type="primary"
@@ -73,47 +71,52 @@ export function CreatePrButton({ report }: { report: SignalReport }): JSX.Elemen
onClick={() => submit('')}
loading={isCreatingPr}
disabledReason={disabledReason}
- tooltip="Have Self-driving open a pull request for this report"
+ tooltip="Implement this report with PostHog"
data-attr="inbox-report-create-pr"
sideAction={{
- tooltip: 'Add direction before the agent starts',
- 'aria-label': 'Add direction for the agent',
+ tooltip: 'More implementation options',
+ 'aria-label': 'More implementation options',
'data-attr': 'inbox-report-create-pr-steer',
dropdown: {
placement: 'bottom-end',
- // The box holds a textarea, so a click inside it must not close the popover. The
- // popover also stays open on its spinner until the run is created and we navigate
- // to it, which leaves the note to retry with after a failure.
closeOnClickInside: false,
overlay: (
- <div className="flex flex-col gap-2 p-2 w-96">
+ <div className="flex w-120 flex-col gap-2 p-2">
+ <span className="text-xs font-semibold text-tertiary">
+ Add instructions for the PostHog agent
+ </span>
<LemonTextArea
- value={feedback}
- onChange={setFeedback}
+ value={instructions}
+ onChange={setInstructions}
onPressEnter={submit}
- placeholder={PLACEHOLDER}
+ placeholder="Add instructions for the PostHog agent (optional)"
maxLength={4000}
rows={4}
autoFocus
- // The hint goes in the left slot so the character counter, which
- // `maxLength` puts in the right one, has room of its own.
actions={[
<span key="shortcut" className="text-xs text-tertiary">
- Enter to create PR, Shift + Enter for a new line
+ Enter to implement, Shift + Enter for a new line
</span>,
]}
/>
- <div className="flex justify-end">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <LemonButton
+ type="secondary"
+ icon={<IconCopy />}
+ onClick={() => void copyImplementationPrompt()}
+ data-attr="inbox-report-copy-implementation-prompt"
+ >
+ Copy prompt for your agent
+ </LemonButton>
<LemonButton
type="primary"
- size="small"
icon={<IconPullRequest />}
- onClick={() => submit(feedback)}
+ onClick={() => submit(instructions)}
loading={isCreatingPr}
disabledReason={disabledReason}
data-attr="inbox-report-create-pr-submit"
>
- Create PR
+ Implement with PostHog
</LemonButton>
</div>
</div>
@@ -121,7 +124,7 @@ export function CreatePrButton({ report }: { report: SignalReport }): JSX.Elemen
},
}}
>
- Create PR
+ Implement
</LemonButton>
)
}
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
index dd7be5d7a337..662f6c46a4fe 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx
@@ -37,9 +37,9 @@ import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'
import { isStatusRedundantWithActionability, SignalReportStatusBadge } from '../badges/SignalReportStatusBadge'
import { ConventionalCommitScopeTag } from '../cards/ReportCard'
import { CommitContent } from './artefactTypes'
-import { CreatePrButton } from './CreatePrButton'
import { DetailSection } from './DetailSection'
import { DiscussReportButton } from './DiscussReportButton'
+import { ImplementButton } from './ImplementButton'
import { PrChecksSection } from './PrChecksSection'
import { PrCommentsSection } from './PrCommentsSection'
import { PullRequestDiffPending, PullRequestDiffStat, PullRequestDiffStatSkeleton } from './PullRequestDiffPanel'
@@ -245,14 +245,9 @@ export function InboxDetailFrame({
// the report directly.
const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport('reports', report.id))}`
- // Create PR is the report's main call to action, so it takes the primary slot (styled like
- // "Open in GitHub" on PR-bearing reports). The rest render inline as buttons on wide layouts
- // and as a standard `LemonMenu` on narrow ones.
const reportActions = useReportDetailActions(report)
const showCreatePr = canCreateImplementationPr(report)
- const createPrButton = showCreatePr ? <CreatePrButton report={report} /> : null
- // `ReportSummaryBody` renders Create PR under the Solution section, so the header only carries it
- // when the summary has no Solution section — otherwise an actionable report shows it twice.
+ const implementButton = showCreatePr ? <ImplementButton report={report} /> : null
const summaryHasSolution = parseReportSummary(report.summary).sections.some(
(section) => section.kind === 'solution'
)
@@ -318,7 +313,7 @@ export function InboxDetailFrame({
<ReportSummaryBody
summary={report.summary}
chartPlacements={chartPlacements}
- createPrButton={createPrButton}
+ implementButton={implementButton}
pullRequestNote={pullRequestNote}
/>
) : (
@@ -483,7 +478,7 @@ export function InboxDetailFrame({
</LemonButton>
<div className="flex items-center gap-2">
{primaryAction}
- {!summaryHasSolution && createPrButton}
+ {!summaryHasSolution && implementButton}
{/* Discuss is always available and stays inline as its own dropdown button. */}
<DiscussReportButton report={report} reportUrl={reportUrl} />
{/* Buttons inline on wide layouts; collapse into a standard LemonMenu kebab below @4xl. */}
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx b/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
index 0076a2d6195b..037d477cb71c 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetailActions.tsx
@@ -36,13 +36,6 @@ export interface ReportDetailAction {
primary?: boolean
}
-/**
- * Detail-pane actions as data: Resolve, Dismiss/Restore, and Refund. Create PR and Discuss are each
- * rendered separately as a standalone dropdown button (`CreatePrButton`, `DiscussReportButton`)
- * since they open a note popover rather than firing on click; rating a report lives at the end of
- * the body (`ReportFeedbackFooter`). Dismissing and resolving reuse the shared `useReportDismiss` /
- * `useReportResolve` dialog flows. Callers render these inline or inside a menu.
- */
export function useReportDetailActions(report: SignalReport): ReportDetailAction[] {
const { reportStateChanged } = useActions(inboxBulkActionsLogic)
const { activeTab } = useValues(inboxSceneLogic)
diff --git a/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx
index 4f4821cecf7f..486af26e94e5 100644
--- a/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx
@@ -37,9 +37,9 @@ import {
} from '../badges/sourceProductIcons'
import { ConventionalCommitScopeTag } from '../cards/ReportCard'
import { CommitContent } from './artefactTypes'
-import { CreatePrButton } from './CreatePrButton'
import { DetailSection } from './DetailSection'
import { DiscussReportButton } from './DiscussReportButton'
+import { ImplementButton } from './ImplementButton'
import { PrChecksSection } from './PrChecksSection'
import { PrCommentsSection } from './PrCommentsSection'
import {
@@ -444,10 +444,7 @@ function InboxDetailFrameLegacy({
</div>
<div className="flex items-center gap-2 @2xl:shrink-0">
{primaryAction}
- {/* The report's main call to action. Same gate and standalone button the redesign pane
- uses, so a flag-off reader keeps Create PR. Never shows alongside the "Open in
- GitHub" primary action — the gate is false once a PR exists. */}
- {canCreateImplementationPr(report) && <CreatePrButton report={report} />}
+ {canCreateImplementationPr(report) && <ImplementButton report={report} />}
{/* Discuss is always available and stays inline as its own dropdown button. */}
<DiscussReportButton report={report} reportUrl={reportUrl} />
{/* Buttons inline on wide layouts; collapse into a standard LemonMenu kebab below @4xl. */}
diff --git a/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx
index 1a035059aa64..9d59d468568e 100644
--- a/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportSummaryBody.tsx
@@ -38,8 +38,7 @@ function SummaryMarkdown({ markdown, sourceOffset, chartPlacements, className }:
interface ReportSummaryBodyProps {
summary: string
chartPlacements: ChartPlacements
- /** The Create PR button, rendered under the Solution section when the report offers it. */
- createPrButton?: ReactNode
+ implementButton?: ReactNode
/**
* Says a pull request with the fix is open and links to it. Rendered under the Solution section, or after
* the body when the summary has no sections, so a report never hides that its fix already shipped.
@@ -54,7 +53,7 @@ interface ReportSummaryBodyProps {
export function ReportSummaryBody({
summary,
chartPlacements,
- createPrButton,
+ implementButton,
pullRequestNote,
}: ReportSummaryBodyProps): JSX.Element {
const parsed = useMemo(() => parseReportSummary(summary), [summary])
@@ -92,7 +91,7 @@ export function ReportSummaryBody({
chartPlacements={chartPlacements}
/>
{section.kind === 'solution' && pullRequestNote && <div className="mt-2">{pullRequestNote}</div>}
- {section.kind === 'solution' && createPrButton && <div className="mt-2">{createPrButton}</div>}
+ {section.kind === 'solution' && implementButton && <div className="mt-2">{implementButton}</div>}
</section>
))}
{!hasSolutionSection && pullRequestNote}
diff --git a/products/signals/frontend/inbox/components/detail/buildReportImplementationPrompt.ts b/products/signals/frontend/inbox/components/detail/buildReportImplementationPrompt.ts
new file mode 100644
index 000000000000..5ee95223b171
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/buildReportImplementationPrompt.ts
@@ -0,0 +1,13 @@
+import type { SignalReport } from '../../types'
+
+export function buildReportImplementationPrompt(report: SignalReport, reportUrl: string): string {
+ return `Work on the PostHog Inbox report at ${reportUrl} (report ID: ${report.id}).
+
+Use the PostHog MCP tools to retrieve the report and read its full work log with inbox-report-artefacts-list before changing code. Check its status, current assignee, and attached pull request. If someone else has claimed it, call that out before taking over.
+
+When you are ready to begin, claim the report with inbox-reports-claim. Verify the report's diagnosis against the current code, follow the repository's instructions, implement the smallest complete fix, and add focused regression coverage.
+
+Open a pull request using the repository's conventions. Include ${reportUrl} in the pull request description, then call inbox-reports-claim again with the report ID and pr_url to attach it. Do not resolve the report when you open the pull request. A connected pull request will resolve it when merged. If PostHog cannot observe the merge, resolve it with inbox-reports-set-state after it lands.
+
+If you stop without opening a pull request or completing the work, release the claim with inbox-reports-claim and release=true.`
+}
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index deaede183be8..d5041b97068f 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -97,6 +97,7 @@ export type InboxReportActionType =
| 'discuss'
| 'restore'
| 'create_pr'
+ | 'copy_implementation_prompt'
| 'refund'
| 'open_pr'
| 'view_diff'