Skip to content

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

fix(error-tracking): keep the stack trace visible under many self-driving reports (#90269)

Hugues Pouillotfbd51907a831
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 46c31d5b3155..65c090c00182 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6464,6 +6464,10 @@ snapshots:
hash: v1.k794b7964.df13f92aa545fa1056019d51f2dbcc7853919ed136f3cd58a345d9fa7bd64221.3PACUVdobKAIdsteppNzo6LALwqpw0zTXVfiM7fNVlQ
scenes-app-errortracking--group-page-releases-stacked--light:
hash: v1.k794b7964.22a72c64537f0bbdd54288f6355223e908a3d681738d55dfd940e35bf9d39e95.GkmPtbaBGZBssPIlnYxmU6Jej30vZ_gDlsOUC5YV7WU
+ scenes-app-errortracking--group-page-with-many-self-driving-reports--dark:
+ hash: v1.k794b7964.757d75a29d72d786b92fce75c06ea0e518e469df0c564555631ac91b305169fd.oliO2HP9rxtgFjDwUhCvZAWyjmFuYEn-W-OoAs-JUxM
+ scenes-app-errortracking--group-page-with-many-self-driving-reports--light:
+ hash: v1.k794b7964.17ede5ddaa313efbe17391e857dc498e1b20c30929c9a6cc574a10eaf8df7ce1.vf6-DnoIXfoa_qAjos9fnAJCpOmC0rCEVGRUN033twk
scenes-app-errortracking--group-page-with-self-driving--dark:
hash: v1.k794b7964.361c63d8098b60ca1bbf69206dc8f6711320146663aaf32dbd6651168a0b600b.dMsSmC7-kkmsg2uY_UCUtBk-2KP8U8EC-CgTQBwgCkE
scenes-app-errortracking--group-page-with-self-driving--light:
@@ -6488,6 +6492,10 @@ snapshots:
hash: v1.k794b7964.1b50022f8fafb4684dacd255b966bd2969f79e84d5c7c7daeb68291772a1e36d.9uyjrwufsjMCFx9c7cjsoIyabB3A4ZBnPSVUouM0RZE
scenes-app-errortracking-linkedreports--fix-proposed--light:
hash: v1.k794b7964.55ab1b408ab7d4610f66f2bb35d13dfabcf5188d4281f52f2a051b40392fb7b9.9jUiUdXP-J66RW2MssU_oFrMfC-C4TK3ereJqyATDLw
+ scenes-app-errortracking-linkedreports--many-reports--dark:
+ hash: v1.k794b7964.8dfec237ec7416c9efc0f6a7e1fbcb0c1d3a770946b2083c05dee94b71c7f1ae.-i8u1CAXGwd7duJovq02YplVfMQmvsXn41x-bqwE6Fw
+ scenes-app-errortracking-linkedreports--many-reports--light:
+ hash: v1.k794b7964.f59e79fad838ce516ec002dad88207a5b973092276e15e8389455665353a8df2.-hk9_3EgUm8jt6NOL9MyEfQ1qzhlsB1o3H-tx74BL34
scenes-app-errortracking-linkedreports--narrow-pane--dark:
hash: v1.k794b7964.d7527da21c5cb2847a7b40caa0767ff77c136491254ce50d3ce781ea0d3a3a9c.RQX9dwgdc9l1Xb8cETpKphmQTd3u0dBP5UKYfbWwe7E
scenes-app-errortracking-linkedreports--narrow-pane--light:
diff --git a/products/error_tracking/frontend/ErrorTracking.stories.tsx b/products/error_tracking/frontend/ErrorTracking.stories.tsx
index 51e99ca153ce..3f4c469dcc1b 100644
--- a/products/error_tracking/frontend/ErrorTracking.stories.tsx
+++ b/products/error_tracking/frontend/ErrorTracking.stories.tsx
@@ -1,6 +1,6 @@
import { MOCK_DEFAULT_BASIC_USER, MOCK_DEFAULT_TEAM } from 'lib/api.mock'
-import { Meta, StoryObj } from '@storybook/react'
+import { Decorator, Meta, StoryObj } from '@storybook/react'
import { useActions } from 'kea'
import { useLayoutEffect, useState } from 'react'
@@ -853,6 +853,28 @@ export const GroupPageLoading: Story = {
],
}
+function selfDrivingReportsDecorator(count: number): Decorator {
+ return mswDecorator({
+ get: {
+ '/api/projects/:team_id/signals/reports/': () => [
+ 200,
+ {
+ next: null,
+ results: Array.from({ length: count }, (_, index) => ({
+ id: `019f9582-93e7-77c1-8912-4f541d70cb${String(index).padStart(2, '0')}`,
+ status: index % 2 === 0 ? 'ready' : 'resolved',
+ title: `fix(replay): guard against a missing snapshot index (${index + 1})`,
+ summary: 'The player throws when a recording ends on a snapshot the index never received.',
+ implementation_pr_url: `https://github.com/PostHog/posthog/pull/${64772 + index}`,
+ implementation_pr_merged: index % 2 === 1,
+ updated_at: '2024-07-08T21:00:00Z',
+ })),
+ },
+ ],
+ },
+ })
+}
+
// Self-driving investigated this issue, so its section renders in the right pane above the exception
// card. This is the only coverage of the placement: the section's own story fabricates a pane around
// it, so it cannot show that the two header strips line up, that the section paints the background the
@@ -897,3 +919,14 @@ export const GroupPageWithSelfDriving: Story = {
}),
],
}
+
+// An issue the agent looked at many times. The section stops at half the pane and scrolls, so the
+// exception card and its stack trace stay on screen.
+export const GroupPageWithManySelfDrivingReports: Story = {
+ name: 'Issue scene with many self-driving reports',
+ parameters: {
+ pageUrl: urls.errorTrackingIssue(ISSUE_ID),
+ testOptions: { waitForLoadersToDisappear: false },
+ },
+ decorators: [selfDrivingReportsDecorator(12)],
+}
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.stories.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.stories.tsx
index 581d9c05b5e3..b05f971f1189 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.stories.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.stories.tsx
@@ -76,6 +76,33 @@ export const SeveralReportsAcrossStates: Story = {
),
}
+/**
+ * More reports than the pane has room for. The section stops at half the pane and scrolls, so the
+ * exception card below it keeps the other half.
+ */
+export const ManyReports: Story = {
+ render: () => (
+ // Two boxes, because the cap is a percentage and only resolves against a parent that has a
+ // height. The outer box stands in for the scene, the inner one for the pane, which takes its
+ // height from the scene rather than declaring one.
+ <div className="w-[700px] h-[400px] flex flex-col">
+ <div className="flex flex-col flex-1 min-h-0">
+ <LinkedReportsSection
+ reports={Array.from({ length: 12 }, (_, index) =>
+ makeReport({
+ id: `019f9582-93e7-77c1-8912-4f541d70cb${String(index).padStart(2, '0')}`,
+ title: `fix(replay): guard against a missing snapshot index (${index + 1})`,
+ })
+ )}
+ />
+ <div className="flex-1 min-h-0 border-t bg-surface-secondary px-2 py-1 text-xs text-muted">
+ The exception card sits here
+ </div>
+ </div>
+ </div>
+ ),
+}
+
/** The narrowest the pane gets, where the title and the fix state compete for width. */
export const NarrowPane: Story = {
render: () => (
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.tsx
index 5bbc29277552..7267c6b04ea5 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/LinkedReports.tsx
@@ -54,6 +54,9 @@ function LinkedReportRow({ report }: { report: SignalReportApi }): JSX.Element {
* This is a section of the right pane, not a card sitting on top of one, so it wears the pane's own
* chrome: square corners, no outer border, and rows that run the full width. The name takes the AI
* color, which is how the app marks the work its own software did.
+ *
+ * The section never takes more than half the pane. An issue the agent looked at many times would
+ * otherwise push the exception card, and with it the stack trace, off the bottom of the pane.
*/
export function LinkedReportsSection({ reports }: { reports: SignalReportApi[] }): JSX.Element | null {
if (reports.length === 0) {
@@ -62,7 +65,7 @@ export function LinkedReportsSection({ reports }: { reports: SignalReportApi[] }
return (
// The pane paints no background of its own on desktop, so this section paints the same one the
// exception card below it paints. Without it the rows show the page behind the pane.
- <div className="shrink-0 flex flex-col bg-surface-primary">
+ <div className="min-h-0 max-h-[50%] flex flex-col bg-surface-primary">
<div className="flex justify-between h-[2rem] items-center w-full px-2 border-b shrink-0">
<div className="flex items-center gap-1 text-lg h-full">
<IconLogomark />
@@ -72,9 +75,13 @@ export function LinkedReportsSection({ reports }: { reports: SignalReportApi[] }
<span className="text-xs text-muted-alt">PostHog agent</span>
</Tooltip>
</div>
- {reports.map((report) => (
- <LinkedReportRow key={report.id} report={report} />
- ))}
+ {/* The header stays put while the rows scroll, so the section keeps its name once the list
+ is longer than the space it has. */}
+ <div className="min-h-0 overflow-y-auto">
+ {reports.map((report) => (
+ <LinkedReportRow key={report.id} report={report} />
+ ))}
+ </div>
</div>
)
}