: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): replace the inbox claim pill and add claim to the row menu (#124457)
Dylan Martinc3ff58435fe8
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 76d478186f96..38753c326803 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11995,9 +11995,9 @@ snapshots:scenes-app-inbox-agent-steering--empty--light:hash: v1.k794b7964.8adf1aa893baffeccf09c959ceb43997a3d0dd7b802f915f683721bb3178811c.yiCitLDCxycb1PBAgQTZ4xqjtSr02cPmmNj0VOb8bu8scenes-app-inbox-badges--all-badges--dark:- hash: v1.k794b7964.81beb23b0f5d86d2f034789d2e4b7c9fbc8d2604bc249676d7e69c656ffd5ddd.esG0tfBqbGNg3u_Rp7zU9zTtEGbc20Zlw8gp_MX-Kyc+ hash: v1.k794b7964.8635ddc327485b37b2ab8b1208268d0bd3fdd5fe724e422668127cf6fa9c7f58.gIHuhbLyooSuhOZgUcY8oN0BVaAX8yN7EggFrcVtcgEscenes-app-inbox-badges--all-badges--light:- hash: v1.k794b7964.dbbc59f2220d651b8ba34d07ee113d912c3ab1404c245a5533c73c6b714ed809.kYcnjcB3M5smbeUGvt2jhhCc5WigaxdbMJ4swTjGPmo+ hash: v1.k794b7964.5408f482285055305b44fe2e4b83f2c2fc0fd13f2b211c8efdfb18bc4beb06cd.U6GeCA7wKBuifjGSGQhysRYiOn3IHxVTIo3YeGx4vPwscenes-app-inbox-cards--agent-run-cards--dark:hash: v1.k794b7964.7cc4dbc1b4a83c8bf268f09c3d00e8b7603c512cdd0c3cc0d75f4b981e5dc5ab.wTpmY_L9kXga6yhoZsATY70EN3UhqZAs-YdxGBCZBWQscenes-app-inbox-cards--agent-run-cards--light:@@ -12010,6 +12010,10 @@ snapshots:hash: v1.k794b7964.df52d231101a79b1e72cc3b945f13f075bd70dadc6fc83ae57768489306e0524.HcJnLZGgHyHQR776r133omV-MJwrtVQNi8rOEGZM2Ssscenes-app-inbox-cards--pull-request-cards-plain-titles--light:hash: v1.k794b7964.0b3c557dd40813aa536451458e434919dda89b7db6bbcb12efbe6af11e1f95a8.h64YqR3YWci1bQo-8eMZS0sCGYM--V57r9VxR67yJeU+ scenes-app-inbox-cards--report-card-claims--dark:+ hash: v1.k794b7964.0869413b6549ec880738d2b1027557ca43261ba77494056570db3d287894d474.24khdTzcgNLys1nXkfTUjYMnqSPQrgjoAH5KEojzbcc+ scenes-app-inbox-cards--report-card-claims--light:+ hash: v1.k794b7964.a0c5c50d464e77c37eebc6d632f941a14a1781a4a56887cba8c67bdc0a146339.s_GdO_rSCXgztc4ixwKZxZgq1gxJC77MemS6JtNMGOgscenes-app-inbox-cards--report-card-ranking-tags--dark:hash: v1.k794b7964.fe2edfc719172a09b7a54479a14278f8c39853b604bb6eda0b17aba928d45d85.ZJo3-Ncode3NwUV8az9HACGNrnYqBDzi2qpFD3OYN6Yscenes-app-inbox-cards--report-card-ranking-tags--light:@@ -13159,9 +13163,9 @@ snapshots:scenes-app-inbox-tabs--reports--light:hash: v1.k794b7964.09631597a035ed2189054412354d31cd22be3eec9bb0f561418068ea3ef9c214.EXw1pHmTZK_RjVclsYo_Kxb0JqyvHrvFgvkQAzayXcMscenes-app-inbox-tabs--reports-claimed-by-you--dark:- hash: v1.k794b7964.1070834764fdad5a3d888541deb8b0c72fac85a3836eb21f4a62446bc7c45a22.DvVXNF9vqwD76ZaD-2_kHjXlyTqb1snRqwB8AOSosGY+ hash: v1.k794b7964.15ddc87e6cc609a0cad930a7bca2f97cf16226b304c0167e222aaa53e273b6d0.d2mpa26hDIfftwQJLcTnVPkA6_8pWrC63v5tQuQezeYscenes-app-inbox-tabs--reports-claimed-by-you--light:- hash: v1.k794b7964.95bf3928b8fa23267ce0bb0e8018ad38d913ecd0a6f4f5b67e09fdb3bd4435f2.WQz4vOt5sfNaYpjjP83G9dHpxtvfyckM09VXeKJHY64+ hash: v1.k794b7964.aea97c395bca30f3a5d93137ef0121bb5d43ef23a2900a2f6a58b2891e217817.8DWXonv-t_Zys4by2MVzwT0pLCrt3woF62OkCM7OQG0scenes-app-inbox-tabs--reports-empty--dark:hash: v1.k794b7964.dc29c2f2e427a085e6638ef993c88dcc03a504fdb24167b483fff97553bd46ed.ty7BrQvUhYyHSMZKZjwRJamVmkH7NNaUMDBbB-wLDIgscenes-app-inbox-tabs--reports-empty--light:@@ -13171,9 +13175,9 @@ snapshots:scenes-app-inbox-tabs--reports-state-filtered--light:hash: v1.k794b7964.cb670e03a25ac8030f2f2d4d9d41cbbd8e26b60fbcae8ea96e10e58d0a5eddad.31zd7o2K_JZ3CehR-Gl0RnbvrXTP7tVtnBtTdscMG5Uscenes-app-inbox-tabs--reports-with-claims--dark:- hash: v1.k794b7964.8739ea679919c4d6a2c09bd357e89614fe2252af85a9025bb56b523a770ad515.YaLcy41I469btJRSyINtIJbpbcnl7hydSuJxi7voOVY+ hash: v1.k794b7964.19e0355be00df376c8d290c427cc20d9fd65997ee1350a8ee3244b78ee7707e5.lUuD2B-0WDdEzWPQwx6TfIODKfK40i1Ndi-RlKLqnaoscenes-app-inbox-tabs--reports-with-claims--light:- hash: v1.k794b7964.cf4edb8ac059037df5005e5bcca04f215e126823ce37f45e5fd64d940c4c2492.-voqOgPliDlvuLkVAamILi4hlybtZdbKJ_5rmP-u1IY+ hash: v1.k794b7964.ee20c6285438743dfe97ea2257cce3c78fcf4297e939ef97bcc3bcbf41d0e694.lS8bxCWjM0ANUgGFPN78LlUiGKutTp9zsdbPBJIST0Yscenes-app-inbox-tabs--runs--dark:hash: v1.k794b7964.b0eb8ed605bd36103e79e0a60b214bb3923082a8a3e942619b209e2e63c4c27b.tc-_hXddEA1-okpf16Of3a1wM9gWn-D4ZW1_LLaPKq4scenes-app-inbox-tabs--runs--light:diff --git a/products/signals/backend/report_claims.py b/products/signals/backend/report_claims.pyindex c00ed954e713..aa684e31d307 100644--- a/products/signals/backend/report_claims.py+++ b/products/signals/backend/report_claims.py@@ -118,18 +118,12 @@ def responsible_users(claims: Iterable[ReportClaim]) -> dict[UUID, User]:def reports_claimed_for_user(*, team_id: int, user_id: int) -> Q:- """Reports whose active claim the user answers for: their own, their external agents', and their tasks'."""- claims = active_claims(team_id=team_id)- legacy = legacy_claims(team_id=team_id)- claimed_task_ids = [- *claims.filter(created_by__isnull=True, task_id__isnull=False).values_list("task_id", flat=True),- *legacy.filter(actor_user__isnull=True, actor_task_id__isnull=False).values_list("actor_task_id", flat=True),- ]- own_task_ids = tasks_facade.filter_task_ids_created_by(- [task_id for task_id in claimed_task_ids if task_id is not None], team_id=team_id, user_id=user_id- )- own_claims = claims.filter(Q(created_by_id=user_id) | Q(created_by__isnull=True, task_id__in=own_task_ids))- own_legacy = legacy.filter(Q(actor_user_id=user_id) | Q(actor_user__isnull=True, actor_task_id__in=own_task_ids))+ """Reports the user claimed, themselves or through their external agents.++ Internal task claims do not count: auto-start runs tasks as a suggested reviewer who never took the work on.+ """+ own_claims = active_claims(team_id=team_id).filter(created_by_id=user_id)+ own_legacy = legacy_claims(team_id=team_id).filter(actor_user_id=user_id)return Q(id__in=own_claims.values("report_id")) | Q(id__in=own_legacy.values("report_id"))diff --git a/products/signals/backend/test/test_signal_report_assignment_api.py b/products/signals/backend/test/test_signal_report_assignment_api.pyindex b0ba6bcd2886..c3f7069902fa 100644--- a/products/signals/backend/test/test_signal_report_assignment_api.py+++ b/products/signals/backend/test/test_signal_report_assignment_api.py@@ -941,7 +941,7 @@ class TestSignalReportAssignmentAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OKassert {row["id"] for row in response.json()["results"]} == {str(mine.id)}- def test_assignee_mine_matches_claims_by_the_user_their_agents_and_their_tasks(self):+ def test_assignee_mine_matches_claims_by_the_user_and_their_agents_but_not_their_tasks(self):Task = apps.get_model("tasks", "Task")teammate = User.objects.create_and_join(self.organization, "[email protected]", None)own_task = Task.objects.create(@@ -950,12 +950,12 @@ class TestSignalReportAssignmentAPI(APIBaseTest):teammate_task = Task.objects.create(team=self.team, created_by=teammate, title="Teammate task", origin_product=Task.OriginProduct.SIGNAL_REPORT)- mine = [self._create_report(title=title) for title in ("By me", "By my agent", "By my task")]- theirs = [self._create_report(title=title) for title in ("By teammate", "By teammate task")]+ mine = [self._create_report(title=title) for title in ("By me", "By my agent")]+ theirs = [self._create_report(title=title) for title in ("By teammate", "By teammate task", "By my task")]for report, headers in [(mine[0], {}),(mine[1], self._agent_headers("codex")),- (mine[2], {"X-PostHog-Task-Id": str(own_task.id)}),+ (theirs[2], {"X-PostHog-Task-Id": str(own_task.id)}),(theirs[1], {"X-PostHog-Task-Id": str(teammate_task.id)}),]:assert self.client.post(self._claim_url(report), data={}, format="json", headers=headers).status_code == 200diff --git a/products/signals/backend/views.py b/products/signals/backend/views.pyindex 73b778c844a9..e17024b96371 100644--- a/products/signals/backend/views.py+++ b/products/signals/backend/views.py@@ -1520,8 +1520,8 @@ _REPORT_LIST_PARAMETERS = [enum=["me", "mine"],description=("'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or "- "the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, "- "claims by MCP agents acting for them, and claims by internal tasks they started."+ "the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and "+ "claims by MCP agents acting for them. Internal task claims are not included."),),]diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex ad76f3895177..7be17c2801c4 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -10606,7 +10606,7 @@ export type SignalsReportsListParams = {*/already_addressed?: boolean/**- * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started.+ * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included.*/assignee?: SignalsReportsListAssignee/**@@ -10839,7 +10839,7 @@ export type SignalsReportsSectionCountsRetrieveParams = {*/already_addressed?: boolean/**- * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started.+ * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included.*/assignee?: SignalsReportsSectionCountsRetrieveAssignee/**diff --git a/products/signals/frontend/inbox/components/badges/InboxBadges.stories.tsx b/products/signals/frontend/inbox/components/badges/InboxBadges.stories.tsxindex 8291c9fe8ea7..ef0099d42ad4 100644--- a/products/signals/frontend/inbox/components/badges/InboxBadges.stories.tsx+++ b/products/signals/frontend/inbox/components/badges/InboxBadges.stories.tsx@@ -1,12 +1,13 @@import type { Meta, StoryObj } from '@storybook/react'import { myClaim, teammateClaim } from '../../__mocks__/inboxMocks'-import { SignalReportActionability, SignalReportPriority, SignalReportStatus } from '../../types'+import { SignalReport, SignalReportActionability, SignalReportPriority, SignalReportStatus } from '../../types'import { AnimatedEllipsis } from './AnimatedEllipsis'-import { ReportClaimTag } from './ReportClaimTag'+import { ReportClaimAvatar } from './ReportClaimAvatar'import { SignalReportActionabilityBadge } from './SignalReportActionabilityBadge'import { SignalReportPriorityBadge } from './SignalReportPriorityBadge'import { SignalReportStatusBadge } from './SignalReportStatusBadge'+import { useReportClaim } from './useReportClaim'const meta: Meta = {title: 'Scenes-App/Inbox/Badges',@@ -33,6 +34,11 @@ function Row({ label, children }: { label: string; children: React.ReactNode }):)}+function Claim({ assignee }: { assignee: SignalReport['assignee'] }): JSX.Element | null {+ const claim = useReportClaim(assignee)+ return claim ? <ReportClaimAvatar claim={claim} /> : null+}+export const AllBadges: Story = {render: () => (<div className="bg-primary p-8 flex flex-col gap-4">@@ -52,8 +58,8 @@ export const AllBadges: Story = {))}</Row><Row label="Claim">- <ReportClaimTag report={{ assignee: myClaim }} />- <ReportClaimTag report={{ assignee: teammateClaim }} />+ <Claim assignee={myClaim} />+ <Claim assignee={teammateClaim} /></Row><Row label="Working"><span className="text-sm text-secondary">diff --git a/products/signals/frontend/inbox/components/badges/ReportClaimAvatar.tsx b/products/signals/frontend/inbox/components/badges/ReportClaimAvatar.tsxnew file mode 100644index 000000000000..d5327193d389--- /dev/null+++ b/products/signals/frontend/inbox/components/badges/ReportClaimAvatar.tsx@@ -0,0 +1,23 @@+import clsx from 'clsx'++import { ProfilePicture, Tooltip } from '@posthog/lemon-ui'++import type { ReportClaim } from './useReportClaim'++/** The claimer's avatar on a report card. A ring marks the user's own claims apart from a teammate's. */+export function ReportClaimAvatar({ claim }: { claim: ReportClaim }): JSX.Element {+ return (+ <Tooltip title={claim.tooltip}>+ <span className="inline-flex shrink-0" data-attr="inbox-report-card-claim-tag">+ <ProfilePicture+ user={claim.person}+ name={claim.name}+ size="sm"+ className={clsx('rounded-full', claim.isMine && 'ring-3 ring-(--success)')}+ />+ {/* The avatar is an initial or an image with no alt text, so screen readers get the claim here. */}+ <span className="sr-only">{claim.tooltip}</span>+ </span>+ </Tooltip>+ )+}diff --git a/products/signals/frontend/inbox/components/badges/ReportClaimTag.tsx b/products/signals/frontend/inbox/components/badges/ReportClaimTag.tsxdeleted file mode 100644index 96b541154724..000000000000--- a/products/signals/frontend/inbox/components/badges/ReportClaimTag.tsx+++ /dev/null@@ -1,54 +0,0 @@-import { useValues } from 'kea'--import { LemonTag, ProfilePicture, Tooltip } from '@posthog/lemon-ui'--import { fullNameOrEmail } from 'lib/utils/strings'-import { userLogic } from 'scenes/userLogic'--import type { SignalReport } from '../../types'--function claimTooltip(kind: string, name: string | null): string {- if (kind === 'agent') {- return name ? `${name}'s agent is working on this` : 'Your agent is working on this'- }- if (kind === 'task') {- return name ? `A task ${name} started is working on this` : 'A task you started is working on this'- }- return name ? `${name} is working on this` : 'You claimed this report'-}--/**- * Marks a claimed report, so the list tells the user's own claims apart from a teammate's. A claim by- * an MCP agent or an internal task counts for the person who answers for it, and the tooltip says which.- */-export function ReportClaimTag({ report }: { report: Pick<SignalReport, 'assignee'> }): JSX.Element | null {- const { user } = useValues(userLogic)- const assignee = report.assignee- const person = assignee?.responsible_user- if (!assignee || !person) {- return null- }- const isMine = !!user?.uuid && person.uuid === user.uuid- const name = fullNameOrEmail(person)-- if (isMine) {- return (- <Tooltip title={claimTooltip(assignee.kind, null)}>- <LemonTag type="success" size="small" data-attr="inbox-report-card-claim-tag">- You're on it- </LemonTag>- </Tooltip>- )- }- return (- <Tooltip title={claimTooltip(assignee.kind, name)}>- <LemonTag- size="small"- icon={<ProfilePicture user={person} name={name} size="xs" />}- data-attr="inbox-report-card-claim-tag"- >- <span className="max-w-32 truncate">{person.first_name || name}</span>- </LemonTag>- </Tooltip>- )-}diff --git a/products/signals/frontend/inbox/components/badges/useReportClaim.ts b/products/signals/frontend/inbox/components/badges/useReportClaim.tsnew file mode 100644index 000000000000..08ad1d1d4f30--- /dev/null+++ b/products/signals/frontend/inbox/components/badges/useReportClaim.ts@@ -0,0 +1,38 @@+import { useValues } from 'kea'++import { fullNameOrEmail } from 'lib/utils/strings'+import { userLogic } from 'scenes/userLogic'++import type { SignalReport } from '../../types'++type ClaimPerson = NonNullable<NonNullable<SignalReport['assignee']>['responsible_user']>++export interface ReportClaim {+ person: ClaimPerson+ name: string+ isMine: boolean+ tooltip: string+}++function claimTooltip(kind: string, name: string | null): string {+ if (kind === 'agent') {+ return name ? `${name}'s agent is working on this` : 'Your agent is working on this'+ }+ return name ? `${name} is working on this` : 'You claimed this report'+}++/**+ * Who is working on a report, or null when no person claimed it. A claim by an MCP agent counts for+ * the person who directed it. An internal task claim shows nothing: auto-start runs tasks as a suggested+ * reviewer, so naming that person would claim work they never took on.+ */+export function useReportClaim(assignee: SignalReport['assignee']): ReportClaim | null {+ const { user } = useValues(userLogic)+ const person = assignee?.responsible_user+ if (!assignee || !person || assignee.kind === 'task') {+ return null+ }+ const isMine = !!user?.uuid && person.uuid === user.uuid+ const name = fullNameOrEmail(person)+ return { person, name, isMine, tooltip: claimTooltip(assignee.kind, isMine ? null : name) }+}diff --git a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsxindex b8ce08fc422c..cacab3520c08 100644--- a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx+++ b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx@@ -9,7 +9,15 @@ import { RankingOutcomeEnumApi } from 'products/signals/frontend/generated/api.simport { userEvent } from 'storybook/test'-import { makeReport, pullRequestReports, reportTabReports, runReportsMany } from '../../__mocks__/inboxMocks'+import {+ makeReport,+ myAgentClaim,+ myClaim,+ pullRequestReports,+ reportTabReports,+ runReportsMany,+ teammateClaim,+} from '../../__mocks__/inboxMocks'import { SignalReport, SignalReportStatus } from '../../types'import { AgentRunCard } from './AgentRunCard'import { CardSkeleton } from './CardSkeleton'@@ -318,6 +326,45 @@ export const ReportCardRankingTags: Story = {},}+// Under the Action sort, so the ranking pill sits in the meta row: the user's claim, their agent's+// claim, a teammate's claim, and no claim.+const claimedRankedReports: SignalReport[] = [+ makeReport({+ title: 'Retry failed webhook deliveries with backoff',+ priority: 'P3',+ assignee: myClaim,+ ranking: ranking({ action: 0.62 }, { action: 6.2 }),+ }),+ makeReport({+ title: 'Cache the funnel step names on the insight page',+ priority: 'P4',+ assignee: myAgentClaim,+ ranking: ranking({ action: 0.31 }, { action: 1.4 }),+ }),+ makeReport({+ title: 'Stop the export job timing out on large files',+ priority: 'P2',+ assignee: teammateClaim,+ ranking: ranking({ action: 0.62 }, { action: 6.2 }),+ }),+ makeReport({+ title: 'Show an error when an invite email bounces',+ priority: 'P3',+ assignee: null,+ ranking: ranking({ action: 0.08 }, { action: 0.7 }),+ }),+]++export const ReportCardClaims: Story = {+ render: () => (+ <CardList>+ {claimedRankedReports.map((report) => (+ <ReportCard key={report.id} report={report} rankingSortField="ranking_action" />+ ))}+ </CardList>+ ),+}+export const PullRequestCards: Story = {render: () => (<Stack>diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.tsxindex 21e42215d31c..baf1588f1037 100644--- a/products/signals/frontend/inbox/components/cards/ReportCard.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportCard.tsx@@ -24,7 +24,7 @@ import {safeHttpUrl,} from '../../utils/reportPresentation'import { primaryReportPullRequest } from '../../utils/reportPullRequests'-import { ReportClaimTag } from '../badges/ReportClaimTag'+import { ReportClaimAvatar } from '../badges/ReportClaimAvatar'import { SignalReportBillingBadge } from '../badges/SignalReportBillingBadge'import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'import {@@ -32,6 +32,7 @@ import {SourceProductIconRow,sourceProductsTooltipTitle,} from '../badges/sourceProductIcons'+import { useReportClaim } from '../badges/useReportClaim'import { inboxCardRowClassName } from './inboxCardRowClassName'import { ReportCardImpactMetric } from './ReportCardImpactMetric'import { ReportCardRankingTag } from './ReportCardRankingTag'@@ -116,6 +117,7 @@ function ReportCardRaw({selectable = false,rankingSortField = null,timestampField = 'updated_at',+ hideOwnClaim = false,}: {report: SignalReportattached?: boolean@@ -133,6 +135,8 @@ function ReportCardRaw({rankingSortField?: InboxRankingSortField | null/** The time the card shows. Match it to the active time sort, so the list reads in order. */timestampField?: 'created_at' | 'updated_at'+ /** Hide the user's own claim marker, for views where every card is theirs. */+ hideOwnClaim?: boolean}): JSX.Element {const isDismissed = report.status === SignalReportStatus.SUPPRESSED// Resolved reports are terminal (a merged PR or a resolve) – shown for reference in the Resolved@@ -179,6 +183,10 @@ function ReportCardRaw({const glyphStatus = prCiGlyphStatus(prState, ciStatus)const isRefunded = !!report.refund++ const claim = useReportClaim(report.assignee)+ const showsClaim = !!claim && !isDismissed && !isResolved && !(claim.isMine && hideOwnClaim)+ const claimAvatar = showsClaim ? <ReportClaimAvatar claim={claim} /> : nullconst showsDismiss = !!onDismiss// Why the report left the inbox (reason tag + note tooltip) when we have it: the dismiss reason@@ -273,15 +281,17 @@ function ReportCardRaw({</LemonTag></Tooltip>)}- {!isDismissed && !isResolved && <ReportClaimTag report={report} />}<SignalReportBillingBadge report={report} />{rankingSortField && <ReportCardRankingTag report={report} sortField={rankingSortField} />}{!showImpactColumn && (- <TZLabel- time={cardTime}- className="ml-auto shrink-0 text-xs text-tertiary tabular-nums"- title={cardTimeTitle}- />+ <span className="ml-auto flex shrink-0 items-center gap-2">+ {claimAvatar}+ <TZLabel+ time={cardTime}+ className="shrink-0 text-xs text-tertiary tabular-nums"+ title={cardTimeTitle}+ />+ </span>)}</div></div>@@ -291,11 +301,14 @@ function ReportCardRaw({{showImpactColumn ? (<div className="flex w-full items-center gap-3 @lg:relative @lg:w-auto @lg:min-h-23 @lg:min-w-39 @lg:flex-none @lg:self-stretch @lg:justify-end"><ReportCardImpactMetric metrics={report.metrics} />- <TZLabel- time={cardTime}- className="ml-auto shrink-0 whitespace-nowrap text-xs leading-none text-tertiary tabular-nums @lg:absolute @lg:right-0 @lg:bottom-0 @lg:ml-0"- title={cardTimeTitle}- />+ <span className="ml-auto flex shrink-0 items-center gap-2 @lg:absolute @lg:right-0 @lg:bottom-0 @lg:ml-0">+ {claimAvatar}+ <TZLabel+ time={cardTime}+ className="shrink-0 whitespace-nowrap text-xs leading-none text-tertiary tabular-nums"+ title={cardTimeTitle}+ />+ </span></div>) : null}</>diff --git a/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx b/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsxindex 0bb4790ca231..4fc55aaff73c 100644--- a/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportContextMenu.test.tsx@@ -2,11 +2,14 @@ import '@testing-library/jest-dom'import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'+import { lemonToast } from '@posthog/lemon-ui'+import { copyToClipboard } from 'lib/utils/copyToClipboard'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'+import { myClaim, teammateClaim } from '../../__mocks__/inboxMocks'import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'import { INBOX_SCOPE_ENTIRE_PROJECT, SignalReport, SignalReportStatus } from '../../types'import { ReportContextMenu } from './ReportContextMenu'@@ -49,12 +52,18 @@ function menuRowText(): (string | null)[] {describe('ReportContextMenu', () => {let stateRequests: { reportId: string; body: Record<string, unknown> }[]+ let claimRequests: { reportId: string; body: Record<string, unknown> }[]beforeEach(() => {stateRequests = []+ claimRequests = []useMocks({get: {'/api/projects/:team_id/signals/reports/': { count: 0, next: null, previous: null, results: [] },+ // The menu mounts logics that load these. Without a valid answer the loaders log errors, and+ // Jest formats those stack traces synchronously, which blocks waitFor long enough to time out.+ '/api/projects/:team_id/signals/reports/available_reviewers/': [],+ '/api/projects/:team_id/signals/scout/configs/': [],},post: {'/api/projects/:team_id/signals/reports/:report_id/state/': async ({ request, params }) => {@@ -64,6 +73,13 @@ describe('ReportContextMenu', () => {})return [200, {}]},+ '/api/projects/:team_id/signals/reports/:report_id/claim/': async ({ request, params }) => {+ claimRequests.push({+ reportId: params.report_id as string,+ body: (await request.json()) as Record<string, unknown>,+ })+ return [200, { id: params.report_id, assignee: myClaim, updated_at: '2026-06-11T11:00:00Z' }]+ },},})initKeaTests()@@ -83,17 +99,27 @@ describe('ReportContextMenu', () => {{name: 'a ready actionable report offers every action',report: makeReport(),- expected: ['Select', 'Create PR', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],+ expected: ['Select', 'Claim', 'Create PR', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],},{name: 'a report with a PR does not offer creating another',report: makeReport({ implementation_pr_url: 'https://github.com/posthog/posthog/pull/1' }),- expected: ['Select', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],+ expected: ['Select', 'Claim', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],},{name: 'an in-progress report cannot be resolved yet',report: makeReport({ status: SignalReportStatus.IN_PROGRESS, actionability: null }),- expected: ['Select', 'Dismiss', 'Reviewers', 'Remove yourself'],+ expected: ['Select', 'Claim', 'Dismiss', 'Reviewers', 'Remove yourself'],+ },+ {+ name: 'a report the user claimed offers unclaim',+ report: makeReport({ assignee: myClaim }),+ expected: ['Select', 'Unclaim', 'Create PR', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],+ },+ {+ name: 'a monitoring report nobody claimed cannot be claimed',+ report: makeReport({ status: SignalReportStatus.MONITORING }),+ expected: ['Select', 'Resolve', 'Dismiss', 'Reviewers', 'Remove yourself'],},{name: 'a dismissed report only offers restore',@@ -118,6 +144,61 @@ describe('ReportContextMenu', () => {expect(menuRowText().includes('Remove yourself')).toBe(offered)})+ // The menu closes on click, so the claim must go through the list logic, which outlives it.+ it.each([+ { name: 'claims an unclaimed report', report: makeReport(), item: 'Claim', body: { takeover: false } },+ {+ name: 'releases the user claim',+ report: makeReport({ assignee: myClaim }),+ item: 'Unclaim',+ body: { release: true },+ },+ ])('$name', async ({ report, item, body }) => {+ openMenu(report)++ fireEvent.click(screen.getByText(item))++ await waitFor(() => expect(claimRequests).toEqual([{ reportId: 'report-1', body }]))+ })++ // A 409 has two causes. Telling the user a teammate took the report when its status changed sends them+ // looking for a person who does not exist.+ it.each([+ {+ cause: 'a teammate claimed it',+ current: { assignee: teammateClaim, status: SignalReportStatus.READY },+ toast: 'Someone else is already working on this report.',+ },+ {+ cause: 'its status no longer allows a claim',+ current: { assignee: null, status: SignalReportStatus.RESOLVED },+ toast: 'This report changed. Check it and try again.',+ },+ ])('explains a refused claim when $cause', async ({ current, toast }) => {+ useMocks({+ get: { '/api/projects/:team_id/signals/reports/:report_id/': { ...makeReport(), ...current } },+ post: { '/api/projects/:team_id/signals/reports/:report_id/claim/': [409, {}] },+ })+ const errorToast = jest.spyOn(lemonToast, 'error')+ try {+ openMenu(makeReport())++ fireEvent.click(screen.getByText('Claim'))++ await waitFor(() => expect(errorToast).toHaveBeenCalledWith(toast))+ } finally {+ errorToast.mockRestore()+ }+ })++ it('does not let the user claim a report a teammate is working on', () => {+ openMenu(makeReport({ assignee: teammateClaim }))++ fireEvent.click(screen.getByText('Claim'))++ expect(claimRequests).toEqual([])+ })+// A relative or wrong-tab URL would copy a link that 404s or opens the wrong list when pasted.it('copies the absolute report detail link', () => {openMenu(makeReport())diff --git a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsxindex b23d4efc9c4b..e641ecae0032 100644--- a/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportContextMenu.tsx@@ -12,6 +12,7 @@ import {IconHide,IconLeave,IconPeople,+ IconPerson,IconPullRequest,IconUndo,} from '@posthog/icons'@@ -29,6 +30,8 @@ import {ContextMenuTrigger,} from 'lib/ui/ContextMenu/ContextMenu'import { copyToClipboard } from 'lib/utils/copyToClipboard'+import { fullNameOrEmail } from 'lib/utils/strings'+import { userLogic } from 'scenes/userLogic'import { captureInboxReportAction } from '../../inboxAnalytics'import { inboxTaskKickoffLogic } from '../../inboxTaskKickoffLogic'@@ -51,6 +54,7 @@ import {canUnassignMe,hasOpenImplementationPr,} from '../../utils/reportActions'+import { isReportClaimable, reportClaimant } from '../../utils/reportClaim'import { displayConventionalCommitTitle } from '../../utils/reportPresentation'import { reviewerRemovalReasonOptions } from '../../utils/reviewerRemovalReasons'import { ReviewerSearchList } from '../detail/ReviewerSearchList'@@ -61,7 +65,7 @@ import { useReportCardSelection } from './useReportCardSelection'/*** Right-click menu on a report row in the flat inbox list: the report's major actions without- * opening its detail. Create PR, Resolve, Dismiss, and Reviewers follow the same eligibility rules+ * opening its detail. Claim, Create PR, Resolve, Dismiss, and Reviewers follow the same eligibility rules* as the detail pane (`utils/reportActions.ts`); a dismissed row offers Restore instead. Resolve* and Dismiss nest their canonical reasons, and picking one applies immediately through the owning* section's list logic. The dialog stays available for a note, a corrected repository, or an open@@ -135,10 +139,12 @@ function ReportContextMenuItems({/** Tells the menu a dialog is opening, so its close skips the focus restore. */onOpenDialog: () => void}): JSX.Element {- const { dismissReport, resolveReport, restoreReport, unassignMe } = useActions(+ const { dismissReport, resolveReport, restoreReport, setReportClaimed, unassignMe } = useActions(reportListLogic(sectionListLogicProps(sectionKey)))const { isScopedToMe } = useValues(inboxFiltersLogic)+ const { claimSavingReportIds } = useValues(reportListLogic(sectionListLogicProps(sectionKey)))+ const { user } = useValues(userLogic)// Kept mounted by `ReportsTab` beyond this menu's lifetime, so the create-PR listener survives// the menu closing on click.const { createPrFromReport } = useActions(inboxTaskKickoffLogic)@@ -164,6 +170,29 @@ function ReportContextMenuItems({</ContextMenuItem>)+ // A teammate's claim shows disabled with their name, so the menu says why it can't be taken.+ const claimant = reportClaimant(report)+ const isMyClaim = !!claimant && !!user?.uuid && claimant.uuid === user.uuid+ const claimDisabledReason = claimSavingReportIds.includes(report.id)+ ? 'Updating…'+ : claimant && !isMyClaim+ ? `${fullNameOrEmail(claimant)} is working on this report`+ : null+ const claimItem =+ claimant || isReportClaimable(report) ? (+ <ContextMenuItem asChild disabled={!!claimDisabledReason}>+ <ButtonPrimitive+ menuItem+ onClick={() => setReportClaimed(report, !isMyClaim, 'context_menu')}+ disabledReasons={claimDisabledReason ? { [claimDisabledReason]: true } : undefined}+ data-attr={isMyClaim ? 'inbox-report-context-menu-unclaim' : 'inbox-report-context-menu-claim'}+ >+ <IconPerson />+ {isMyClaim ? 'Unclaim' : 'Claim'}+ </ButtonPrimitive>+ </ContextMenuItem>+ ) : null+const dismissWith = (dismissal: DismissalFeedback): void => {const { reason, note, correctedRepository } = dismissalcaptureInboxReportAction({@@ -305,6 +334,7 @@ function ReportContextMenuItems({<><ContextMenuGroup>{selectItem}+ {claimItem}{canCreateImplementationPr(report) && (<><ContextMenuItem asChild disabled={!!createPrDisabledReason}>diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsxindex d3dac5edd42b..204a784014f8 100644--- a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx@@ -169,11 +169,13 @@ const ReportRow = memo(function ReportRow({sectionKey,rankingSortField,timestampField,+ hideOwnClaim,}: {report: SignalReportsectionKey: InboxReportSectionKeyrankingSortField: InboxRankingSortField | nulltimestampField: 'created_at' | 'updated_at'+ hideOwnClaim: boolean}): JSX.Element {return (<ReportContextMenu report={report} sectionKey={sectionKey}>@@ -182,6 +184,7 @@ const ReportRow = memo(function ReportRow({selectablerankingSortField={rankingSortField}timestampField={timestampField}+ hideOwnClaim={hideOwnClaim}onRestore={() =>reportListLogic(sectionListLogicProps(sectionKey)).actions.restoreReport(report.id, 'list_row')}@@ -409,6 +412,7 @@ export function ReportsTab(): JSX.Element {sectionKey={sectionKey}rankingSortField={rankingSortField}timestampField={timestampField}+ hideOwnClaim={scope === INBOX_SCOPE_CLAIMED_BY_YOU}/></Fragment>))}diff --git a/products/signals/frontend/inbox/inboxSceneLogic.test.ts b/products/signals/frontend/inbox/inboxSceneLogic.test.tsindex 1403c7233fe9..42d94958cbcb 100644--- a/products/signals/frontend/inbox/inboxSceneLogic.test.ts+++ b/products/signals/frontend/inbox/inboxSceneLogic.test.ts@@ -15,6 +15,7 @@ import { initKeaTests } from '~/test/init'import { OriginProduct, Task, TaskRun, TaskRunStatus } from 'products/posthog_ai/frontend/types/taskTypes'import { TaskRuntimeEnumApi } from 'products/tasks/frontend/generated/api.schemas'+import { myClaim } from './__mocks__/inboxMocks'import { inboxSceneLogic, mergeSignalRuns } from './inboxSceneLogic'import { inboxBulkActionsLogic } from './logics/inboxBulkActionsLogic'import { reportListLogic, sectionListLogicProps } from './logics/reportListLogic'@@ -404,6 +405,17 @@ describe('inboxSceneLogic routing', () => {// A rank read at open time is null on a cold load, and joins to no impression row. The event is// then captured after the wait, so it also has to carry the moment the report opened: a scroll// or an action taken during the wait would otherwise read earlier than the open.+ // The detail pane reads the selected report. A claim from its list row must reach it, or the open report+ // keeps offering a claim the user already holds.+ it('shows a claim made from a list row on the open report', () => {+ mountLogic()+ logic.actions.loadSelectedReportSuccess({ id: 'r1', title: 'Crash on login', assignee: null } as SignalReport)++ inboxBulkActionsLogic.actions.reportClaimChanged('r1', myClaim)++ expect(logic.values.selectedReport?.assignee).toEqual(myClaim)+ })+it('holds `Inbox report opened` until the list answers, then reports the rank and the open time', async () => {const report = { id: 'r1', title: 'Crash on login' } as SignalReportuseMocks({diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.tsindex ff653f5744d9..bb727f9b139a 100644--- a/products/signals/frontend/inbox/inboxSceneLogic.ts+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts@@ -12,7 +12,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'import { getCurrentTeamIdOrNone } from 'lib/utils/getAppContext'import { removeProjectIdIfPresent } from 'lib/utils/kea-router'-import { reconcileById } from 'lib/utils/objects'+import { objectsEqual, reconcileById } from 'lib/utils/objects'import { sceneConfigurations } from 'scenes/scenes'import { Scene } from 'scenes/sceneTypes'import { teamLogic } from 'scenes/teamLogic'@@ -887,6 +887,20 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([}),listeners(({ actions, values, cache, selectors }) => ({+ // A claim from a list row can change the open report. Patch it the way the detail pane's own claim+ // does, which also skips the copy that pane already patched.+ [inboxBulkActionsLogic.actionTypes.reportClaimChanged]: ({+ reportId,+ assignee,+ }: {+ reportId: string+ assignee: SignalReport['assignee']+ }) => {+ const report = values.selectedReport+ if (report?.id === reportId && !objectsEqual(report.assignee ?? null, assignee ?? null)) {+ actions.seedSelectedReport({ ...report, assignee })+ }+ },setRunsOpen: ({ open }) => {// While the Runs panel is open, refetch on a slow poll so live runs update in place. The// keyed disposable replaces any prior poll and is torn down on close / unmount, anddiff --git a/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts b/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.tsindex 893fa3f083cb..2b13aa48e7b5 100644--- a/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts@@ -189,8 +189,8 @@ export const inboxBulkActionsLogic = kea<inboxBulkActionsLogicType>([/** Broadcast that a report's suggested reviewers were saved, with the PostHog user uuids now on* it, so a list scoped to a reviewer who is no longer on the report drops the row in place. */reportReviewersChanged: (reportId: string, reviewerUuids: string[]) => ({ reportId, reviewerUuids }),- /** Broadcast that a report was claimed or released elsewhere (the detail pane), with the new- * assignee (null once released), so every mounted list updates the row's claim in place. */+ /** Broadcast that a report was claimed or released elsewhere (the detail pane, a row menu), with the+ * new assignee (null once released), so every mounted list updates the row's claim in place. */reportClaimChanged: (reportId: string, assignee: SignalReport['assignee']) => ({ reportId, assignee }),}),diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.tsindex 9be22dca7be2..bf96d780d427 100644--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.test.ts@@ -340,6 +340,44 @@ describe('inboxReportDetailLogic', () => {})})+ // A claim from the row menu writes a work-log entry, and a ready report without a running task does not poll+ // its artefacts, so the open report must load them again or the claim is missing from its activity log.+ it.each([+ { name: 'its own report', reportId: REPORT.id, loads: 2 },+ { name: 'another report', reportId: 'report-2', loads: 1 },+ ])('reloads the activity log after a list claim on $name', async ({ reportId, loads }) => {+ let artefactLoads = 0+ useMocks({+ get: {+ '/api/projects/:team_id/signals/reports/:id/feedback_state/': { sentiment: null, note: '' },+ '/api/projects/:team_id/signals/reports/:id/artefacts/': () => {+ artefactLoads+++ return [200, { results: [] }]+ },+ '/api/projects/:team_id/signals/reports/:id/signals/': { signals: [] },+ '/api/projects/:team_id/signals/reports/:id/checks/': { results: [] },+ '/api/projects/:team_id/signals/reports/available_reviewers/': [],+ },+ })+ initKeaTests()+ const bulkLogic = inboxBulkActionsLogic()+ bulkLogic.mount()+ const logic = inboxReportDetailLogic({ reportId: REPORT.id, report: REPORT })+ logic.mount()+ try {+ await expectLogic(logic).toFinishAllListeners()+ expect(artefactLoads).toBe(1)++ bulkLogic.actions.reportClaimChanged(reportId, null)+ await expectLogic(logic).toFinishAllListeners()++ expect(artefactLoads).toBe(loads)+ } finally {+ logic.unmount()+ bulkLogic.unmount()+ }+ })+describe('reviewer updates', () => {const reviewer: EnrichedReviewer = {github_login: 'example-reviewer',diff --git a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.tsindex 762213738b97..3cdbe35034ac 100644--- a/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxReportDetailLogic.ts@@ -40,8 +40,6 @@ import {signalsReportPrReviewCommentReactionsCreate,signalsReportPrReviewCommentsCreate,signalsReportPrReviewCommentUpdate,- signalsReportsClaim,- signalsReportsRetrieve,signalsReportsFeedbackCreate,signalsReportsFeedbackStateRetrieve,signalsReportsSignalsRetrieve,@@ -85,7 +83,7 @@ import { inboxSceneLogic } from '../inboxSceneLogic'import { inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'import { EnrichedReviewer, ReviewerRemoval, SignalReport, SignalReportArtefact, SignalReportStatus } from '../types'import { ChartPlacements, resolveChartPlacements } from '../utils/chartPlacement'-import { isReportClaimable, reportClaimant, reportClaimRequest } from '../utils/reportClaim'+import { isReportClaimable, reportClaimant, requestReportClaim } from '../utils/reportClaim'import { reportPullRequests, primaryReportPullRequest, type ReportPullRequest } from '../utils/reportPullRequests'import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'@@ -118,26 +116,6 @@ function prChecksErrorFrom(error: unknown): PrChecksError {return { message: "Couldn't load the PR checks from GitHub.", remediationUrl: null }}-type FreshClaimAttempt = { fresh: SignalReportApi | null; updated: SignalReportApi | null }--/** Claims again from the server's current record. The page can still show the list's copy, whose claim may be out of date. */-async function claimFromFreshReport(teamId: string, reportId: string): Promise<FreshClaimAttempt> {- let fresh: SignalReportApi- try {- fresh = await signalsReportsRetrieve(teamId, reportId)- } catch {- return { fresh: null, updated: null }- }- if (!isReportClaimable({ status: fresh.status as SignalReportStatus, assignee: fresh.assignee })) {- return { fresh, updated: null }- }- try {- return { fresh, updated: await signalsReportsClaim(teamId, reportId, reportClaimRequest(fresh, true)) }- } catch {- return { fresh, updated: null }- }-}-// The task↔report association is the `task_run` artefact log now (the legacy `/tasks/` endpoint is// gone), and the activity timeline renders the whole log. Pull a generous page so early entries// (the first task runs, repo selection) stay visible on reports with many findings — matching the@@ -1599,6 +1577,13 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([}),listeners(({ actions, asyncActions, values, props, selectors, cache }) => ({+ // A claim from the report's list row writes a work-log entry, and a ready report without a running task+ // does not poll its artefacts. The pane's own claim reloads them itself, so skip it while that claim saves.+ [inboxBulkActionsLogic.actionTypes.reportClaimChanged]: ({ reportId }: { reportId: string }) => {+ if (reportId === props.reportId && !values.claimSaving) {+ actions.loadReportArtefacts()+ }+ },changeReportState: async ({ state }) => {if (values.reportStateSaving) {return@@ -1664,35 +1649,23 @@ export const inboxReportDetailLogic = kea<inboxReportDetailLogicType>([surface: 'detail_pane',})const scene = inboxSceneLogic.findMounted()- let updated: SignalReportApi | null = null- try {- updated = await signalsReportsClaim(- String(teamId),- props.reportId,- reportClaimRequest(currentReport, claimed)- )- } catch (error) {- const conflict = error instanceof ApiError && error.status === 409- const retry = conflict && claimed ? await claimFromFreshReport(String(teamId), props.reportId) : null- updated = retry?.updated ?? null- if (!updated) {- if (inboxReportDetailLogic.isMounted(props)) {- actions.setClaimSaving(false)- if (!conflict) {- lemonToast.error("Couldn't update who's working on this report. Try again.")- } else if (!retry || (retry.fresh && reportClaimant(retry.fresh))) {- lemonToast.error('Someone else is already working on this report.')- } else {- lemonToast.error('This report changed. Check it and try again.')- }- if (conflict) {- // Reload so the page shows who holds the claim now.- scene?.actions.loadSelectedReport({ id: props.reportId })- }+ const outcome = await requestReportClaim(+ String(teamId),+ { id: props.reportId, assignee: currentReport.assignee },+ claimed+ )+ if (!outcome.ok) {+ if (inboxReportDetailLogic.isMounted(props)) {+ actions.setClaimSaving(false)+ lemonToast.error(outcome.message)+ if (outcome.conflict) {+ // Reload so the page shows who holds the claim now.+ scene?.actions.loadSelectedReport({ id: props.reportId })}- return}+ return}+ const updated = outcome.updatedif (!inboxReportDetailLogic.isMounted(props)) {return}diff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.tsindex 4ecf54be137a..77f1e34aa4a6 100644--- a/products/signals/frontend/inbox/logics/reportListLogic.ts+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts@@ -38,6 +38,7 @@ import {} from '../types'import type { SignalReportPriority } from '../types'import { DismissalFeedback, ResolveReasonValue, suppressDismissalPayload } from '../utils/dismissalReasons'+import { requestReportClaim } from '../utils/reportClaim'import { isReportMetricsEnabled, mergeReportMetricSnapshots, reportNeedsMetricRefresh } from '../utils/reportMetrics'import { reportPullRequests, primaryReportPullRequest } from '../utils/reportPullRequests'import { inboxBulkActionsLogic } from './inboxBulkActionsLogic'@@ -176,6 +177,7 @@ export interface reportListLogicValues {sourceProductFilter: string[] // inboxFiltersLogiccurrentTeamId: number | null // teamLogicuser: UserType | null // userLogic+ claimSavingReportIds: string[]count: number | nullcountLoading: booleanhasMore: boolean@@ -349,6 +351,18 @@ export interface reportListLogicActions {assignee: SignalReportAssigneeApi | null | undefinedreportId: string}+ setReportClaimed: (+ report: SignalReport,+ claimed: boolean,+ surface: InboxReportActionSurface+ ) => {+ claimed: boolean+ report: SignalReport+ surface: InboxReportActionSurface+ }+ setReportClaimedFinished: (reportId: string) => {+ reportId: string+ }setSuggestedToMe: (reportIds: string[],isSuggested: boolean@@ -482,6 +496,12 @@ export const reportListLogic = kea<reportListLogicType>([reason,}),unassignMeFinished: (reportId: string) => ({ reportId }),+ setReportClaimed: (report: SignalReport, claimed: boolean, surface: InboxReportActionSurface) => ({+ report,+ claimed,+ surface,+ }),+ setReportClaimedFinished: (reportId: string) => ({ reportId }),setSuggestedToMe: (reportIds: string[], isSuggested: boolean) => ({ reportIds, isSuggested }),setReportAssignee: (reportId: string, assignee: SignalReport['assignee']) => ({ reportId, assignee }),removeReport: (reportId: string) => ({ reportId }),@@ -575,6 +595,13 @@ export const reportListLogic = kea<reportListLogicType>([unassignMeFinished: (state, { reportId }) => state.filter((id) => id !== reportId),},],+ claimSavingReportIds: [+ [] as string[],+ {+ setReportClaimed: (state, { report }) => (state.includes(report.id) ? state : [...state, report.id]),+ setReportClaimedFinished: (state, { reportId }) => state.filter((id) => id !== reportId),+ },+ ],// Kept apart from `reportsResponse` so a refresh that replaces the rows does not blank the// source line while the lookup runs again.reportSourceMeta: [@@ -1033,6 +1060,25 @@ export const reportListLogic = kea<reportListLogicType>([// The list that started the request can unmount while it runs, for example when triage closes.inboxBulkActionsLogic.findMounted()?.actions.unassignedMe([reportId])},+ setReportClaimed: async ({ report, claimed, surface }) => {+ captureInboxReportAction({ report, actionType: claimed ? 'claim' : 'unclaim', surface })+ const outcome = await requestReportClaim(String(values.currentTeamId), report, claimed)+ actions.setReportClaimedFinished(report.id)+ if (!outcome.ok) {+ lemonToast.error(outcome.message)+ // Reload so the row shows who holds the claim now. A request that failed without an answer+ // may still have saved the claim.+ actions.refresh()+ return+ }+ // Every mounted list updates the row, and the Claimed by you list gains or drops it.+ const bulkActions = inboxBulkActionsLogic.findMounted()+ if (bulkActions) {+ bulkActions.actions.reportClaimChanged(report.id, outcome.updated.assignee)+ } else {+ actions.setReportAssignee(report.id, outcome.updated.assignee)+ }+ },})),events(({ actions }) => ({diff --git a/products/signals/frontend/inbox/utils/reportClaim.ts b/products/signals/frontend/inbox/utils/reportClaim.tsindex f712a4d3a0c6..ada5466f891a 100644--- a/products/signals/frontend/inbox/utils/reportClaim.ts+++ b/products/signals/frontend/inbox/utils/reportClaim.ts@@ -1,4 +1,7 @@-import type { SignalReportClaimApi, _UserApi } from 'products/signals/frontend/generated/api.schemas'+import { ApiError } from 'lib/api-error'++import { signalsReportsClaim, signalsReportsRetrieve } from 'products/signals/frontend/generated/api'+import type { SignalReportApi, SignalReportClaimApi, _UserApi } from 'products/signals/frontend/generated/api.schemas'import { SignalReport, SignalReportStatus } from '../types'@@ -33,3 +36,54 @@ export function reportClaimRequest(report: Pick<SignalReport, 'assignee'>, claim// Naming the expected claim makes the server refuse the takeover when a person claimed meanwhile.return assignee.claim_id ? { takeover: true, takeover_claim_id: assignee.claim_id } : { takeover: true }}++type FreshClaimAttempt = { fresh: SignalReportApi | null; updated: SignalReportApi | null }++/** Claims again from the server's current record. The page can still show the list's copy, whose claim may be out of date. */+async function claimFromFreshReport(teamId: string, reportId: string): Promise<FreshClaimAttempt> {+ let fresh: SignalReportApi+ try {+ fresh = await signalsReportsRetrieve(teamId, reportId)+ } catch {+ return { fresh: null, updated: null }+ }+ if (!isReportClaimable({ status: fresh.status as SignalReportStatus, assignee: fresh.assignee })) {+ return { fresh, updated: null }+ }+ try {+ return { fresh, updated: await signalsReportsClaim(teamId, reportId, reportClaimRequest(fresh, true)) }+ } catch {+ return { fresh, updated: null }+ }+}++/** How a claim or release ended. On failure, `message` says why, and `conflict` is true when the report changed on the server. */+export type ReportClaimOutcome =+ | { ok: true; updated: SignalReportApi }+ | { ok: false; conflict: boolean; message: string }++/**+ * Claims or releases a report for the signed-in user. Every surface that claims goes through here, so they all+ * retry an out-of-date claim the same way and give the same reason when it fails.+ */+export async function requestReportClaim(+ teamId: string,+ report: Pick<SignalReport, 'id' | 'assignee'>,+ claimed: boolean+): Promise<ReportClaimOutcome> {+ try {+ return { ok: true, updated: await signalsReportsClaim(teamId, report.id, reportClaimRequest(report, claimed)) }+ } catch (error) {+ const conflict = error instanceof ApiError && error.status === 409+ const retry = conflict && claimed ? await claimFromFreshReport(teamId, report.id) : null+ if (retry?.updated) {+ return { ok: true, updated: retry.updated }+ }+ const message = !conflict+ ? "Couldn't update who's working on this report. Try again."+ : !retry || (retry.fresh && reportClaimant(retry.fresh))+ ? 'Someone else is already working on this report.'+ : 'This report changed. Check it and try again.'+ return { ok: false, conflict, message }+ }+}diff --git a/products/tasks/backend/facade/api.py b/products/tasks/backend/facade/api.pyindex d2d05aba5e55..d3ec7168812d 100644--- a/products/tasks/backend/facade/api.py+++ b/products/tasks/backend/facade/api.py@@ -1362,16 +1362,6 @@ def task_owned_by_user(task_id: str | UUID, team_id: int, user_id: int) -> bool:return Task.objects.filter(id=task_id, team_id=team_id, created_by_id=user_id).exists()-def filter_task_ids_created_by(task_ids: Iterable[str | UUID], team_id: int, user_id: int) -> frozenset[UUID]:- """The ids among `task_ids` of the team's tasks that the user started."""- ids = [str(t) for t in task_ids]- if not ids:- return frozenset()- return frozenset(- Task.objects.filter(id__in=ids, team_id=team_id, created_by_id=user_id).values_list("id", flat=True)- )--def get_task_creator_ids(task_ids: Iterable[str | UUID], team_ids: Iterable[int]) -> dict[str, int]:"""The id of the user who started each task, without loading the full task."""ids = [str(t) for t in task_ids]diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex d6022c127fd1..96b5121414f3 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -140825,7 +140825,7 @@ export namespace Schemas {*/already_addressed?: boolean;/**- * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started.+ * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included.*/assignee?: SignalsReportsListAssignee;/**@@ -141057,7 +141057,7 @@ export namespace Schemas {*/already_addressed?: boolean;/**- * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started.+ * 'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included.*/assignee?: SignalsReportsSectionCountsRetrieveAssignee;/**diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 043120fbdd97..dd9f4760659a 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -322,7 +322,7 @@ export const SignalsReportsListQueryParams = () => zod.object({.enum(['me', 'mine']).optional().describe(- "'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started."+ "'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included."),channel_id: zod.string()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.jsonindex cd00404eea98..7195ec6b8eb7 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/inbox-reports-list.json@@ -10,7 +10,7 @@"type": "boolean"},"assignee": {- "description": "'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user answers for: their own claims, claims by MCP agents acting for them, and claims by internal tasks they started.",+ "description": "'me' returns reports claimed by exactly the requesting actor: the user, the internal task, or the MCP agent. 'mine' returns every report the requesting user claimed: their own claims and claims by MCP agents acting for them. Internal task claims are not included.","enum": ["me", "mine"],"type": "string"},