: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(error-tracking): show the issue summary on the issue page (#122187)
James Gill98c8ba04dc78
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 591c507de034..a3623e3f5b57 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -10928,6 +10928,30 @@ snapshots:hash: v1.k794b7964.502a216bbc9268301578d6cebf9f46d13d3a802734f4fd7bd2707bdf8f0c9911.kpruIOz8uQ8wg26EB5QjeBVvFyLZVQV9FI4UqZ4Egsgscenes-app-errortracking--list-page-with-stacked-banners--light:hash: v1.k794b7964.7f8d251eac06e80fcd07c83ecda7fd43de79caf8f2c6bfe47fad10ab5ae094eb.OgfZFV7i9PlPfw0x6u6BbDnZ6fzWxpn6M3moLNzCBd8+ scenes-app-errortracking-issuesummary--failed--dark:+ hash: v1.k794b7964.e9866a862497cb43eba375b641dace5125f87cd6aa990f46169414e991308aff.LK4UTwfs9n5fwkCo_xsXWeVI4uWhOFFHsWJcuCTdtmQ+ scenes-app-errortracking-issuesummary--failed--light:+ hash: v1.k794b7964.9dadc3835482c9fc3cbf9c34d64d6d38d9b0b6dd7bcc29f6d6a761a5a02f2833.GGfML6hnbKuYv8EbpC9KDa1HKT9jwVfNZZBsvJlduX8+ scenes-app-errortracking-issuesummary--generating--dark:+ hash: v1.k794b7964.f22a879064f42e097ba9cd076b8ffe26aa4228067b58a36c404ba7273bf84178.FNRcL4Omn4dbv79qyq1XiFWrIb6gHUOQI8DnwJbd-0g+ scenes-app-errortracking-issuesummary--generating--light:+ hash: v1.k794b7964.55041183792769dff9d666c9db8ce9873be83b974b6383ff9fbf78b955cbfb72.6VJnh84lXDA9BHOfTvc-GoCGRtxczGc6gyoJgHeAOHM+ scenes-app-errortracking-issuesummary--ready--dark:+ hash: v1.k794b7964.fe6868c41309756ed8c4b534d93997abb07496dbf92209e6dc016eeb71b29e92.vn3eJyTK2iRSNJIaRCgQs2af1DkIDeykM41vy7lgzQ4+ scenes-app-errortracking-issuesummary--ready--light:+ hash: v1.k794b7964.f9b453712b1a95ff2bda0a627a3a30c473708a9555fa565172f5e2d72531684f.E0MgsSYePdCgBsYg0nlVnWKgHq7crSB8JSfJjBEyWjk+ scenes-app-errortracking-issuesummary--ready-wide--dark:+ hash: v1.k794b7964.82ad07ab5485a12668a8a0712e472df7757efc6a562fa091b72de3fe111b7ede.b4h-EVOIiCS0XANjVb2IdTPAbmv0HwfzZqnBgSBRUvo+ scenes-app-errortracking-issuesummary--ready-wide--light:+ hash: v1.k794b7964.1cda021cd680fb893b3eed8ff42a32143d61d4254155ab4615c49339b8000065.OAa8yZLwYrB2pIeBaeaiGLXyAdcNANY9Q3YmuotnWs4+ scenes-app-errortracking-issuesummary--ready-without-likely-cause--dark:+ hash: v1.k794b7964.8badd7b9a6bc79ce305f96b1b676bd3dbb707d0ea3bfcf4632a1d529170e060e.LUgab_ixIuJjiNYi-A6Z_ZuU0KnzwQGdnCDh7RIhHe0+ scenes-app-errortracking-issuesummary--ready-without-likely-cause--light:+ hash: v1.k794b7964.d10d73c16662e9d0818f4dbb1c2064ba9a41ad7d05a42570514f5efa02fae8f8.MywIqTJJIupufO8RbLXzWnVzc6V-6SG025VmrayQTYY+ scenes-app-errortracking-issuesummary--timed-out--dark:+ hash: v1.k794b7964.7b5074765f939f77ae1cc6a7c03cf1200e1b3026519d7dce36f894cfd6869554.RolH_LxxHVc2fRWfTGmaiX3ZSvkD_6QTzJ1-iCh3Dk8+ scenes-app-errortracking-issuesummary--timed-out--light:+ hash: v1.k794b7964.e615ea2fb7d24183d547eca386c0a670c8b047ec0d8a49af40b21331e46d5b81.ArhTQVVglfTIzFHDQImdl1fy0CL0S2MqxlKLWhh3dL0scenes-app-errortracking-linkedreports--fix-proposed--dark:hash: v1.k794b7964.1b50022f8fafb4684dacd255b966bd2969f79e84d5c7c7daeb68291772a1e36d.9uyjrwufsjMCFx9c7cjsoIyabB3A4ZBnPSVUouM0RZEscenes-app-errortracking-linkedreports--fix-proposed--light:diff --git a/products/error_tracking/backend/presentation/views/issues.py b/products/error_tracking/backend/presentation/views/issues.pyindex 762f76fc30e5..952baaba36e8 100644--- a/products/error_tracking/backend/presentation/views/issues.py+++ b/products/error_tracking/backend/presentation/views/issues.py@@ -27,6 +27,7 @@ from products.error_tracking.backend.facade import (api as facade_api,contracts,issues as issues_facade,+ summaries as summaries_facade,)from products.error_tracking.backend.presentation.pagination import paginate_via_facadefrom products.error_tracking.backend.presentation.views.external_references import (@@ -256,10 +257,72 @@ class ErrorTrackingIssueSplitResponseSerializer(serializers.Serializer):)+class IssueSummaryStatus(models.TextChoices):+ READY = "ready"+ GENERATING = "generating"+ UNAVAILABLE = "unavailable"+++class ErrorTrackingStoredIssueSummarySerializer(serializers.Serializer):+ what_happened = serializers.CharField(help_text="What the exception is and where it happens.")+ likely_cause = serializers.CharField(+ help_text="The model's hypothesis about the cause. Not a confirmed finding. Can be empty."+ )+ who_is_affected = serializers.CharField(help_text="Which users, sessions or environments see the issue.")+ suggested_next_step = serializers.CharField(help_text="One concrete step to investigate or fix the issue.")+ category = serializers.ChoiceField(+ choices=contracts.IssueSummaryCategory.choices,+ allow_null=True,+ help_text="Broad source of the issue, or null when the category model did not answer.",+ )+ model = serializers.CharField(help_text="Model that wrote the summary.")+ generated_at = serializers.DateTimeField(help_text="When the summary was written.")+ checked_at = serializers.DateTimeField(+ help_text="When generation last wrote the summary or confirmed it unchanged. The regenerate interval runs from it."+ )+++class ErrorTrackingIssueSummaryResponseSerializer(serializers.Serializer):+ status = serializers.ChoiceField(+ choices=IssueSummaryStatus.choices,+ help_text=(+ "ready: `summary` holds the stored summary. "+ "generating: a summary is being written in the background, so poll again. "+ "`summary` holds the previous one, if any. "+ "unavailable: no summary exists and none will be written, for example because the feature is off."+ ),+ )+ summary = ErrorTrackingStoredIssueSummarySerializer(+ allow_null=True, help_text="The stored summary, or null when none exists yet."+ )+++def issue_summary_response(team_id: int, issue_id: UUID, *, user: User, regenerate: bool) -> dict[str, object]:+ """Read the stored summary and ask the facade to start generation, which it skips while the summary is fresh.++ `regenerate` only changes the status of a started refresh of a stored summary: `generating` instead of `ready`.+ Never waits.+ """+ summary = summaries_facade.get_issue_summary(team_id, issue_id, user=user)+ # Starting is a no-op while a stored summary is younger than the regenerate interval,+ # so a read of a stale summary also refreshes it in the background.+ started = summaries_facade.start_issue_summary_generation(team_id, issue_id, user=user)+ if started and (regenerate or summary is None):+ summary_status = IssueSummaryStatus.GENERATING+ elif summary is not None:+ summary_status = IssueSummaryStatus.READY+ else:+ summary_status = IssueSummaryStatus.UNAVAILABLE+ return {+ "status": summary_status,+ "summary": ErrorTrackingStoredIssueSummarySerializer(summary).data if summary is not None else None,+ }++class ErrorTrackingIssueViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, viewsets.GenericViewSet):scope_object = "error_tracking"# These override the base defaults, so keep the standard DRF actions too.- scope_object_read_actions = ["list", "retrieve", "values", "exists"]+ scope_object_read_actions = ["list", "retrieve", "values", "exists", "summary"]scope_object_write_actions = ["update","partial_update",@@ -270,6 +333,7 @@ class ErrorTrackingIssueViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, view"assign","cohort","bulk",+ "summary_regenerate",]serializer_class = ErrorTrackingIssueReadSerializer@@ -529,6 +593,30 @@ class ErrorTrackingIssueViewSet(TeamAndOrgViewSetMixin, ForbidDestroyModel, view)return Response({"success": True})+ @extend_schema(responses={200: ErrorTrackingIssueSummaryResponseSerializer})+ @action(methods=["GET"], detail=True)+ def summary(self, request: request.Request, *args: object, pk: object = None, **kwargs: object) -> Response:+ return self._summary_response(pk, regenerate=False)++ @extend_schema(request=None, responses={200: ErrorTrackingIssueSummaryResponseSerializer})+ @action(methods=["POST"], detail=True, url_path="summary/regenerate")+ def summary_regenerate(+ self, request: request.Request, *args: object, pk: object = None, **kwargs: object+ ) -> Response:+ return self._summary_response(pk, regenerate=True)++ def _summary_response(self, pk: object, *, regenerate: bool) -> Response:+ try:+ issue_id = UUID(str(pk))+ except ValueError:+ raise NotFound("Issue not found")+ # Without this, another team's issue id would queue a generation task under this team.+ if not facade_api.issue_exists_by_id(self.team_id, issue_id):+ raise NotFound("Issue not found")+ return Response(+ issue_summary_response(self.team_id, issue_id, user=cast(User, self.request.user), regenerate=regenerate)+ )+@extend_schema(operation_id="error_tracking_issues_all_activity_retrieve")@action(methods=["GET"], url_path="activity", detail=False, required_scopes=["activity_log:read"])def all_activity(self, request: request.Request, **kwargs: object) -> Response:diff --git a/products/error_tracking/backend/tests/api/test_error_tracking_api.py b/products/error_tracking/backend/tests/api/test_error_tracking_api.pyindex 9c41ef1bef1c..6cc84c7315af 100644--- a/products/error_tracking/backend/tests/api/test_error_tracking_api.py+++ b/products/error_tracking/backend/tests/api/test_error_tracking_api.py@@ -32,6 +32,10 @@ from posthog.settings import ()from products.access_control.backend.facade.testing import add_role_member, create_role+from products.error_tracking.backend.facade import (+ contracts,+ summaries as summaries_facade,+)from products.error_tracking.backend.models import (ErrorTrackingAlert,ErrorTrackingAlertThread,@@ -608,6 +612,83 @@ class TestErrorTracking(APIBaseTest):assert response.status_code == 404+ @parameterized.expand(+ [+ ("read_none_started", "get", "", False, True, "generating"),+ ("read_none_blocked", "get", "", False, False, "unavailable"),+ ("read_stale_refreshes", "get", "", True, True, "ready"),+ ("read_fresh", "get", "", True, False, "ready"),+ ("regenerate_started", "post", "/regenerate", True, True, "generating"),+ ("regenerate_fresh", "post", "/regenerate", True, False, "ready"),+ ("regenerate_blocked", "post", "/regenerate", False, False, "unavailable"),+ ]+ )+ def test_issue_summary_status(+ self, _name: str, method: str, suffix: str, stored: bool, started: bool, expected_status: str+ ) -> None:+ issue = self.create_issue()+ summary = contracts.ErrorTrackingIssueSummary(+ issue_id=issue.id,+ what_happened="A TypeError in checkout.",+ likely_cause="",+ who_is_affected="Signed-in users on Safari.",+ suggested_next_step="Guard the null cart.",+ category=contracts.IssueSummaryCategory.OWN_CODE,+ model="gpt-4.1-mini",+ generated_at=datetime(2026, 10, 20, 12, 0, tzinfo=UTC),+ checked_at=datetime(2026, 10, 21, 12, 0, tzinfo=UTC),+ )+ with (+ patch.object(summaries_facade, "get_issue_summary", return_value=summary if stored else None) as get,+ patch.object(summaries_facade, "start_issue_summary_generation", return_value=started) as start,+ ):+ response = getattr(self.client, method)(+ f"/api/projects/{self.team.id}/error_tracking/issues/{issue.id}/summary{suffix}"+ )++ assert response.status_code == 200+ get.assert_called_once_with(self.team.id, issue.id, user=self.user)+ start.assert_called_once_with(self.team.id, issue.id, user=self.user)+ expected_summary = (+ {+ "what_happened": "A TypeError in checkout.",+ "likely_cause": "",+ "who_is_affected": "Signed-in users on Safari.",+ "suggested_next_step": "Guard the null cart.",+ "category": "own_code",+ "model": "gpt-4.1-mini",+ "generated_at": "2026-10-20T12:00:00Z",+ "checked_at": "2026-10-21T12:00:00Z",+ }+ if stored+ else None+ )+ assert response.json() == {"status": expected_status, "summary": expected_summary}++ @parameterized.expand(+ [+ ("other_team_get", "get", "", True),+ ("other_team_post", "post", "/regenerate", True),+ ("malformed_id_get", "get", "", False),+ ("malformed_id_post", "post", "/regenerate", False),+ ]+ )+ def test_issue_summary_is_scoped_to_team(self, _name: str, method: str, suffix: str, other_team: bool) -> None:+ if other_team:+ issue_id = str(+ ErrorTrackingIssue.objects.create(team=Team.objects.create(organization=self.organization)).id+ )+ else:+ issue_id = "not-a-uuid"++ with patch.object(summaries_facade, "start_issue_summary_generation") as start:+ response = getattr(self.client, method)(+ f"/api/projects/{self.team.id}/error_tracking/issues/{issue_id}/summary{suffix}"+ )++ assert response.status_code == 404+ start.assert_not_called()+@parameterized.expand([("active", "resolved", "$error_tracking_issue_resolved", "Resolved", "Active"),diff --git a/products/error_tracking/frontend/ErrorTracking.stories.tsx b/products/error_tracking/frontend/ErrorTracking.stories.tsxindex 8a38656d6684..a06356c7ca02 100644--- a/products/error_tracking/frontend/ErrorTracking.stories.tsx+++ b/products/error_tracking/frontend/ErrorTracking.stories.tsx@@ -491,6 +491,10 @@ const meta: Meta = {],'/api/environments/:team_id/error_tracking/issues/exists/': [200, { exists: true }],'/api/environments/:team_id/error_tracking/issues/:id/': [200, STORY_ISSUE],+ '/api/projects/:team_id/error_tracking/issues/:id/summary/': [+ 200,+ { status: 'unavailable', summary: null },+ ],'/api/environments/:team_id/error_tracking/fingerprints': [200,{diff --git a/products/error_tracking/frontend/generated/api.schemas.ts b/products/error_tracking/frontend/generated/api.schemas.tsindex 52f1d0296c00..039fc2461f55 100644--- a/products/error_tracking/frontend/generated/api.schemas.ts+++ b/products/error_tracking/frontend/generated/api.schemas.ts@@ -1069,6 +1069,75 @@ export interface ErrorTrackingIssueSplitResponseApi {new_issue_ids: string[]}+/**+ * * `ready` - Ready+ * * `generating` - Generating+ * * `unavailable` - Unavailable+ */+export type IssueSummaryStatusEnumApi = (typeof IssueSummaryStatusEnumApi)[keyof typeof IssueSummaryStatusEnumApi]++export const IssueSummaryStatusEnumApi = {+ Ready: 'ready',+ Generating: 'generating',+ Unavailable: 'unavailable',+} as const++/**+ * * `own_code` - Own Code+ * * `third_party` - Third Party+ * * `network` - Network+ * * `bots` - Bots+ * * `expected` - Expected+ * * `unclear` - Unclear+ */+export type IssueSummaryCategoryEnumApi = (typeof IssueSummaryCategoryEnumApi)[keyof typeof IssueSummaryCategoryEnumApi]++export const IssueSummaryCategoryEnumApi = {+ OwnCode: 'own_code',+ ThirdParty: 'third_party',+ Network: 'network',+ Bots: 'bots',+ Expected: 'expected',+ Unclear: 'unclear',+} as const++export interface ErrorTrackingStoredIssueSummaryApi {+ /** What the exception is and where it happens. */+ what_happened: string+ /** The model's hypothesis about the cause. Not a confirmed finding. Can be empty. */+ likely_cause: string+ /** Which users, sessions or environments see the issue. */+ who_is_affected: string+ /** One concrete step to investigate or fix the issue. */+ suggested_next_step: string+ /** Broad source of the issue, or null when the category model did not answer.+ *+ * * `own_code` - Own Code+ * * `third_party` - Third Party+ * * `network` - Network+ * * `bots` - Bots+ * * `expected` - Expected+ * * `unclear` - Unclear */+ category: IssueSummaryCategoryEnumApi | null+ /** Model that wrote the summary. */+ model: string+ /** When the summary was written. */+ generated_at: string+ /** When generation last wrote the summary or confirmed it unchanged. The regenerate interval runs from it. */+ checked_at: string+}++export interface ErrorTrackingIssueSummaryResponseApi {+ /** ready: `summary` holds the stored summary. generating: a summary is being written in the background, so poll again. `summary` holds the previous one, if any. unavailable: no summary exists and none will be written, for example because the feature is off.+ *+ * * `ready` - Ready+ * * `generating` - Generating+ * * `unavailable` - Unavailable */+ status: IssueSummaryStatusEnumApi+ /** The stored summary, or null when none exists yet. */+ summary: ErrorTrackingStoredIssueSummaryApi | null+}+/*** * `set_status` - set_status* * `assign` - assign@@ -1293,25 +1362,6 @@ export interface ErrorTrackingIssueBreakdownApi {top_values: ErrorTrackingBreakdownTopValuesApi}-/**- * * `own_code` - Own Code- * * `third_party` - Third Party- * * `network` - Network- * * `bots` - Bots- * * `expected` - Expected- * * `unclear` - Unclear- */-export type IssueSummaryCategoryEnumApi = (typeof IssueSummaryCategoryEnumApi)[keyof typeof IssueSummaryCategoryEnumApi]--export const IssueSummaryCategoryEnumApi = {- OwnCode: 'own_code',- ThirdParty: 'third_party',- Network: 'network',- Bots: 'bots',- Expected: 'expected',- Unclear: 'unclear',-} as const-export interface ErrorTrackingIssueSummaryApi {/** What the error is and where it happens, in plain language. */what_happened: string@@ -1334,19 +1384,6 @@ export interface ErrorTrackingIssueSummaryApi {generated_at: string}-/**- * * `ready` - Ready- * * `generating` - Generating- * * `unavailable` - Unavailable- */-export type IssueSummaryStatusEnumApi = (typeof IssueSummaryStatusEnumApi)[keyof typeof IssueSummaryStatusEnumApi]--export const IssueSummaryStatusEnumApi = {- Ready: 'ready',- Generating: 'generating',- Unavailable: 'unavailable',-} as const-export interface ErrorTrackingIssueDetailApi {/** Error tracking issue ID. */id: stringdiff --git a/products/error_tracking/frontend/generated/api.ts b/products/error_tracking/frontend/generated/api.tsindex 3f70f0d08b6b..dabdfe1b0bf1 100644--- a/products/error_tracking/frontend/generated/api.ts+++ b/products/error_tracking/frontend/generated/api.ts@@ -50,6 +50,7 @@ import type {ErrorTrackingIssueSplitRequestApi,ErrorTrackingIssueSplitResponseApi,ErrorTrackingIssueSuccessResponseApi,+ ErrorTrackingIssueSummaryResponseApi,ErrorTrackingIssueValuesResponseApi,ErrorTrackingIssueWriteApi,ErrorTrackingIssuesListParams,@@ -1133,6 +1134,39 @@ export const errorTrackingIssuesSplitCreate = async (})}+export const getErrorTrackingIssuesSummaryRetrieveUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/error_tracking/issues/${id}/summary/`+}++export const errorTrackingIssuesSummaryRetrieve = async (+ projectId: string,+ id: string,+ options?: RequestInit+): Promise<ErrorTrackingIssueSummaryResponseApi> => {+ return apiMutator<ErrorTrackingIssueSummaryResponseApi>(getErrorTrackingIssuesSummaryRetrieveUrl(projectId, id), {+ ...options,+ method: 'GET',+ })+}++export const getErrorTrackingIssuesSummaryRegenerateCreateUrl = (projectId: string, id: string) => {+ return `/api/projects/${projectId}/error_tracking/issues/${id}/summary/regenerate/`+}++export const errorTrackingIssuesSummaryRegenerateCreate = async (+ projectId: string,+ id: string,+ options?: RequestInit+): Promise<ErrorTrackingIssueSummaryResponseApi> => {+ return apiMutator<ErrorTrackingIssueSummaryResponseApi>(+ getErrorTrackingIssuesSummaryRegenerateCreateUrl(projectId, id),+ {+ ...options,+ method: 'POST',+ }+ )+}+export const getErrorTrackingIssuesAllActivityRetrieveUrl = (projectId: string) => {return `/api/projects/${projectId}/error_tracking/issues/activity/`}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsxindex ef0952f431fa..2afe7749f9d9 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx@@ -58,6 +58,7 @@ import { ErrorTrackingIssueSceneLogicProps, errorTrackingIssueSceneLogic } fromimport { IssueEmailMenu } from './IssueEmailMenu'import { IssueEmailMenuItems } from './IssueEmailMenuItems'import { IssueEventsPanel } from './IssueEventsPanel'+import { IssueSummary } from './IssueSummary'import { LinkedReports } from './LinkedReports'import { ErrorTrackingIssueScenePanel } from './ScenePanel'import { IssueAssigneeSelect } from './ScenePanel/IssueAssigneeSelect'@@ -350,6 +351,7 @@ const RightHandColumn = ({</div>)}<PostHogSDKIssueBanner event={detailEvent} />+ <IssueSummary /><LinkedReports /><div className="flex-1 min-h-0 flex flex-col"><ExceptionCarddiff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.stories.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.stories.tsxnew file mode 100644index 000000000000..800d3a136d60--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.stories.tsx@@ -0,0 +1,61 @@+import type { Meta, StoryObj } from '@storybook/react'++import type { ErrorTrackingStoredIssueSummaryApi } from '../../generated/api.schemas'+import { IssueSummarySection, IssueSummarySectionProps } from './IssueSummary'++const meta: Meta<typeof IssueSummarySection> = {+ title: 'Scenes-App/ErrorTracking/IssueSummary',+ component: IssueSummarySection,+ parameters: { layout: 'padded', viewMode: 'story', mockDate: '2026-10-22' },+}+export default meta++type Story = StoryObj<typeof IssueSummarySection>++const SUMMARY: ErrorTrackingStoredIssueSummaryApi = {+ what_happened: 'A TypeError is thrown in the checkout page when the cart total is read before the cart has loaded.',+ likely_cause: 'The cart request can finish after the first render when the session token is refreshed.',+ who_is_affected: 'About 40 signed-in users a day, mostly on Safari, in the last 7 days.',+ suggested_next_step: 'Check that the checkout page waits for the cart request before it reads the total.',+ category: 'own_code',+ model: 'gpt-4.1-mini',+ generated_at: '2026-10-20T09:00:00Z',+ checked_at: '2026-10-20T09:00:00Z',+}++const noop = (): void => {}++function render(props: Partial<IssueSummarySectionProps>, width: 'narrow' | 'wide' = 'narrow'): JSX.Element {+ return (+ <div className={width === 'wide' ? 'w-[720px] border' : 'w-[520px] border'}>+ <IssueSummarySection+ view="ready"+ summary={SUMMARY}+ regenerating={false}+ feedback={null}+ onRegenerate={noop}+ onRetry={noop}+ onFeedback={noop}+ {...props}+ />+ </div>+ )+}++export const Ready: Story = { render: () => render({}) }++export const ReadyWide: Story = { render: () => render({}, 'wide') }++export const ReadyWithoutLikelyCause: Story = {+ render: () => render({ summary: { ...SUMMARY, likely_cause: '' }, feedback: 'good' }),+}++export const Generating: Story = {+ render: () => render({ view: 'generating', summary: null }),+ // The skeleton is the state under test, so the runner must not wait for it to go away.+ parameters: { testOptions: { waitForLoadersToDisappear: false } },+}++export const TimedOut: Story = { render: () => render({ view: 'timed_out', summary: null }) }++export const Failed: Story = { render: () => render({ view: 'failed', summary: null }) }diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.tsxnew file mode 100644index 000000000000..d37708e2f328--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueSummary.tsx@@ -0,0 +1,189 @@+import clsx from 'clsx'+import { useActions, useValues } from 'kea'++import {+ IconArrowRight,+ IconBug,+ IconLogomark,+ IconPeople,+ IconRefresh,+ IconSearch,+ IconThumbsDown,+ IconThumbsUp,+} from '@posthog/icons'+import { LemonButton, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'++import { TZLabel } from 'lib/components/TZLabel'+import { dayjs } from 'lib/dayjs'++import type { ErrorTrackingStoredIssueSummaryApi } from '../../generated/api.schemas'+import { errorTrackingIssueSceneLogic } from './errorTrackingIssueSceneLogic'+import { IssueSummaryFeedback, IssueSummaryView, issueSummaryLogic } from './issueSummaryLogic'++export interface IssueSummarySectionProps {+ view: IssueSummaryView+ summary: ErrorTrackingStoredIssueSummaryApi | null+ regenerating: boolean+ feedback: IssueSummaryFeedback | null+ onRegenerate: () => void+ onRetry: () => void+ onFeedback: (feedback: IssueSummaryFeedback) => void+}++function SummaryField({+ icon,+ label,+ tag,+ emphasis = false,+ children,+}: {+ icon: JSX.Element+ label: string+ tag?: JSX.Element+ emphasis?: boolean+ children: string+}): JSX.Element {+ return (+ <div className="grid gap-x-3 gap-y-0.5 px-2 py-1.5 border-b @xl:grid-cols-[11rem_1fr]">+ <dt className="flex flex-wrap items-center gap-1 text-xs font-semibold text-secondary @xl:items-start @xl:pt-0.5">+ <span className="flex shrink-0 text-sm">{icon}</span>+ <span>{label}</span>+ {tag}+ </dt>+ <dd className={clsx('m-0 text-sm leading-snug', emphasis && 'font-semibold')}>{children}</dd>+ </div>+ )+}++export function IssueSummarySection({+ view,+ summary,+ regenerating,+ feedback,+ onRegenerate,+ onRetry,+ onFeedback,+}: IssueSummarySectionProps): JSX.Element | null {+ if (view === 'hidden') {+ return null+ }+ // Generation runs at most once a day per issue, so a regenerate inside that window would do nothing.+ const regenerateDisabledReason =+ summary && dayjs().diff(dayjs(summary.checked_at), 'hour') < 24+ ? 'A summary can be regenerated once a day'+ : undefined+ return (+ // The section never takes more than 40% of the pane, so the exception card keeps its room.+ <div className="min-h-0 max-h-[40%] flex flex-col bg-surface-primary" data-attr="error-tracking-issue-summary">+ <div className="flex justify-between h-[2rem] items-center w-full px-2 border-b shrink-0 gap-2">+ <div className="flex items-center gap-1 text-lg h-full min-w-0">+ <IconLogomark />+ <span className="text-sm text-ai truncate">Summary</span>+ </div>+ {view === 'ready' && (+ <div className="flex items-center gap-0.5 shrink-0">+ <LemonButton+ size="xsmall"+ icon={<IconThumbsUp />}+ active={feedback === 'good'}+ disabledReason={feedback ? 'Thanks for the feedback' : undefined}+ tooltip="This summary is helpful"+ onClick={() => onFeedback('good')}+ data-attr="error-tracking-issue-summary-feedback-good"+ />+ <LemonButton+ size="xsmall"+ icon={<IconThumbsDown />}+ active={feedback === 'bad'}+ disabledReason={feedback ? 'Thanks for the feedback' : undefined}+ tooltip="This summary is wrong or not helpful"+ onClick={() => onFeedback('bad')}+ data-attr="error-tracking-issue-summary-feedback-bad"+ />+ <LemonButton+ size="xsmall"+ icon={<IconRefresh />}+ loading={regenerating}+ disabledReason={regenerating ? 'Regenerating the summary' : regenerateDisabledReason}+ tooltip="Regenerate the summary"+ onClick={onRegenerate}+ data-attr="error-tracking-issue-summary-regenerate"+ />+ </div>+ )}+ </div>+ {view === 'ready' && summary ? (+ <div className="@container min-h-0 overflow-y-auto">+ <dl className="m-0">+ <SummaryField icon={<IconBug />} label="What happened" emphasis>+ {summary.what_happened}+ </SummaryField>+ {summary.likely_cause ? (+ <SummaryField+ icon={<IconSearch />}+ label="Likely cause"+ tag={+ <LemonTag size="small" type="muted">+ Hypothesis+ </LemonTag>+ }+ >+ {summary.likely_cause}+ </SummaryField>+ ) : null}+ <SummaryField icon={<IconPeople />} label="Who is affected">+ {summary.who_is_affected}+ </SummaryField>+ <SummaryField icon={<IconArrowRight />} label="Next step">+ {summary.suggested_next_step}+ </SummaryField>+ </dl>+ <div className="px-2 py-1 text-xs text-muted">+ Generated <TZLabel time={summary.generated_at} />+ </div>+ </div>+ ) : view === 'generating' ? (+ <div className="px-2 py-2 flex flex-col gap-2" aria-busy="true">+ <span className="text-sm text-secondary">Summarizing this issue…</span>+ <LemonSkeleton className="h-3 w-full" />+ <LemonSkeleton className="h-3 w-4/5" />+ <LemonSkeleton className="h-3 w-3/5" />+ </div>+ ) : (+ <div className="flex items-center justify-between gap-2 px-2 py-1.5">+ <span className="text-sm text-secondary min-w-0">+ {view === 'timed_out'+ ? 'The summary is taking longer than usual.'+ : "Couldn't load the summary."}+ </span>+ <LemonButton+ size="xsmall"+ type="secondary"+ onClick={onRetry}+ data-attr="error-tracking-issue-summary-retry"+ >+ Try again+ </LemonButton>+ </div>+ )}+ </div>+ )+}++export function IssueSummary(): JSX.Element | null {+ const { issueId } = useValues(errorTrackingIssueSceneLogic)+ const logic = issueSummaryLogic({ issueId })+ const { view, summary, regenerating, feedback } = useValues(logic)+ const { regenerateSummary, loadSummary, sendFeedback } = useActions(logic)+ return (+ <IssueSummarySection+ view={view}+ summary={summary}+ regenerating={regenerating}+ feedback={feedback}+ onRegenerate={regenerateSummary}+ onRetry={loadSummary}+ onFeedback={sendFeedback}+ />+ )+}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.test.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.test.tsnew file mode 100644index 000000000000..1c146e141bb0--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.test.ts@@ -0,0 +1,125 @@+import { expectLogic } from 'kea-test-utils'++import { lemonToast } from '@posthog/lemon-ui'++import { initKeaTests } from '~/test/init'++import { errorTrackingIssuesSummaryRegenerateCreate, errorTrackingIssuesSummaryRetrieve } from '../../generated/api'+import type {+ ErrorTrackingStoredIssueSummaryApi,+ ErrorTrackingIssueSummaryResponseApi,+} from '../../generated/api.schemas'+import { ISSUE_SUMMARY_POLL_INTERVAL_MS, ISSUE_SUMMARY_POLL_TIMEOUT_MS, issueSummaryLogic } from './issueSummaryLogic'++jest.mock('../../generated/api')++const ISSUE_ID = '01890a1b-2c3d-4e4f-8a9b-0c1d2e3f4a5b'+const SUMMARY: ErrorTrackingStoredIssueSummaryApi = {+ what_happened: 'A TypeError in checkout.',+ likely_cause: 'The cart is null after a session expires.',+ who_is_affected: 'Signed-in users on Safari.',+ suggested_next_step: 'Guard the null cart.',+ category: 'own_code',+ model: 'gpt-4.1-mini',+ generated_at: '2026-10-20T12:00:00Z',+ checked_at: '2026-10-20T12:00:00Z',+}+const GENERATING: ErrorTrackingIssueSummaryResponseApi = { status: 'generating', summary: null }+const READY: ErrorTrackingIssueSummaryResponseApi = { status: 'ready', summary: SUMMARY }+const UNAVAILABLE: ErrorTrackingIssueSummaryResponseApi = { status: 'unavailable', summary: null }+const NEW_SUMMARY: ErrorTrackingStoredIssueSummaryApi = { ...SUMMARY, generated_at: '2026-10-22T12:00:00Z' }++describe('issueSummaryLogic', () => {+ const retrieve = jest.mocked(errorTrackingIssuesSummaryRetrieve)+ const regenerate = jest.mocked(errorTrackingIssuesSummaryRegenerateCreate)+ let logic: ReturnType<typeof issueSummaryLogic.build>++ beforeEach(() => {+ jest.useFakeTimers()+ initKeaTests()+ })++ afterEach(() => {+ logic?.unmount()+ jest.useRealTimers()+ jest.resetAllMocks()+ })++ async function advance(ms: number): Promise<void> {+ await jest.advanceTimersByTimeAsync(ms)+ }++ it.each([+ ['generation outlasts the deadline', GENERATING, 0, 'generating', 'timed_out'],+ ['a poll answers after the deadline', GENERATING, 1500, 'generating', 'timed_out'],+ ['no summary will be written', UNAVAILABLE, 0, 'hidden', 'hidden'],+ ])('stops polling when %s', async (_name, response, latencyMs, viewOnLoad, viewAtDeadline) => {+ retrieve.mockImplementation(() => new Promise((resolve) => setTimeout(() => resolve(response), latencyMs)))+ logic = issueSummaryLogic({ issueId: ISSUE_ID })+ logic.mount()+ await advance(latencyMs)+ await expectLogic(logic).toDispatchActions(['loadSummarySuccess']).toMatchValues({ view: viewOnLoad })++ await advance(ISSUE_SUMMARY_POLL_TIMEOUT_MS + latencyMs)+ const callsAtDeadline = retrieve.mock.calls.length+ expect(logic.values.view).toBe(viewAtDeadline)++ await advance(ISSUE_SUMMARY_POLL_TIMEOUT_MS)+ expect(retrieve.mock.calls.length).toBe(callsAtDeadline)+ })++ it('stops polling once the summary is ready', async () => {+ retrieve.mockResolvedValueOnce(GENERATING).mockResolvedValueOnce(GENERATING).mockResolvedValue(READY)+ logic = issueSummaryLogic({ issueId: ISSUE_ID })+ logic.mount()++ await advance(ISSUE_SUMMARY_POLL_INTERVAL_MS * 2)+ expect(logic.values.view).toBe('ready')+ expect(logic.values.summary).toEqual(SUMMARY)++ await advance(ISSUE_SUMMARY_POLL_TIMEOUT_MS)+ expect(retrieve).toHaveBeenCalledTimes(3)+ expect(logic.values.view).toBe('ready')+ })++ it('stops polling on a failed read and recovers on retry', async () => {+ retrieve.mockResolvedValueOnce(GENERATING).mockRejectedValueOnce(new Error('500')).mockResolvedValue(READY)+ jest.spyOn(console, 'error').mockImplementation(() => {})+ logic = issueSummaryLogic({ issueId: ISSUE_ID })+ logic.mount()++ await advance(ISSUE_SUMMARY_POLL_INTERVAL_MS)+ expect(logic.values.view).toBe('failed')+ await advance(ISSUE_SUMMARY_POLL_TIMEOUT_MS)+ expect(retrieve).toHaveBeenCalledTimes(2)++ logic.actions.loadSummary()+ await advance(0)+ expect(logic.values.view).toBe('ready')+ })++ it.each([+ ['shows the new summary once it lands', [READY, { status: 'ready', summary: NEW_SUMMARY }], NEW_SUMMARY, false],+ ['tells the user when no new summary lands', [READY], SUMMARY, true],+ ] as const)('regenerate %s', async (_name, reads, expectedSummary, toasts) => {+ const info = jest.spyOn(lemonToast, 'info').mockImplementation(() => '')+ retrieve.mockResolvedValueOnce(READY)+ for (const read of reads.slice(0, -1)) {+ retrieve.mockResolvedValueOnce(read)+ }+ retrieve.mockResolvedValue(reads[reads.length - 1])+ regenerate.mockResolvedValue({ status: 'generating', summary: SUMMARY })+ logic = issueSummaryLogic({ issueId: ISSUE_ID })+ logic.mount()+ await expectLogic(logic).toDispatchActions(['loadSummarySuccess'])++ logic.actions.regenerateSummary()+ await advance(ISSUE_SUMMARY_POLL_INTERVAL_MS)+ expect(logic.values.regenerating).toBe(true)++ await advance(ISSUE_SUMMARY_POLL_TIMEOUT_MS)+ expect(logic.values.regenerating).toBe(false)+ expect(logic.values.summary).toEqual(expectedSummary)+ expect(info).toHaveBeenCalledTimes(toasts ? 1 : 0)+ })+})diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.tsnew file mode 100644index 000000000000..af4f4a8fec2b--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/issueSummaryLogic.ts@@ -0,0 +1,327 @@+import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import posthog from 'posthog-js'++import { lemonToast } from '@posthog/lemon-ui'++import { getCurrentTeamId } from 'lib/utils/getAppContext'++import { errorTrackingIssuesSummaryRegenerateCreate, errorTrackingIssuesSummaryRetrieve } from '../../generated/api'+import type {+ ErrorTrackingStoredIssueSummaryApi,+ ErrorTrackingIssueSummaryResponseApi,+} from '../../generated/api.schemas'+import { IssueSummaryStatusEnumApi } from '../../generated/api.schemas'++export interface IssueSummaryLogicProps {+ issueId: string+}++export type IssueSummaryFeedback = 'good' | 'bad'++export type IssueSummaryView = 'hidden' | 'generating' | 'timed_out' | 'failed' | 'ready'++export const ISSUE_SUMMARY_POLL_INTERVAL_MS = 2000+export const ISSUE_SUMMARY_POLL_TIMEOUT_MS = 20000++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueSummaryLogicValues {+ awaitingSummary: boolean+ feedback: IssueSummaryFeedback | null+ loadFailed: boolean+ polling: boolean+ regenerating: boolean+ replacedGeneratedAt: string | null+ summary: ErrorTrackingStoredIssueSummaryApi | null+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null+ summaryResponseLoading: boolean+ timedOut: boolean+ view: IssueSummaryView+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueSummaryLogicActions {+ loadSummary: () => any+ loadSummaryFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadSummarySuccess: (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ payload?: any+ ) => {+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null+ payload?: any+ }+ markLoadFailed: () => {+ value: true+ }+ pollTimedOut: () => {+ value: true+ }+ regenerateSummary: () => any+ regenerateSummaryFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ regenerateSummarySuccess: (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ payload?: any+ ) => {+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null+ payload?: any+ }+ sendFeedback: (feedback: IssueSummaryFeedback) => {+ feedback: IssueSummaryFeedback+ }+ startPolling: () => {+ value: true+ }+ stopPolling: () => {+ value: true+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueSummaryLogicMeta {+ key: string+ __keaTypeGenInternalSelectorTypes: {+ summary: (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null+ ) => ErrorTrackingStoredIssueSummaryApi | null+ awaitingSummary: (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ replacedGeneratedAt: string | null+ ) => boolean+ view: (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ summary: ErrorTrackingStoredIssueSummaryApi | null,+ loadFailed: boolean,+ timedOut: boolean+ ) => IssueSummaryView+ }+}++export type issueSummaryLogicType = MakeLogicType<+ issueSummaryLogicValues,+ issueSummaryLogicActions,+ IssueSummaryLogicProps,+ issueSummaryLogicMeta+>++export const issueSummaryLogic = kea<issueSummaryLogicType>([+ props({} as IssueSummaryLogicProps),+ key((props) => props.issueId),+ path((key) => ['products', 'error_tracking', 'scenes', 'ErrorTrackingIssueScene', 'issueSummaryLogic', key]),+ actions({+ markLoadFailed: true,+ startPolling: true,+ stopPolling: true,+ pollTimedOut: true,+ sendFeedback: (feedback: IssueSummaryFeedback) => ({ feedback }),+ }),+ loaders(({ props, actions, values }) => ({+ summaryResponse: [+ null as ErrorTrackingIssueSummaryResponseApi | null,+ {+ loadSummary: async (): Promise<ErrorTrackingIssueSummaryResponseApi | null> => {+ try {+ return await errorTrackingIssuesSummaryRetrieve(getCurrentTeamId().toString(), props.issueId)+ } catch (error) {+ // The section shows its own retry line, so a failed read must not also raise the loader toast.+ console.error('Failed to load the issue summary:', error)+ actions.markLoadFailed()+ return values.summaryResponse+ }+ },+ regenerateSummary: async (): Promise<ErrorTrackingIssueSummaryResponseApi | null> => {+ return await errorTrackingIssuesSummaryRegenerateCreate(+ getCurrentTeamId().toString(),+ props.issueId+ )+ },+ },+ ],+ })),+ reducers({+ loadFailed: [+ false,+ {+ // The loader dispatches `markLoadFailed` before its own success action, so reset on the request.+ loadSummary: () => false,+ markLoadFailed: () => true,+ },+ ],+ timedOut: [+ false,+ {+ pollTimedOut: () => true,+ loadSummary: () => false,+ },+ ],+ polling: [+ false,+ {+ startPolling: () => true,+ stopPolling: () => false,+ },+ ],+ // The `generated_at` of the summary a regeneration replaces. Reads return that summary as ready+ // until the new one lands, so polling compares against it.+ replacedGeneratedAt: [+ null as string | null,+ {+ regenerateSummarySuccess: (_, { summaryResponse }) =>+ summaryResponse?.status === IssueSummaryStatusEnumApi.Generating+ ? (summaryResponse.summary?.generated_at ?? null)+ : null,+ stopPolling: () => null,+ },+ ],+ regenerating: [+ false,+ {+ regenerateSummary: () => true,+ regenerateSummarySuccess: (_, { summaryResponse }) =>+ summaryResponse?.status === IssueSummaryStatusEnumApi.Generating,+ regenerateSummaryFailure: () => false,+ stopPolling: () => false,+ },+ ],+ feedback: [+ null as IssueSummaryFeedback | null,+ {+ sendFeedback: (_, { feedback }) => feedback,+ regenerateSummarySuccess: () => null,+ },+ ],+ }),+ selectors({+ summary: [+ (s) => [s.summaryResponse],+ (summaryResponse: ErrorTrackingIssueSummaryResponseApi | null): ErrorTrackingStoredIssueSummaryApi | null =>+ summaryResponse?.summary ?? null,+ ],+ awaitingSummary: [+ (s) => [s.summaryResponse, s.replacedGeneratedAt],+ (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ replacedGeneratedAt: string | null+ ): boolean =>+ summaryResponse?.status === IssueSummaryStatusEnumApi.Generating ||+ (replacedGeneratedAt !== null && summaryResponse?.summary?.generated_at === replacedGeneratedAt),+ ],+ view: [+ (s) => [s.summaryResponse, s.summary, s.loadFailed, s.timedOut],+ (+ summaryResponse: ErrorTrackingIssueSummaryResponseApi | null,+ summary: ErrorTrackingStoredIssueSummaryApi | null,+ loadFailed: boolean,+ timedOut: boolean+ ): IssueSummaryView => {+ if (summary) {+ return 'ready'+ }+ if (loadFailed) {+ return 'failed'+ }+ if (summaryResponse?.status === IssueSummaryStatusEnumApi.Generating) {+ return timedOut ? 'timed_out' : 'generating'+ }+ // Before the first answer and when no summary will come. Most teams do not have summaries,+ // so a placeholder here would flash on every issue page.+ return 'hidden'+ },+ ],+ }),+ listeners(({ actions, values, cache, props }) => {+ // Each poll waits for the previous answer, so a slow endpoint never has requests piling up.+ const scheduleNextPoll = (): void => {+ cache.disposables.add(() => {+ const id = setTimeout(() => actions.loadSummary(), ISSUE_SUMMARY_POLL_INTERVAL_MS)+ return () => clearTimeout(id)+ }, 'summaryPoll')+ }+ return {+ startPolling: () => {+ cache.disposables.add(() => {+ const id = setTimeout(() => actions.pollTimedOut(), ISSUE_SUMMARY_POLL_TIMEOUT_MS)+ return () => clearTimeout(id)+ }, 'summaryPollDeadline')+ },+ stopPolling: () => {+ cache.disposables.dispose('summaryPoll')+ cache.disposables.dispose('summaryPollDeadline')+ },+ pollTimedOut: () => {+ // A regenerate whose inputs did not change keeps the same `generated_at`, so it always ends here.+ // Read `regenerating` first, because `stopPolling` resets it.+ if (values.regenerating && values.summary) {+ lemonToast.info('No new summary yet. Check back later.')+ }+ actions.stopPolling()+ },+ markLoadFailed: () => {+ actions.stopPolling()+ },+ loadSummarySuccess: () => {+ if (values.loadFailed) {+ return+ }+ if (values.awaitingSummary) {+ // A poll sent before the deadline can answer after it. Only "Try again" starts a new cycle.+ if (values.timedOut) {+ return+ }+ // Starting again would also push the deadline back, so a poll that keeps answering+ // `generating` would never time out.+ if (!values.polling) {+ actions.startPolling()+ }+ scheduleNextPoll()+ return+ }+ actions.stopPolling()+ const summary = values.summary+ if (summary && cache.viewedGeneratedAt !== summary.generated_at) {+ cache.viewedGeneratedAt = summary.generated_at+ posthog.capture('error_tracking_issue_summary_viewed', {+ issue_id: props.issueId,+ category: summary.category,+ model: summary.model,+ generated_at: summary.generated_at,+ })+ }+ },+ regenerateSummary: () => {+ posthog.capture('error_tracking_issue_summary_regenerated', { issue_id: props.issueId })+ },+ regenerateSummarySuccess: ({ summaryResponse }) => {+ if (summaryResponse?.status === IssueSummaryStatusEnumApi.Generating) {+ actions.startPolling()+ scheduleNextPoll()+ } else if (summaryResponse?.summary) {+ lemonToast.info('This summary is already up to date.')+ }+ },+ sendFeedback: ({ feedback }) => {+ posthog.capture('error_tracking_issue_summary_feedback', {+ issue_id: props.issueId,+ feedback,+ category: values.summary?.category ?? null,+ model: values.summary?.model ?? null,+ generated_at: values.summary?.generated_at ?? null,+ })+ },+ }+ }),+ afterMount(({ actions }) => {+ actions.loadSummary()+ }),+])diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 28e1a63704c1..47ac1f0a98c4 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -42389,6 +42389,43 @@ export namespace Schemas {success: boolean;}+ export interface ErrorTrackingStoredIssueSummary {+ /** What the exception is and where it happens. */+ what_happened: string;+ /** The model's hypothesis about the cause. Not a confirmed finding. Can be empty. */+ likely_cause: string;+ /** Which users, sessions or environments see the issue. */+ who_is_affected: string;+ /** One concrete step to investigate or fix the issue. */+ suggested_next_step: string;+ /** Broad source of the issue, or null when the category model did not answer.+ *+ * * `own_code` - Own Code+ * * `third_party` - Third Party+ * * `network` - Network+ * * `bots` - Bots+ * * `expected` - Expected+ * * `unclear` - Unclear */+ category: IssueSummaryCategoryEnum | null;+ /** Model that wrote the summary. */+ model: string;+ /** When the summary was written. */+ generated_at: string;+ /** When generation last wrote the summary or confirmed it unchanged. The regenerate interval runs from it. */+ checked_at: string;+ }++ export interface ErrorTrackingIssueSummaryResponse {+ /** ready: `summary` holds the stored summary. generating: a summary is being written in the background, so poll again. `summary` holds the previous one, if any. unavailable: no summary exists and none will be written, for example because the feature is off.+ *+ * * `ready` - Ready+ * * `generating` - Generating+ * * `unavailable` - Unavailable */+ status: IssueSummaryStatusEnum;+ /** The stored summary, or null when none exists yet. */+ summary: ErrorTrackingStoredIssueSummary | null;+ }+export interface ErrorTrackingIssueValue {/** One distinct value of the requested property. */name: string;