: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): expose github-optional controls in inbox (#123579)
Georgiy Tarasov5b038b6b5841
diff --git a/docs/internal/signals-pr-lifecycle.md b/docs/internal/signals-pr-lifecycle.mdindex 1394e9ccc3b8..3b8ba4366e82 100644--- a/docs/internal/signals-pr-lifecycle.md+++ b/docs/internal/signals-pr-lifecycle.md@@ -225,7 +225,7 @@ Research without a repository preserves structured agent startup failures and clA saved repository is reused before checking GitHub availability. A data-only fallback leaves that selection and its recorded context unchanged, so a transient failure cannot replace a reviewer's pinned target.-The report remains readable and supports discussion, assignment, resolution, and eligible monitoring. Pull request creation requires usable repository access. The access check probes GitHub directly, preserving temporary failures for retry instead of treating a stale repository list as a permission decision. Any installation that confirms access enables the action without waiting for other installations. Connecting or repairing GitHub does not enable automatic implementation; the user must opt in separately. Previous blocked reports are not automatically rerun.+The report remains readable and supports discussion, assignment, resolution, and eligible monitoring. Implement offers prompts for the customer's own agents even without GitHub access, including while access checks are pending or have failed. Choosing Implement with PostHog requires usable repository access and opens the GitHub connection flow when access is missing. Both report details and triage use these choices, with retry available after temporary failures. The access check probes GitHub directly, and any installation that confirms access enables PostHog implementation without waiting for other installations. Report controls use the server's canonical project eligibility. Authorization returns to the report; existing installations can be linked without leaving it. Recovery tracking records the report, surface, retry, and outcome. GitHub access improves research by connecting project data to code; opening pull requests is optional. Connecting or repairing GitHub does not enable automatic implementation; the user must opt in separately. Previous blocked reports are not automatically rerun.Report access checks share pending and recent results by project, installation, and repository for up to 30 seconds. Explicit retries invalidate the project cache. A pending request is canceled when its last report reader leaves or after 30 seconds, allowing stalled checks to be retried; temporary failures are not cached. The backend still checks live access before creating an implementation task.diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a36a67f5e73b..28e59bcb6ef8 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11876,6 +11876,10 @@ snapshots:hash: v1.k794b7964.59805bf93bed4319e9bbec23d802d06ca76b990c4ed497ee2a1922b9e689540a.NZJPllw6kwGCITFHxI98NqU-x8Rvnafak466IuSkGNAscenes-app-inbox-detail--report-with-metrics--light:hash: v1.k794b7964.05b603c03895df2f00e1e385c05ae580743592a99444592fa8996bc50ed905c4.f0VUnsaVAEZJV-2OYrQIpYxuv2rBy0IMbBb3Lnx8wc8+ scenes-app-inbox-detail--report-without-code-access--dark:+ hash: v1.k794b7964.8516b4f177bb16c77dc041db16b278f9eaf4adf2f4ce2cd9d3939d31613b6f7d.TVrbH6bbkoTZ2WtU4hpNqashX_YLVRroHcvgwrYF1Zw+ scenes-app-inbox-detail--report-without-code-access--light:+ hash: v1.k794b7964.2d1d1f3632c379bd41ce62eea2aadff7540fd9ffbcf0ada37fe2fcf1e135cc86.yaCrhH50Jvl2Z204maL2xsLfTNwnKaGa4Y-NyfzLPG8scenes-app-inbox-detail--run-failed--dark:hash: v1.k794b7964.e82d63bd21d2d441d8c2c13cc22279805acdec1bb01ec04f2fbef3ad418adaeb.hXPwtY6-D5RdgQZYCCVXmnz_VtcZdDkAGuQlkAizdvYscenes-app-inbox-detail--run-failed--light:@@ -12072,6 +12076,10 @@ snapshots:hash: v1.k794b7964.7cbc08f42385a0c5e3724905cd168889ea285773047dec630d44f44ae3214ff3.87cUu_WLwNEGkXed2dbxjbzN3Qnnq1ooUzoNQjCGRF4scenes-app-inbox-focused-setup--github-already-connected--light:hash: v1.k794b7964.0c4e46e52d6fd87cfda72f60455771998ed40646fd21942f80380322da453354.3sHKex8XGnDIU5-Q1CC-G9FaHEtRtR_vTBBQK3RfwsY+ scenes-app-inbox-focused-setup--github-optional--dark:+ hash: v1.k794b7964.bba2fa4658875d6bfd7d5bf4199b7e3d44098355552abd7d13a0ad11921ce76b.lQ5yHGLJE-aFK5h5vvcaC_VgVItjr4mqLYOfcK8duC8+ scenes-app-inbox-focused-setup--github-optional--light:+ hash: v1.k794b7964.2978442299d25c651fd91387489339b48a22842ead681bd2400ed587b3b3efe5._NCkiNtNaSkfNWxU6R-lU8FVQfneGUUN1Q2_l9em5J8scenes-app-inbox-focused-setup--github-without-automatic-implementation--dark:hash: v1.k794b7964.65add98c7b7ca1ef5c937f57e619c355e7350b680f78d2823a7fcfcb4c14b9c4.HzFGZjD0QK7T2fN0qIXfMF9bDGuHcg0wdH0h2jXMj0Escenes-app-inbox-focused-setup--github-without-automatic-implementation--light:@@ -12128,6 +12136,10 @@ snapshots:hash: v1.k794b7964.04e3f5a9e20f0032cff25e7878e16328871b41813d2a4e3064e731f91d3b876c.hVFY_MWjWZDX4fr9y2vacAy3wHZuNHwp5cYjveu_KfEscenes-app-inbox-implementbutton--choices--light:hash: v1.k794b7964.a179eeb16be74806e49a273f5e2df6c06e6c729f4696b7ea08806c515c508a5d.oPurfCP4WUVbo_EKSrjGF6FooFGZbvNcJjXEp9VK-R8+ scenes-app-inbox-implementbutton--connect-github--dark:+ hash: v1.k794b7964.79bf4d12ec94f3d54b3b088261dd19e12b9802e8f6eb18f59a4684f497cf598d.4x5a8Y85BRXcjgVaKywwtNL0aOuog8qQ4Y_s8vzWX-k+ scenes-app-inbox-implementbutton--connect-github--light:+ hash: v1.k794b7964.b2f2c36d151e7c067cda71fdc51f621c170cc694e7c329f6672a00a6723f24df.fXT2eIm-l-T4hQS1nKp9y0IOuCBeDDBp6W2WHAynHH8scenes-app-inbox-implementbutton--default--dark:hash: v1.k794b7964.f2b5351f205a0abb1531706c02950c727ede9d9f7cf220869b571442805a5a24.NvzH40X-7cVbDTiW0u9CRIwI3ENeZ37ePippBtcZg2Mscenes-app-inbox-implementbutton--default--light:diff --git a/frontend/src/lib/integrations/utils.ts b/frontend/src/lib/integrations/utils.tsindex 25a66c942229..50277e330046 100644--- a/frontend/src/lib/integrations/utils.ts+++ b/frontend/src/lib/integrations/utils.ts@@ -80,6 +80,8 @@ export type IntegrationConnectSurface =| 'warehouse_source_reconnect'| 'onboarding_wizard'| 'inbox_welcome'+ | 'inbox_report'+ | 'inbox_triage'| 'signals_agent_setup'| 'task_composer'| 'visual_review_settings'diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.tsindex c5f5bebfbb71..5e62c81b12dc 100644--- a/frontend/src/mocks/handlers.ts+++ b/frontend/src/mocks/handlers.ts@@ -350,6 +350,11 @@ export const defaultMocks: Mocks = {'/api/team_sdk_versions/': teamSdkVersions,'/api/environments/:team_id/endpoints/': EMPTY_PAGINATED_RESPONSE,'/api/projects/:team_id/signals/source_configs/': EMPTY_PAGINATED_RESPONSE,+ '/api/projects/:team_id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: false,+ },'/api/projects/:team_id/feature_flags/:feature_flag_id/dependent_flags/': EMPTY_PAGINATED_RESPONSE,'/api/environments/:team_id/llm_prompts/resolve/': {},'/api/environments/:team_id/llm_analytics/': {},diff --git a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsxindex e3e54c2b182c..b23d4efc9c4b 100644--- a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx@@ -33,6 +33,7 @@ import { copyToClipboard } from 'lib/utils/copyToClipboard'import { captureInboxReportAction } from '../../inboxAnalytics'import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'+import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'import { reportListLogic, sectionListLogicProps } from '../../logics/reportListLogic'import { InboxReportSectionKey, SignalReport, SignalReportStatus } from '../../types'import {@@ -141,7 +142,9 @@ function ReportContextMenuItems({// Kept mounted by `ReportsTab` beyond this menu's lifetime, so the create-PR listener survives// the menu closing on click.const { createPrFromReport } = useActions(inboxTaskKickoffLogic)- const { createPrDisabledReason } = useValues(inboxTaskKickoffLogic)+ const { createPrDisabledReason: globalPrDisabledReason } = useValues(inboxTaskKickoffLogic)+ const { disabledReason: githubDisabledReason } = useValues(reportGithubAccessLogic({ report }))+ const createPrDisabledReason = globalPrDisabledReason ?? githubDisabledReasonconst reportTitle = displayConventionalCommitTitle(report.title, 'Untitled report')const hasOpenPr = hasOpenImplementationPr(report)const { isSelected, toggle: toggleSelection } = useReportCardSelection(report.id, true)diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsxindex 4640bcf70949..634e249e621a 100644--- a/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.stories.tsx@@ -2,7 +2,10 @@ import type { Meta, StoryObj } from '@storybook/react'import { waitFor, within } from '@testing-library/dom'import userEvent from '@testing-library/user-event'+import { mswDecorator } from '~/mocks/browser'+import { makeReport } from '../../__mocks__/inboxMocks'+import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'import { ImplementButton } from './ImplementButton'const meta: Meta<typeof ImplementButton> = {@@ -32,3 +35,39 @@ export const Choices: Story = {})},}++export const ConnectGithub: Story = {+ parameters: { testOptions: { snapshotTargetSelector: '.LemonModal' } },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: true,+ },+ '/api/projects/:id/integrations/': { results: [], next: null },+ '/api/projects/:id/integrations/github/available_installations/': {+ installations: [],+ personal_github_connected: false,+ },+ },+ }),+ ],+ render: () => <ImplementButton report={report} />,+ play: async ({ canvasElement }) => {+ await userEvent.click(await within(canvasElement).findByText('Implement'))+ const implement = await waitFor(() => {+ if (!reportGithubAccessLogic({ report }).values.repairNeeded) {+ throw new Error('GitHub connection requirement has not resolved')+ }+ const button = within(document.body).getByText('Implement with PostHog').closest('button')!+ if (button.getAttribute('aria-disabled') === 'true') {+ throw new Error('GitHub check has not finished')+ }+ return button+ })+ await userEvent.click(implement)+ await within(document.body).findByText('Connect GitHub account')+ },+}diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsxindex 280d0c1c09b9..fa84ea5da381 100644--- a/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.test.tsx@@ -1,3 +1,4 @@+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */import '@testing-library/jest-dom'import { cleanup, render, screen, waitFor } from '@testing-library/react'@@ -6,6 +7,7 @@ import { expectLogic } from 'kea-test-utils'import { copyToClipboard } from 'lib/utils/copyToClipboard'+import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { runnerPanelLogic } from 'products/posthog_ai/frontend/api/logics'@@ -15,6 +17,7 @@ import { mockTask } from '../../__mocks__/inboxMocks'import { captureInboxReportAction } from '../../inboxAnalytics'import { inboxTaskKickoffLogic, REPORT_AI_PANEL_ID } from '../../inboxTaskKickoffLogic'import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'+import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'import { SignalReport, SignalReportStatus } from '../../types'import { ImplementButton } from './ImplementButton'@@ -68,12 +71,15 @@ describe('ImplementButton', () => {return user}- it('starts a PostHog agent from the main action', async () => {+ it('offers implementation choices before starting a PostHog agent', async () => {const user = userEvent.setup()render(<ImplementButton report={makeReport()} />)await user.click(screen.getByTestId('inbox-report-create-pr'))+ expect(createPrFromReport).not.toHaveBeenCalled()+ await user.click(screen.getByTestId('inbox-report-create-pr-submit'))+expect(createPrFromReport).toHaveBeenCalledWith(expect.objectContaining({ id: 'report-1' }), undefined)expect(jest.mocked(captureInboxReportAction).mock.calls[0][0].extra).toEqual({ has_feedback: false })})@@ -90,7 +96,13 @@ describe('ImplementButton', () => {detail.actions.loadReportTasksSuccess([{ task, purpose: 'implementation', purposeLabel: 'Implementation', startedAt: task.created_at },])- render(<ImplementButton report={report} />)+ render(+ <ImplementButton+ report={report}+ reportTaskToOpen={detail.values.reportTaskToOpen}+ implementationDisabledReason={detail.values.implementationDisabledReason}+ />+ )expect(screen.queryByTestId('inbox-report-create-pr')).not.toBeInTheDocument()await user.click(screen.getByTestId('inbox-report-open-task'))@@ -104,13 +116,47 @@ describe('ImplementButton', () => {})- 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()+ it.each([200, 503])('keeps customer prompts available without GitHub access (status %i)', async (status) => {+ let repositoryStatus = status+ useMocks({+ get: {+ '/api/projects/:team_id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: true,+ },+ '/api/projects/:team_id/integrations/': { results: [{ id: 1, kind: 'github' }], next: null },+ '/api/projects/:team_id/integrations/1/github_repository_access/': () => [+ repositoryStatus,+ { available: false },+ ],+ '/api/projects/:team_id/integrations/github/available_installations/': {+ installations: [],+ personal_github_connected: false,+ },+ },+ })+ const user = userEvent.setup()+ const report = makeReport()+ render(<ImplementButton report={report} />)+ const access = reportGithubAccessLogic({ report })+ await waitFor(() => expect(access.values[status === 503 ? 'failed' : 'repairNeeded']).toBe(true))+ await user.click(screen.getByTestId('inbox-report-create-pr'))+ await user.click(screen.getByTestId('inbox-report-copy-implementation-prompt'))+ expect(copyToClipboard).toHaveBeenCalledWith(+ expect.stringContaining('report ID: report-1'),+ 'prompt for your agent'+ )+ expect(createPrFromReport).not.toHaveBeenCalled()+ if (status === 503) {+ expect(screen.getByTestId('inbox-report-create-pr-submit')).toHaveAttribute('aria-disabled', 'true')+ repositoryStatus = 200+ await user.click(screen.getByText('Retry GitHub check'))+ await waitFor(() => expect(access.values.repairNeeded).toBe(true))+ }+ await user.click(screen.getByTestId('inbox-report-create-pr-submit'))+ expect(await screen.findByText('Manage on GitHub')).toBeInTheDocument()expect(createPrFromReport).not.toHaveBeenCalled()- expect(copyToClipboard).not.toHaveBeenCalled()})it.each([diff --git a/products/signals/frontend/inbox/components/detail/ImplementButton.tsx b/products/signals/frontend/inbox/components/detail/ImplementButton.tsxindex 03f98e410444..fc5fecff2962 100644--- a/products/signals/frontend/inbox/components/detail/ImplementButton.tsx+++ b/products/signals/frontend/inbox/components/detail/ImplementButton.tsx@@ -8,49 +8,72 @@ import type { AgentPromptDestination } from 'lib/components/AgentPromptButton'import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'import { copyToClipboard } from 'lib/utils/copyToClipboard'import { addProjectIdIfMissing } from 'lib/utils/kea-router'-import { fullNameOrEmail } from 'lib/utils/strings'import { urls } from 'scenes/urls'import { captureInboxReportAction } from '../../inboxAnalytics'import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'-import { ImplementationSlotClaim, inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'+import type { ReportTaskEntry } from '../../logics/inboxReportDetailLogic'+import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'import { SignalReport } from '../../types'import { buildReportImplementationPrompt } from './buildReportImplementationPrompt'import { IMPLEMENTATION_AGENTS } from './implementationAgents'+import { ReportGithubConnection } from './ReportGithubConnection'-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.',+interface ImplementButtonProps {+ report: SignalReport+ surface?: 'detail_pane' | 'triage_mode'+ implementationDisabledReason?: string | null+ reportTaskToOpen?: ReportTaskEntry | null}-export function ImplementButton({ report }: { report: SignalReport }): JSX.Element {+export function ImplementButton({+ report,+ surface = 'detail_pane',+ implementationDisabledReason,+ reportTaskToOpen,+}: ImplementButtonProps): JSX.Element {const { isCreatingPr, isDiscussing, createPrDisabledReason } = useValues(inboxTaskKickoffLogic)- const { implementationSlotClaim, reportTaskToOpen, reportClaimant, isClaimedByMe } = useValues(- inboxReportDetailLogic({ reportId: report.id, report })- )+ const {+ disabledReason: githubDisabledReason,+ repairNeeded,+ connectionOpen,+ failed: githubCheckFailed,+ loading: githubCheckLoading,+ } = useValues(reportGithubAccessLogic({ report, surface }))+ const { retryAccess, setConnectionOpen } = useActions(reportGithubAccessLogic({ report, surface }))const { createPrFromReport, openReportTask } = useActions(inboxTaskKickoffLogic)const [instructions, setInstructions] = useState('')+ const [choicesOpen, setChoicesOpen] = useState(false)const reportUrl = `${window.location.origin}${addProjectIdIfMissing(urls.inboxReport('reports', report.id))}`const disabledReason =createPrDisabledReason ??+ (repairNeeded ? null : githubDisabledReason) ??(isDiscussing ? 'Wait for the discussion task to start.' : undefined) ??- (implementationSlotClaim ? SLOT_CLAIM_DISABLED_REASON[implementationSlotClaim] : undefined) ??- (reportClaimant && !isClaimedByMe ? `${fullNameOrEmail(reportClaimant)} is working on this report.` : undefined)+ implementationDisabledReasonconst submit = (note: string): void => {- if (isCreatingPr || isDiscussing || implementationSlotClaim || (reportClaimant && !isClaimedByMe)) {+ if (isCreatingPr || isDiscussing || implementationDisabledReason) {return}if (createPrDisabledReason) {lemonToast.error(createPrDisabledReason)return}+ if (repairNeeded) {+ setChoicesOpen(false)+ setConnectionOpen(true)+ return+ }+ if (githubDisabledReason) {+ lemonToast.error(githubDisabledReason)+ return+ }const trimmed = note.trim()captureInboxReportAction({report,actionType: 'create_pr',- surface: 'detail_pane',+ surface,extra: { has_feedback: trimmed.length > 0 },})createPrFromReport(report, trimmed || undefined)@@ -61,7 +84,7 @@ export function ImplementButton({ report }: { report: SignalReport }): JSX.ElemecaptureInboxReportAction({report,actionType: 'copy_implementation_prompt',- surface: 'detail_pane',+ surface,extra: { agent: agentKey },})run(prompt)@@ -89,89 +112,109 @@ export function ImplementButton({ report }: { report: SignalReport }): JSX.Eleme}return (- <LemonButton- type="primary"- size="small"- className="[--lemon-button-hover-depth:0px]"- icon={<IconPullRequest />}- onClick={() => submit('')}- loading={isCreatingPr}- disabledReason={disabledReason}- tooltip="Implement this report with PostHog"- data-attr="inbox-report-create-pr"- sideAction={{- tooltip: 'More implementation options',- 'aria-label': 'More implementation options',- 'data-attr': 'inbox-report-create-pr-steer',- dropdown: {- placement: 'bottom-end',- closeOnClickInside: false,- overlay: (- <div className="flex w-128 flex-col gap-2 p-2">- <span className="text-xs font-semibold text-tertiary">- Add instructions for the PostHog agent- </span>- <LemonTextArea- value={instructions}- onChange={setInstructions}- onPressEnter={submit}- placeholder="Add instructions for the PostHog agent (optional)"- maxLength={4000}- rows={4}- autoFocus- actions={[- <span key="shortcut" className="text-xs text-tertiary">- Enter to implement, Shift + Enter for a new line- </span>,- ]}- />- <div className="flex flex-wrap items-center justify-between gap-2">- <LemonButton- type="secondary"- icon={<IconCopy />}- onClick={() =>- runImplementationPrompt('clipboard', (prompt) => {- void copyToClipboard(prompt, 'prompt for your agent')- })- }- data-attr="inbox-report-copy-implementation-prompt"- sideAction={{- tooltip: 'Open prompt in an agent',- 'aria-label': 'Open prompt in an agent',- dropdown: {- placement: 'bottom-start',- overlay: (- <LemonMenuOverlay- items={IMPLEMENTATION_AGENTS.map((agent) => ({- key: agent.key,- label: agent.name,- icon: agent.icon,- onClick: () => runImplementationPrompt(agent.key, agent.open),- }))}- />- ),- },- }}- >- Copy prompt for your agent- </LemonButton>- <LemonButton- type="primary"- icon={<IconPullRequest />}- onClick={() => submit(instructions)}- loading={isCreatingPr}- disabledReason={disabledReason}- data-attr="inbox-report-create-pr-submit"- >- Implement with PostHog- </LemonButton>+ <>+ <LemonButton+ type="primary"+ size="small"+ className="[--lemon-button-hover-depth:0px]"+ icon={<IconPullRequest />}+ onClick={() => setChoicesOpen(true)}+ loading={isCreatingPr}+ tooltip="Choose how to implement this report"+ data-attr={surface === 'triage_mode' ? 'inbox-triage-create-pr' : 'inbox-report-create-pr'}+ sideAction={{+ tooltip: 'More implementation options',+ 'aria-label': 'More implementation options',+ 'data-attr': 'inbox-report-create-pr-steer',+ dropdown: {+ visible: choicesOpen && !connectionOpen,+ onVisibilityChange: setChoicesOpen,+ placement: 'bottom-end',+ closeOnClickInside: false,+ overlay: (+ <div className="flex w-128 max-w-full flex-col gap-2 p-2">+ <span className="text-xs font-semibold text-tertiary">+ Add instructions for the PostHog agent+ </span>+ <LemonTextArea+ value={instructions}+ onChange={setInstructions}+ onPressEnter={submit}+ placeholder="Add instructions for the PostHog agent (optional)"+ maxLength={4000}+ rows={4}+ autoFocus+ actions={[+ <span key="shortcut" className="text-xs text-tertiary">+ Enter to implement, Shift + Enter for a new line+ </span>,+ ]}+ />+ <div className="flex flex-wrap items-center justify-between gap-2">+ <LemonButton+ type="secondary"+ icon={<IconCopy />}+ onClick={() =>+ runImplementationPrompt('clipboard', (prompt) => {+ void copyToClipboard(prompt, 'prompt for your agent')+ })+ }+ data-attr="inbox-report-copy-implementation-prompt"+ sideAction={{+ tooltip: 'Open prompt in an agent',+ 'aria-label': 'Open prompt in an agent',+ dropdown: {+ placement: 'bottom-start',+ overlay: (+ <LemonMenuOverlay+ items={IMPLEMENTATION_AGENTS.map((agent) => ({+ key: agent.key,+ label: agent.name,+ icon: agent.icon,+ onClick: () =>+ runImplementationPrompt(agent.key, agent.open),+ }))}+ />+ ),+ },+ }}+ >+ Copy prompt for your agent+ </LemonButton>+ {githubCheckFailed && (+ <LemonButton+ type="secondary"+ size="small"+ onClick={retryAccess}+ loading={githubCheckLoading}+ data-attr={+ surface === 'triage_mode'+ ? 'inbox-triage-retry-github'+ : 'inbox-report-retry-github'+ }+ >+ Retry GitHub check+ </LemonButton>+ )}+ <LemonButton+ type="primary"+ icon={<IconPullRequest />}+ onClick={() => submit(instructions)}+ loading={isCreatingPr}+ disabledReason={disabledReason}+ data-attr="inbox-report-create-pr-submit"+ >+ Implement with PostHog+ </LemonButton>+ </div></div>- </div>- ),- },- }}- >- Implement- </LemonButton>+ ),+ },+ }}+ >+ Implement+ </LemonButton>+ <ReportGithubConnection report={report} surface={surface} />+ </>)}diff --git a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsxindex 1c0e1fd57aca..f81cff0cef73 100644--- a/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx+++ b/products/signals/frontend/inbox/components/detail/InboxDetail.stories.tsx@@ -265,6 +265,41 @@ export const ReportReadyToImplement: Story = {),}+export const ReportWithoutCodeAccess: Story = {+ ...ReportReadyToImplement,+ parameters: {+ featureFlags: { ...meta.parameters?.featureFlags, [FEATURE_FLAGS.SELF_DRIVING_GITHUB_OPTIONAL]: true },+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/integrations/': { results: [], next: null, count: 0 },+ '/api/projects/:id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: true,+ },+ '/api/projects/:id/signals/reports/:reportId/artefacts': (req) => {+ const results = mockArtefacts(req.params.reportId as string).results.filter(+ (artefact) => !['commit', 'suggested_reviewers', 'task_run'].includes(artefact.type)+ )+ return [200, { results, count: results.length }]+ },+ },+ }),+ ],+ render: () => (+ <Frame>+ <ReportDetail+ report={{+ ...reportTabReports[0],+ research_context: { mode: 'data_only', repository_status: 'no_integration' },+ }}+ />+ </Frame>+ ),+}+export const ReportClaimedByTeammate: Story = {decorators: [readyToImplementMocks],render: () => (diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsxindex 4405fb824d35..1ac46da85525 100644--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx@@ -11,7 +11,7 @@ import {IconSidebarOpen,IconTrends,} from '@posthog/icons'-import { LemonButton, LemonTabs, LemonSelect } from '@posthog/lemon-ui'+import { LemonBanner, LemonButton, LemonTabs, LemonSelect, Link } from '@posthog/lemon-ui'import { TZLabel } from 'lib/components/TZLabel'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'@@ -234,6 +234,7 @@ export function InboxDetailFrame({trailingCharts,detailTab,reportTaskToOpen,+ implementationDisabledReason,reportChecks,reportChecksError,prioritySaving,@@ -275,7 +276,14 @@ export function InboxDetailFrame({const reportActions = useReportDetailActions(report)const showCreatePr = canCreateImplementationPr(report)- const implementButton = showCreatePr || reportTaskToOpen ? <ImplementButton report={report} /> : null+ const implementButton =+ showCreatePr || reportTaskToOpen ? (+ <ImplementButton+ report={report}+ reportTaskToOpen={reportTaskToOpen}+ implementationDisabledReason={implementationDisabledReason}+ />+ ) : nullconst summaryHasSolution = parseReportSummary(report.summary).sections.some((section) => section.kind === 'solution')@@ -359,6 +367,14 @@ export function InboxDetailFrame({const summaryColumn = (<div className="flex flex-1 flex-col gap-6">+ {report.research_context?.mode === 'data_only' && (+ <LemonBanner type="info">+ This report uses only your PostHog data. Without code access, agents can find problems but can't+ trace them to the underlying code, so findings may be less specific.{' '}+ <Link to={urls.settings('environment-integrations', 'integration-github')}>GitHub access</Link>{' '}+ helps agents investigate root causes and pinpoint what to change.+ </LemonBanner>+ )}<div className="flex flex-col gap-2">{titleHeading}{claimPill}diff --git a/products/signals/frontend/inbox/components/detail/ReportGithubConnection.tsx b/products/signals/frontend/inbox/components/detail/ReportGithubConnection.tsxnew file mode 100644index 000000000000..5647e7f1061f--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportGithubConnection.tsx@@ -0,0 +1,59 @@+import { useActions, useValues } from 'kea'++import { LemonBanner, LemonButton, LemonModal } from '@posthog/lemon-ui'++import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'+import { TeamMembershipLevel } from 'lib/constants'+import { GithubIntegration } from 'scenes/integrations/components/GithubIntegration'+import { IntegrationAccessRequest } from 'scenes/integrations/components/IntegrationAccessRequest'+import { urls } from 'scenes/urls'++import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'+import { SignalReport } from '../../types'++export function ReportGithubConnection({+ report,+ surface,+}: {+ report: SignalReport+ surface: 'detail_pane' | 'triage_mode'+}): JSX.Element {+ const logic = reportGithubAccessLogic({ report, surface })+ const { connectionOpen, loading, failed } = useValues(logic)+ const { setConnectionOpen, retryAccess } = useActions(logic)+ const restricted = useRestrictedArea({+ scope: RestrictionScope.Project,+ minimumAccessLevel: TeamMembershipLevel.Member,+ })+ return (+ <LemonModal title="Connect GitHub" isOpen={connectionOpen} onClose={() => setConnectionOpen(false)}>+ <div className="flex max-w-xl flex-col gap-4">+ <p className="m-0">+ Connect a GitHub account and give PostHog access to {report.repo_slug || 'your repository'} to+ create a pull request for this report.+ </p>+ {restricted ? (+ <IntegrationAccessRequest kind="github" name="GitHub" />+ ) : (+ <GithubIntegration+ next={urls.inboxReport('reports', report.id)}+ connectSurface={surface === 'triage_mode' ? 'inbox_triage' : 'inbox_report'}+ connectText="Connect GitHub account"+ emphasizeConnect+ showPersonalConnectionHelp={false}+ connectDescription=""+ />+ )}+ {failed && <LemonBanner type="error">Couldn't check GitHub access. Try again.</LemonBanner>}+ <LemonButton+ type="secondary"+ onClick={retryAccess}+ loading={loading}+ data-attr="inbox-report-recheck-github"+ >+ Check access again+ </LemonButton>+ </div>+ </LemonModal>+ )+}diff --git a/products/signals/frontend/inbox/components/onboarding/InboxQuickSetupAction.tsx b/products/signals/frontend/inbox/components/onboarding/InboxQuickSetupAction.tsxindex 721e09b7d0d0..b7b013e9724f 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxQuickSetupAction.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxQuickSetupAction.tsx@@ -16,8 +16,15 @@ import { useScoutCreateDisabledReason } from '../config/scouts/ScoutCreateModalHexport function InboxQuickSetupAction(): JSX.Element {const { startSetup, connectGithub, activateQuickSetup, resumeQuickSetup, retry } = useActions(inboxSetupLogic)- const { hasGithubIntegration, quickSetupReady, saving, error, shouldResumeQuickSetup, failedOperation } =- useValues(inboxSetupLogic)+ const {+ hasGithubIntegration,+ isGithubOptionalSetup,+ quickSetupReady,+ saving,+ error,+ shouldResumeQuickSetup,+ failedOperation,+ } = useValues(inboxSetupLogic)const { integrations, integrationsLoading } = useValues(integrationsLogic)const scoutDisabledReason = useScoutCreateDisabledReason()const restrictionReason = useRestrictedArea({@@ -34,7 +41,7 @@ export function InboxQuickSetupAction(): JSX.Element {return (<div className="flex w-full flex-col items-start gap-3">- {hasGithubIntegration ? (+ {hasGithubIntegration || isGithubOptionalSetup ? (<LemonButtontype="primary"status="alt"diff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupActions.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupActions.tsxindex fc46e3693d78..c365d38f80c4 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxSetupActions.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupActions.tsx@@ -16,7 +16,7 @@ export function InboxSetupActions(): JSX.Element {return (<div className="flex w-full min-w-0 flex-col gap-4">- {!isTreatment && (+ {!isTreatment && !isQuickSetup && (<div className="flex min-w-0 flex-col gap-2"><p className="m-0 text-sm text-secondary">Install with Wizard. Run the setup agent in your repository to connect GitHub and choose yourdiff --git a/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsx b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsxindex a7968d059c6d..7152ca539994 100644--- a/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsx+++ b/products/signals/frontend/inbox/components/onboarding/InboxSetupFlow.stories.tsx@@ -442,6 +442,35 @@ export const QuickEntry: Story = {],}+export const GithubOptional: Story = {+ ...QuickEntry,+ name: 'GitHub-optional pilot',+ parameters: {+ featureFlags: {+ [FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'control',+ [FEATURE_FLAGS.SELF_DRIVING_GITHUB_OPTIONAL]: true,+ },+ },+ play: async ({ canvas }) => {+ await canvas.findByText('Activate Self-Driving')+ await expect(canvas.queryByText('Connect GitHub')).not.toBeInTheDocument()+ await expect(canvas.queryByLabelText(`Copy command: ${SELF_DRIVING_WIZARD_COMMAND}`)).not.toBeInTheDocument()+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: true,+ },+ '/api/projects/:id/signals/scout/configs/': [quickGeneralScout],+ '/api/projects/:id/integrations/': { results: [], next: null, count: 0 },+ },+ }),+ ],+}+export const QuickConnected: Story = {...QuickEntry,name: 'Quick setup with GitHub connected',diff --git a/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsxindex f12bc52abb16..a0c5702cb473 100644--- a/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx+++ b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { useEffect, useRef } from 'react'-import { IconArrowLeft, IconCheckCircle, IconPullRequest } from '@posthog/icons'+import { IconArrowLeft, IconCheckCircle } from '@posthog/icons'import { LemonButton, LemonSkeleton, Link, Tooltip } from '@posthog/lemon-ui'import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'@@ -24,6 +24,7 @@ import {} from '../../utils/reportPresentation'import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'import { ConventionalCommitScopeTag, InboxCardSourceMeta } from '../cards/ReportCard'+import { ImplementButton } from '../detail/ImplementButton'import { DismissOrUnassignButton } from './DismissOrUnassignButton'/**@@ -105,8 +106,8 @@ function HintBarItem({ shortcut, label }: { shortcut: JSX.Element; label: string}export function TriageCard({ report, expanded }: { report: SignalReport; expanded: boolean }): JSX.Element {- const { canCreatePr, isCreatingPr, createPrDisabledReason, currentReportUrl } = useValues(inboxTriageLogic)- const { resolveCurrent, createPrForCurrent, openCurrent, toggleExpanded } = useActions(inboxTriageLogic)+ const { canCreatePr, currentReportUrl } = useValues(inboxTriageLogic)+ const { resolveCurrent, openCurrent, toggleExpanded } = useActions(inboxTriageLogic)// Read above the article keyed by report, so a key still held after Unassign me survives the// move to the next report.const commandKeyHeld = useKeyHeld(COMMAND_KEY)@@ -211,20 +212,7 @@ export function TriageCard({ report, expanded }: { report: SignalReport; expandeResolve</LemonButton><DismissOrUnassignButton commandKeyHeld={commandKeyHeld} />- {canCreatePr && (- <LemonButton- type="primary"- size="small"- icon={<IconPullRequest />}- onClick={createPrForCurrent}- loading={isCreatingPr}- disabledReason={createPrDisabledReason ?? undefined}- sideIcon={<KeyboardShortcut c />}- data-attr="inbox-triage-create-pr"- >- Create PR- </LemonButton>- )}+ {canCreatePr && <ImplementButton report={report} surface="triage_mode" />}<div className="flex-1" /><LemonButtontype="tertiary"diff --git a/products/signals/frontend/inbox/components/triage/TriageCard.test.tsx b/products/signals/frontend/inbox/components/triage/TriageCard.test.tsxindex f303e8a205d7..da62f4a11dce 100644--- a/products/signals/frontend/inbox/components/triage/TriageCard.test.tsx+++ b/products/signals/frontend/inbox/components/triage/TriageCard.test.tsx@@ -1,12 +1,13 @@/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */import '@testing-library/jest-dom'-import { cleanup, fireEvent, render, screen } from '@testing-library/react'+import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { inboxTriageLogic } from '../../logics/inboxTriageLogic'+import { reportGithubAccessLogic } from '../../logics/reportGithubAccessLogic'import { SignalReport, SignalReportStatus } from '../../types'import { TriageCard } from './InboxTriageView'@@ -39,11 +40,12 @@ describe('TriageCard', () => {get: {'/api/projects/:team_id/signals/reports/available_reviewers': {},'/api/projects/:team_id/signals/reports/': { count: 0, next: null, previous: null, results: [] },+ '/api/projects/:team_id/signals/onboarding/': { draft: null, completed_at: null },+ '/api/projects/:team_id/signals/scout/configs/': [],},})initKeaTests()logic = inboxTriageLogic()- logic.mount()})afterEach(() => {@@ -52,6 +54,7 @@ describe('TriageCard', () => {})it('keeps Unassign me on the next report while the command key stays held', () => {+ logic.mount()const { rerender } = render(<TriageCard report={makeReport('r-1')} expanded={false} />)fireEvent.keyDown(window, { key: 'Control' })expect(screen.getByText('Unassign me')).toBeInTheDocument()@@ -61,4 +64,64 @@ describe('TriageCard', () => {expect(screen.getByText('Unassign me')).toBeInTheDocument()expect(screen.queryByText('Dismiss')).not.toBeInTheDocument()})++ it.each([+ [503, 'button'],+ [200, 'button'],+ [200, 'keyboard'],+ ] as const)('recovers GitHub access without leaving triage (status %i, %s)', async (status, entrypoint) => {+ const report = { ...makeReport('r-1'), actionability: 'immediately_actionable' as const }+ let repositoryStatus = status+ let available = false+ const loadReportDetails = jest.fn(() => ({ results: [], count: 0 }))+ useMocks({+ get: {+ '/api/projects/:team_id/signals/reports/': { results: [report], next: null, count: 1 },+ '/api/projects/:team_id/signals/reports/:report_id/artefacts/': loadReportDetails,+ '/api/projects/:team_id/signals/onboarding/': {+ draft: null,+ completed_at: null,+ github_optional_available: true,+ },+ '/api/projects/:team_id/integrations/': { results: [{ id: 1, kind: 'github' }], next: null },+ '/api/projects/:team_id/integrations/github/available_installations/': {+ installations: [],+ personal_github_connected: false,+ },+ '/api/projects/:team_id/integrations/1/github_repository_access/': () => [+ repositoryStatus,+ { available },+ ],+ },+ })+ logic.mount()+ render(<TriageCard report={report} expanded={false} />)+ const access = reportGithubAccessLogic({ report, surface: 'triage_mode' })+ await waitFor(() => expect(access.values[status === 503 ? 'failed' : 'repairNeeded']).toBe(true))+ if (entrypoint === 'keyboard') {+ logic.actions.createPrForCurrent()+ } else {+ fireEvent.click(screen.getByText('Implement').closest('button')!)+ expect(screen.getByText('Copy prompt for your agent')).toBeInTheDocument()+ if (status === 200) {+ fireEvent.click(screen.getByText('Implement with PostHog').closest('button')!)+ }+ }+ if (status === 200) {+ expect(await screen.findByText('Manage on GitHub')).toBeInTheDocument()+ }+ const retry = (await screen.findByText(status === 503 ? 'Retry GitHub check' : 'Check access again')).closest(+ 'button'+ )!+ repositoryStatus = 200+ available = true+ fireEvent.click(retry)+ expect(retry).toHaveAttribute('aria-disabled', 'true')+ await waitFor(() =>+ expect(reportGithubAccessLogic({ report, surface: 'triage_mode' }).values.disabledReason).toBeNull()+ )+ expect(screen.queryByText('Retry GitHub check')).not.toBeInTheDocument()+ expect(screen.getByText('Implement')).toBeInTheDocument()+ expect(loadReportDetails).not.toHaveBeenCalled()+ })})diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.tsindex 5bf5735892a7..87a1ac8ef584 100644--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts@@ -19,6 +19,7 @@ import { lemonToast } from '@posthog/lemon-ui'import api, { ApiConfig } from 'lib/api'import { ApiError } from 'lib/api-error'import { dayjs } from 'lib/dayjs'+import { fullNameOrEmail } from 'lib/utils/strings'import { SignalNode } from 'scenes/debug/signals/types'import { personalIntegrationsLogic } from 'scenes/settings/user/personalIntegrationsLogic'import type { PersonalGitHubIntegration } from 'scenes/settings/user/personalIntegrationsLogic'@@ -94,6 +95,11 @@ const TERMINAL_RUN_STATUSES: TaskRunStatus[] = [TaskRunStatus.COMPLETED, TaskRun/** Why the report's one implementation slot is still claimed. Mirrors the server's `_ImplementationSlotClaim`. */export type ImplementationSlotClaim = 'in_flight' | 'shipped_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.',+}+export type PrChecksError = {message: stringremediationUrl: string | null@@ -345,6 +351,7 @@ export interface inboxReportDetailLogicValues {feedbackSubmitting: booleanhasImplementationPr: booleanhasPersonalGithub: boolean+ implementationDisabledReason: string | nullimplementationSlotClaim: ImplementationSlotClaim | nullinlineThreadCount: numberinlineThreadsByFile: Record<string, ReviewThread[]>@@ -762,6 +769,11 @@ export interface inboxReportDetailLogicMeta {isClaimedByMe: (reportClaimant: _UserApi | null, user: null | import('~/types').UserType) => booleanisReportClaimable: (report: SignalReport | null) => booleanimplementationSlotClaim: (reportTasks: ReportTaskEntry[] | null) => ImplementationSlotClaim | null+ implementationDisabledReason: (+ implementationSlotClaim: ImplementationSlotClaim | null,+ reportClaimant: _UserApi | null,+ isClaimedByMe: boolean+ ) => string | nullprimaryTask: (reportTasks: ReportTaskEntry[] | null) => ReportTaskEntry | nullreportTaskToOpen: (reportTasks: ReportTaskEntry[] | null) => ReportTaskEntry | nullselectedTask: (@@ -1521,6 +1533,19 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([(reportTasks: ReportTaskEntry[] | null): ImplementationSlotClaim | null =>implementationSlotClaim(reportTasks),],+ implementationDisabledReason: [+ (s) => [s.implementationSlotClaim, s.reportClaimant, s.isClaimedByMe],+ (+ slotClaim: ImplementationSlotClaim | null,+ claimant: _UserApi | null,+ isClaimedByMe: boolean+ ): string | null =>+ slotClaim+ ? SLOT_CLAIM_DISABLED_REASON[slotClaim]+ : claimant && !isClaimedByMe+ ? `${fullNameOrEmail(claimant)} is working on this report.`+ : null,+ ],// The default task whose run log is shown: prefer one still in motion, tie-break by most-recent// link. Mirrors desktop `AgentRunDetail`'s `pickPrimaryTask`.primaryTask: [diff --git a/products/signals/frontend/inbox/logics/inboxSetupLogic.test.ts b/products/signals/frontend/inbox/logics/inboxSetupLogic.test.tsindex 6584944f86be..3f54982c5497 100644--- a/products/signals/frontend/inbox/logics/inboxSetupLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxSetupLogic.test.ts@@ -47,6 +47,7 @@ describe('focused Inbox setup', () => {let canonicalScouts: SignalScoutConfigApi[]let enabledScouts: string[]let hasErrorTrackingData: boolean+ let githubOptional: booleanlet hasEvents: booleanlet completedAt: string | nulllet scanners: { id: string; enabled: boolean; emits_signals: boolean }[]@@ -62,6 +63,7 @@ describe('focused Inbox setup', () => {canonicalScouts = []enabledScouts = []hasErrorTrackingData = false+ githubOptional = falsehasEvents = falsefailCompletion = truecompletedAt = null@@ -87,6 +89,7 @@ describe('focused Inbox setup', () => {draft: savedDraft,completed_at: completedAt,variant,+ github_optional_available: githubOptional,}),'/api/projects/:id/signals/source_configs/': () => ({results: sources,@@ -109,26 +112,31 @@ describe('focused Inbox setup', () => {status: 'low_activity',items: [],}),- '/api/projects/:id/integrations/': {- results: [- {- id: 1,- kind: 'github',- config: {},- display_name: 'example',- created_at: '2026-10-14',- icon_url: '',- },- ],+ '/api/projects/:id/integrations/': () => ({+ results: githubOptional+ ? []+ : [+ {+ id: 1,+ kind: 'github',+ config: {},+ display_name: 'example',+ created_at: '2026-10-14',+ icon_url: '',+ },+ ],next: null,- count: 1,- },+ count: githubOptional ? 0 : 1,+ }),},post: {'/api/projects/:id/signals/onboarding/expose/': async ({ request }) => {const assignment = (await request.json()) as { variant: typeof variant }variant ??= assignment.variant- return [200, { draft: savedDraft, completed_at: null, variant }]+ return [+ 200,+ { draft: savedDraft, completed_at: null, variant, github_optional_available: githubOptional },+ ]},'/api/projects/:id/signals/scout/configs/sync/': ({ request }) => {expect(new URL(request.url).searchParams.get('surface')).toBe('onboarding')@@ -144,7 +152,15 @@ describe('focused Inbox setup', () => {},'/api/projects/:id/signals/onboarding/': async ({ request }) => {savedDraft = (await request.json()) as InboxOnboardingDraftApi- return [200, { draft: savedDraft, completed_at: completedAt, variant }]+ return [+ 200,+ {+ draft: savedDraft,+ completed_at: completedAt,+ variant,+ github_optional_available: githubOptional,+ },+ ]},'/api/projects/:id/signals/config/': {},'/api/projects/:id/signals/source_configs/': async ({ request }) => {@@ -159,7 +175,15 @@ describe('focused Inbox setup', () => {'/api/projects/:id/signals/onboarding/complete/': () =>failCompletion? [500, { detail: 'Activation interrupted' }]- : [200, { draft: savedDraft, completed_at: '2026-10-14T12:00:00Z', variant }],+ : [+ 200,+ {+ draft: savedDraft,+ completed_at: '2026-10-14T12:00:00Z',+ variant,+ github_optional_available: githubOptional,+ },+ ],},patch: {'/api/projects/:id/vision/scanners/:scanner/': async ({ request, params }) => {@@ -195,17 +219,20 @@ describe('focused Inbox setup', () => {})it.each([- ['button', true, null],- ['github_return', true, null],- ['button', false, null],- ['github_return', false, null],- ['button', true, true],- ['button', false, false],+ ['button', true, null, false],+ ['github_return', true, null, false],+ ['button', false, null, false],+ ['github_return', false, null, false],+ ['button', true, true, false],+ ['button', false, false, false],+ ['button', false, null, true],+ ['button', true, null, true],] as const)(- 'activates through %s with usage-based pricing %s and saved implementation %s',- async (entry, usageBasedPricing, savedImplementation) => {+ 'activates through %s with usage-based pricing %s and saved implementation %s and GitHub-optional pilot %s',+ async (entry, usageBasedPricing, savedImplementation, pilot) => {+ githubOptional = pilotconst capture = jest.spyOn(posthog, 'capture')- variant = entry === 'github_return' ? 'test-github' : null+ variant = pilot ? 'control' : entry === 'github_return' ? 'test-github' : nullfeatureFlagLogic.actions.setFeatureFlags([], {[FEATURE_FLAGS.SELF_DRIVING_UBP]: usageBasedPricing,[FEATURE_FLAGS.INBOX_UI_ONBOARDING]: 'test-github',@@ -240,7 +267,7 @@ describe('focused Inbox setup', () => {}await waitFor(() => expect(logic.values.completed).toBe(true))expect(enabledScouts).toEqual(['signals-scout-general'])- expect(logic.values.savedState?.draft?.automatic_implementation).toBe(!usageBasedPricing)+ expect(logic.values.savedState?.draft?.automatic_implementation).toBe(!pilot && !usageBasedPricing)expect(logic.values.savedState?.draft?.suggestions.map((item) => item.skill_name)).toEqual(['signals-scout-general',])@@ -256,13 +283,13 @@ describe('focused Inbox setup', () => {['self-driving onboarding activation requested',expect.objectContaining({- variant: 'test-github',+ variant: pilot ? 'control' : 'test-github',setup_mode: 'quick',flow_version: 'ui-first-v1',inbox_client: 'cloud',activation_source: entry,self_driving_ubp: usageBasedPricing,- automatic_implementation: !usageBasedPricing,+ automatic_implementation: !pilot && !usageBasedPricing,}),],])diff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.tsindex b0e9bd94aa37..e36f0ff41e20 100644--- a/products/signals/frontend/inbox/logics/inboxTriageLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.ts@@ -12,6 +12,7 @@ import { inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'import { INBOX_PRIMARY_REPORT_SECTION_KEY, InboxReportSectionKey, SignalReport, SignalReportStatus } from '../types'import { canCreateImplementationPr, canUnassignMe, hasOpenImplementationPr } from '../utils/reportActions'import { displayConventionalCommitTitle } from '../utils/reportPresentation'+import { reportGithubAccessLogic } from './reportGithubAccessLogic'import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './reportListLogic'/**@@ -493,6 +494,11 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([if (!report || !values.canCreatePr || values.isCreatingPr || values.createPrDisabledReason) {return}+ const access = reportGithubAccessLogic.findMounted({ report, surface: 'triage_mode' })+ if (access?.values.repairNeeded) {+ access.actions.setConnectionOpen(true)+ return+ }// Triage is a fast keyboard flow with no note box, so it never steers the agent.captureInboxReportAction({report,