: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
fix(signals): collapse stack traces in inbox error evidence cards (#91804)
Chris Volzerfee680e36326
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 2879bffcc52a..ea41cd25937d 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -7112,6 +7112,10 @@ snapshots:hash: v1.k794b7964.8220c14a1dc6de9d9aa2fa2fa829bff1d19230cf7cdb947906b3fee3ead37d98.BBzXUXAId7C0u5sasTEYZBdaqZjXRU20paQFY6thp3sscenes-app-inbox-signal-cards--all-sources--light:hash: v1.k794b7964.0934851297243b7d23bdd81a483207f45c9d2c3d1610ef6e110f7caff8bdd827.7VHcEHSf7WtelKnEDOy6Rr2-Bu9t6I3J3f4-OuLUQAA+ scenes-app-inbox-signal-cards--error-tracking-stack-trace--dark:+ hash: v1.k794b7964.1079c33189e18745b6948c8d893f67cc548ab1d97d91726856404d6fffe2144f.nN2u5Dah5xh1s43vMIoK393U45xSnh0a__0Fj8IZiQs+ scenes-app-inbox-signal-cards--error-tracking-stack-trace--light:+ hash: v1.k794b7964.aa21988170efa24558a07df517a8d8fd27b9708c6f1228d7c1ffd08572e5a8ce.Y5gzV-7m1I3ViQfpe3ek_QMq0YgPZuIXGPaaQXKkJr4scenes-app-inbox-signal-cards--generic-fallbacks--dark:hash: v1.k794b7964.0675fbd7acca5320139d134150e70d3cd9e763580b0eb4cbaa93d5756669ae15.pKrX03LXxk8_E-bezOswMJafPsVaFWft7GbSeImpQDQscenes-app-inbox-signal-cards--generic-fallbacks--light:diff --git a/frontend/src/lib/lemon-ui/LemonMarkdown/LemonMarkdown.tsx b/frontend/src/lib/lemon-ui/LemonMarkdown/LemonMarkdown.tsxindex 07027d7a30ab..5d1ef9f9c9ae 100644--- a/frontend/src/lib/lemon-ui/LemonMarkdown/LemonMarkdown.tsx+++ b/frontend/src/lib/lemon-ui/LemonMarkdown/LemonMarkdown.tsx@@ -74,6 +74,12 @@ export interface LemonMarkdownProps {disableImages?: booleanclassName?: stringwrapCode?: boolean+ /**+ * If set, block code renders at most this many lines and the rest is cut. The copy button+ * copies the visible lines only. Use where content can carry an unboundedly long code block+ * (e.g. a stack trace) that would otherwise dominate the surrounding UI.+ */+ codeMaxLines?: number/** Whether to generate id attributes on heading elements for anchor linking. */generateHeadingIds?: boolean/**@@ -127,6 +133,7 @@ const LemonMarkdownRenderer = memo(function LemonMarkdownRenderer({disableDocsRedirect = false,disableImages = false,wrapCode = false,+ codeMaxLines,generateHeadingIds = false,renderMermaid,renderChartRef,@@ -157,9 +164,12 @@ const LemonMarkdownRenderer = memo(function LemonMarkdownRenderer({return <>{renderMermaid(value)}</>}const language = languageMatch ? getLanguage(languageMatch[1]) : Language.Text+ const lines = value.split('\n')+ const displayedValue =+ codeMaxLines && lines.length > codeMaxLines ? lines.slice(0, codeMaxLines).join('\n') : valuereturn (<CodeSnippet language={language} wrap={wrapCode} compact>- {value}+ {displayedValue}</CodeSnippet>)}@@ -274,6 +284,7 @@ const LemonMarkdownRenderer = memo(function LemonMarkdownRenderer({disableImages,lowKeyHeadings,wrapCode,+ codeMaxLines,generateHeadingIds,renderMermaid,renderChartRef,@@ -316,6 +327,7 @@ function LemonMarkdownComponent({disableDocsRedirect = false,disableImages = false,wrapCode = false,+ codeMaxLines,generateHeadingIds = false,renderMermaid,renderChartRef,@@ -328,6 +340,7 @@ function LemonMarkdownComponent({disableDocsRedirect={disableDocsRedirect}disableImages={disableImages}wrapCode={wrapCode}+ codeMaxLines={codeMaxLines}generateHeadingIds={generateHeadingIds}renderMermaid={renderMermaid}renderChartRef={renderChartRef}diff --git a/products/signals/frontend/inbox/components/signalCards/ErrorTrackingSignalCard.tsx b/products/signals/frontend/inbox/components/signalCards/ErrorTrackingSignalCard.tsxindex f55c40ae9097..df64d7076d7a 100644--- a/products/signals/frontend/inbox/components/signalCards/ErrorTrackingSignalCard.tsx+++ b/products/signals/frontend/inbox/components/signalCards/ErrorTrackingSignalCard.tsx@@ -93,7 +93,10 @@ export function ErrorTrackingSignalCard({ signal }: SignalCardProps): JSX.Elemenreturn (<SignalCardShell signal={signal}>{signal.content && (- <LemonMarkdown className="text-sm text-secondary mb-2" disableImages>+ // The signal content ends with the issue's full stack trace in a code fence, which+ // is written for the report LLM rather than for display, so cap it to keep it from+ // swallowing the evidence rail. The View issue link carries the full trace.+ <LemonMarkdown className="text-sm text-secondary mb-2" disableImages codeMaxLines={3}>{signal.content}</LemonMarkdown>)}diff --git a/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsxindex 5a90ee3e8766..8ae84a6049b6 100644--- a/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx+++ b/products/signals/frontend/inbox/components/signalCards/SignalCards.stories.tsx@@ -186,6 +186,41 @@ const errorTrackingIssue = makeSignal({extra: { fingerprint: 'fp-upload-413' },})+// The real signal content carries the issue's full stack trace as a code fence (it is written for+// the report LLM, see `emit_issue_lifecycle_signal`), so a fixture with a long one pins the+// three-line cap the card applies to it.+const STACK_TRACE = [+ 'RequestEntityTooLarge: upload chunk exceeds 10 MB',+ 'handle_upload in app/api/uploads.py line 214',+ 'validate_request in app/api/middleware.py line 61',+ 'process_chunks in app/uploads/chunking.py line 88',+ 'next_chunk in app/uploads/chunking.py line 47',+ 'write_chunk in app/uploads/storage.py line 132',+ 'put_object in app/clients/object_store.py line 55',+ 'with_retries in app/clients/retry.py line 29',+ 'inner in contextlib.py line 85',+ 'request in httpclient/session.py line 402',+ 'send in httpclient/adapters.py line 318',+ 'raise_for_status in httpclient/models.py line 761',+ 'handle_error in app/clients/object_store.py line 71',+ 'to_upload_error in app/uploads/errors.py line 18',+ 'log_failure in app/uploads/telemetry.py line 33',+ 'capture in analytics/client.py line 96',+ 'enqueue in analytics/queue.py line 54',+ 'flush in analytics/queue.py line 78',+ 'run in concurrent/futures/thread.py line 58',+ '_bootstrap_inner in threading.py line 1038',+ '_bootstrap in threading.py line 995',+].join('\n')++const errorTrackingIssueWithStackTrace = makeSignal({+ source_product: 'error_tracking',+ source_type: 'issue_created',+ source_id: 'issue-3',+ content: `New error tracking issue created - this particular exception was observed for the first time:\nRequestEntityTooLarge: upload chunk exceeds 10 MB\n\n\`\`\`\n${STACK_TRACE}\n\`\`\``,+ extra: { fingerprint: 'fp-upload-413-created' },+})+const healthCheck = makeSignal({source_product: 'health_checks',source_type: 'health_issue',@@ -398,6 +433,52 @@ export const GenericFallbacks: Story = {render: () => <Rail signals={[genericWithEntityLink, genericWithExternalLink, genericWithoutLink]} />,}+/** The stack trace fence in the signal content is cut to three lines instead of filling the rail. */+export const ErrorTrackingStackTrace: Story = {+ decorators: [+ mswDecorator({+ get: {+ '/api/environments/:team_id/error_tracking/issues/:issue_id/': () => [+ 200,+ {+ id: 'issue-3',+ name: 'RequestEntityTooLarge',+ description: 'upload chunk exceeds 10 MB',+ assignee: null,+ status: 'active',+ first_seen: '2026-06-08T09:30:00Z',+ external_issues: [],+ },+ ],+ },+ post: {+ '/api/environments/:team_id/query/ErrorTrackingQuery/': () => [+ 200,+ {+ results: [+ {+ first_seen: '2026-06-08T09:30:00Z',+ last_seen: BASE_DATE,+ aggregations: {+ occurrences: 12,+ sessions: 8,+ users: 6,+ volume_buckets: [+ { label: '2026-06-08T00:00:00Z', value: 2 },+ { label: '2026-06-09T00:00:00Z', value: 4 },+ { label: '2026-06-10T00:00:00Z', value: 6 },+ ],+ },+ },+ ],+ },+ ],+ },+ }),+ ],+ render: () => <Rail signals={[errorTrackingIssueWithStackTrace]} />,+}+/** One card per source with a dedicated renderer, so a layout change to any of them shows up here. */export const AllSources: Story = {render: () => (