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.

feat(stamphog): show digest content and slack link on the digests page (#108184)

Julian Bezf1c670ef0d7b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 79974b1b330c..384f325782ae 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11852,6 +11852,10 @@ snapshots:
hash: v1.k794b7964.6778108ade1085efcddf4ffe0b16a297e741e790672a3b33bc5d986f28a21ab2.i3oD4nY4Kcn08ehCHaLXHi7UVGVBK6MvVyfBqq-sJ8s
scenes-app-signals-scratchpadpanel--populated-narrow--light:
hash: v1.k794b7964.d816589bb55d55a5f400231ca5e2a0cd6b5a64ce1beb6e78287eca1c3b96e455.2bMTo4YcmA5wtKhveMZguqN_MUW1x_sYovK_8HWwfWs
+ scenes-app-stamphog-digests--digest-expanded--dark:
+ hash: v1.k794b7964.c37367d7ed65cc0d69dfa67eaa60a4857d0583997d7c46ac61624a459ca66430.LN5ob34i8KQC7FZRnu7UEBIT50kaufpYjSW8Q6z4Gy0
+ scenes-app-stamphog-digests--digest-expanded--light:
+ hash: v1.k794b7964.a01aae909aed03c9ef2cf62bebbfec3e6709df0cd02d258b61b218e382ecbde5.0gSR0Yo0ijeS4DwZdC7mjj7wB-Huj8TYoxLzn7ko_Lg
scenes-app-stamphog-digests--digests-list--dark:
hash: v1.k794b7964.28fbaad98ddd90b171e6774057e8e9656af77e67fd0b5d462235a1d063c1777c.6E_uVxcZxkBaFZgqKmXAg4njrs4xCTiNBGWAUNg9GT0
scenes-app-stamphog-digests--digests-list--light:
diff --git a/products/stamphog/backend/presentation/serializers.py b/products/stamphog/backend/presentation/serializers.py
index 214778cff820..1ab566b40c9c 100644
--- a/products/stamphog/backend/presentation/serializers.py
+++ b/products/stamphog/backend/presentation/serializers.py
@@ -601,6 +601,41 @@ class ReviewRequestResponseSerializer(serializers.Serializer):
)
+# Every field carries a default because DigestRun.summary is a JSON blob whose shape grew over time.
+# A run stored before a key existed, or one that never summarized anything ({}), still renders.
+class _DigestSummaryPRSerializer(serializers.Serializer):
+ """One merged pull request as the digest listed it."""
+
+ pr_number = serializers.IntegerField(read_only=True, default=0, help_text="Pull request number on GitHub.")
+ title = serializers.CharField(read_only=True, default="", help_text="Pull request title.")
+ url = serializers.CharField(read_only=True, default="", help_text="Full URL to the pull request on GitHub.")
+ author_login = serializers.CharField(
+ read_only=True, default="", help_text="GitHub login of the pull request author."
+ )
+ summary = serializers.CharField(
+ read_only=True, default="", help_text="The one-line summary of the change that the digest posted."
+ )
+ repository = serializers.CharField(
+ read_only=True, default="", help_text="Repository full name, e.g. 'PostHog/posthog'. Blank on older runs."
+ )
+
+
+class _DigestSummarySerializer(serializers.Serializer):
+ """What the digest posted to Slack: the headline and the pull requests it listed."""
+
+ headline = serializers.CharField(
+ read_only=True,
+ default="",
+ help_text="Prose about the merges with real consequence. Blank when the digest led with its first line.",
+ )
+ prs = _DigestSummaryPRSerializer(
+ many=True,
+ read_only=True,
+ default=list,
+ help_text="The merged pull requests the digest listed, in the order it listed them.",
+ )
+
+
@extend_schema_serializer(component_name="DigestRun")
class DigestRunSerializer(DataclassSerializer):
status = serializers.ChoiceField(
@@ -623,9 +658,22 @@ class DigestRunSerializer(DataclassSerializer):
allow_null=True,
help_text="When the digest was posted to Slack, if it was.",
)
- # The rendered summary is deliberately NOT exposed here: it's generated from each PR's body_excerpt,
- # so it reproduces repository content a project member without GitHub repo access must not read. It
- # lives only in the Slack post (whose audience already has channel access).
+ summary = serializers.SerializerMethodField(
+ help_text=(
+ "What the digest posted: its headline and the merged pull requests it listed. "
+ "Both are empty on a run with nothing to post, and on runs stored before this format."
+ ),
+ )
+
+ @extend_schema_field(_DigestSummarySerializer)
+ def get_summary(self, obj: contracts.DigestRunDTO) -> dict[str, object]:
+ # The digest writes each line from the PR title and the reviewer's change_summary, and both
+ # already reach any project member through the pull request and review run APIs. Summaries
+ # stored before the prompt dropped body_excerpt were written from PR bodies, which a member
+ # without GitHub repo access must not read. The same change added the `judged` key, so a
+ # summary without it is withheld. Keep body_excerpt out of the digest prompt, or this leaks it.
+ stored = obj.summary if "judged" in obj.summary else {}
+ return _DigestSummarySerializer(stored).data
class Meta:
dataclass = contracts.DigestRunDTO
@@ -637,6 +685,7 @@ class DigestRunSerializer(DataclassSerializer):
"resolution_source",
"status",
"pr_count",
+ "summary",
"slack_message_ts",
"error",
"created_at",
diff --git a/products/stamphog/backend/tests/test_api.py b/products/stamphog/backend/tests/test_api.py
index 4fe364b0a77b..9a0ab175c1eb 100644
--- a/products/stamphog/backend/tests/test_api.py
+++ b/products/stamphog/backend/tests/test_api.py
@@ -1179,7 +1179,23 @@ class TestDigestRunAPI(StamphogTeamScopedTestMixin, APIBaseTest):
# The run is the only record of a digest's destination now that routing is derived per run
# rather than stored on a channel row. Losing these fields leaves "why did my digest go
# there" unanswerable from anywhere but a worker log.
- for channel_id, audience in (("C1", "team-x"), ("C2", "team-y")):
+ # team-x's summary predates the repository key, and team-y posted nothing. Both are stored
+ # shapes the page has to render. team-z's summary predates the `judged` key, so it was written
+ # from PR bodies and must stay out of the API.
+ old_shape_summary = {
+ "headline": "Retries are on for exports.",
+ "prs": [{"pr_number": 7, "title": "Retry exports", "url": "https://example.com/7", "author_login": "ada"}],
+ "judged": True,
+ }
+ body_derived_summary = {
+ "headline": "Text from a private pull request body.",
+ "prs": [{"pr_number": 8, "title": "Private change", "url": "https://example.com/8", "author_login": "bo"}],
+ }
+ for channel_id, audience, summary in (
+ ("C1", "team-x", old_shape_summary),
+ ("C2", "team-y", {}),
+ ("C3", "team-z", body_derived_summary),
+ ):
DigestRun.objects.unscoped().create(
team_id=self.team.id,
audience_key=audience,
@@ -1188,13 +1204,32 @@ class TestDigestRunAPI(StamphogTeamScopedTestMixin, APIBaseTest):
slack_channel_name=audience,
resolution_source=ChannelResolutionSource.OWNERS_CONTACT,
status=DigestRunStatus.COMPLETED,
+ summary=summary,
)
url = f"/api/projects/{self.team.id}/stamphog/digest_runs/"
body = self.client.get(url).json()
- assert {r["slack_channel_id"] for r in body["results"]} == {"C1", "C2"}
- assert {r["audience_key"] for r in body["results"]} == {"team-x", "team-y"}
+ assert {r["slack_channel_id"] for r in body["results"]} == {"C1", "C2", "C3"}
+ assert {r["audience_key"] for r in body["results"]} == {"team-x", "team-y", "team-z"}
assert {r["resolution_source"] for r in body["results"]} == {"owners_contact"}
+ summaries = {r["audience_key"]: r["summary"] for r in body["results"]}
+ assert summaries == {
+ "team-x": {
+ "headline": "Retries are on for exports.",
+ "prs": [
+ {
+ "pr_number": 7,
+ "title": "Retry exports",
+ "url": "https://example.com/7",
+ "author_login": "ada",
+ "summary": "",
+ "repository": "",
+ }
+ ],
+ },
+ "team-y": {"headline": "", "prs": []},
+ "team-z": {"headline": "", "prs": []},
+ }
filtered = self.client.get(f"{url}?slack_channel_id=C1").json()
assert [r["audience_key"] for r in filtered["results"]] == ["team-x"]
diff --git a/products/stamphog/frontend/generated/api.schemas.ts b/products/stamphog/frontend/generated/api.schemas.ts
index 1ff90c42744d..cbd24c64ba3a 100644
--- a/products/stamphog/frontend/generated/api.schemas.ts
+++ b/products/stamphog/frontend/generated/api.schemas.ts
@@ -35,6 +35,34 @@ export const DigestRunStatusEnumApi = {
Failed: 'failed',
} as const
+/**
+ * One merged pull request as the digest listed it.
+ */
+export interface _DigestSummaryPRApi {
+ /** Pull request number on GitHub. */
+ readonly pr_number: number
+ /** Pull request title. */
+ readonly title: string
+ /** Full URL to the pull request on GitHub. */
+ readonly url: string
+ /** GitHub login of the pull request author. */
+ readonly author_login: string
+ /** The one-line summary of the change that the digest posted. */
+ readonly summary: string
+ /** Repository full name, e.g. 'PostHog/posthog'. Blank on older runs. */
+ readonly repository: string
+}
+
+/**
+ * What the digest posted to Slack: the headline and the pull requests it listed.
+ */
+export interface _DigestSummaryApi {
+ /** Prose about the merges with real consequence. Blank when the digest led with its first line. */
+ readonly headline: string
+ /** The merged pull requests the digest listed, in the order it listed them. */
+ readonly prs: readonly _DigestSummaryPRApi[]
+}
+
export interface DigestRunApi {
readonly id: string
/** Digest bucket this run drained, e.g. a team slug or 'repo:PostHog/posthog'. */
@@ -58,6 +86,8 @@ export interface DigestRunApi {
readonly status: DigestRunStatusEnumApi
/** Number of merged PRs included in the posted digest. */
readonly pr_count: number
+ /** What the digest posted: its headline and the merged pull requests it listed. Both are empty on a run with nothing to post, and on runs stored before this format. */
+ readonly summary: _DigestSummaryApi
/** Slack message timestamp of the posted digest, if posted. */
readonly slack_message_ts: string
/** Error message if the run failed, blank otherwise. */
diff --git a/products/stamphog/frontend/scenes/StamphogDigestsScene/DigestRunDetails.tsx b/products/stamphog/frontend/scenes/StamphogDigestsScene/DigestRunDetails.tsx
new file mode 100644
index 000000000000..de14598a64ff
--- /dev/null
+++ b/products/stamphog/frontend/scenes/StamphogDigestsScene/DigestRunDetails.tsx
@@ -0,0 +1,52 @@
+import { useActions } from 'kea'
+
+import { LemonTag, Link } from '@posthog/lemon-ui'
+
+import { DigestRunApi } from '../../generated/api.schemas'
+import { digestSlackMessageUrl, digestSummary } from './digestDisplay'
+import { stamphogDigestsSceneLogic } from './stamphogDigestsSceneLogic'
+
+export function DigestRunDetails({ run }: { run: DigestRunApi }): JSX.Element {
+ const { slackMessageLinkClicked, digestPrLinkClicked } = useActions(stamphogDigestsSceneLogic)
+ const slackMessageUrl = digestSlackMessageUrl(run)
+ const { headline, prs } = digestSummary(run)
+
+ return (
+ <div className="flex flex-col gap-3 pl-2 pr-4 py-4 text-xs">
+ {run.error && <span className="font-mono text-danger break-all">{run.error}</span>}
+ {slackMessageUrl && (
+ <Link
+ to={slackMessageUrl}
+ target="_blank"
+ onClick={() => slackMessageLinkClicked(run)}
+ data-attr="stamphog-digest-slack-link"
+ >
+ Open in Slack
+ </Link>
+ )}
+ {headline && <p className="m-0 text-sm">{headline}</p>}
+ {prs.length > 0 && (
+ <ul className="flex flex-col gap-2 m-0 p-0 list-none">
+ {prs.map((pr) => (
+ <li key={pr.url} className="min-w-0">
+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
+ <Link
+ to={pr.url}
+ target="_blank"
+ onClick={() => digestPrLinkClicked(run)}
+ className="font-semibold break-words min-w-0"
+ data-attr="stamphog-digest-pr-link"
+ >
+ #{pr.pr_number} {pr.title}
+ </Link>
+ {pr.repository && <LemonTag type="muted">{pr.repository}</LemonTag>}
+ {pr.author_login && <span className="text-muted">by {pr.author_login}</span>}
+ </div>
+ {pr.summary && <p className="m-0 mt-0.5 text-muted">{pr.summary}</p>}
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+ )
+}
diff --git a/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.stories.tsx b/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.stories.tsx
index db9e9f2badb3..cac78f291163 100644
--- a/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.stories.tsx
+++ b/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.stories.tsx
@@ -5,8 +5,12 @@ import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
+import { expect, userEvent, waitFor } from 'storybook/test'
+
import type { DigestRunApi } from '../../generated/api.schemas'
+const EMPTY_SUMMARY: DigestRunApi['summary'] = { headline: '', prs: [] }
+
const digestRun = (overrides: Partial<DigestRunApi>): DigestRunApi =>
({
id: '00000000-0000-0000-0000-0000000000e0',
@@ -15,7 +19,36 @@ const digestRun = (overrides: Partial<DigestRunApi>): DigestRunApi =>
slack_channel_name: 'team-devex',
resolution_source: 'stamphog_config',
status: 'completed',
- pr_count: 14,
+ pr_count: 3,
+ summary: {
+ headline: 'Local test runs reuse the database, and one command now starts the dev stack.',
+ prs: [
+ {
+ pr_number: 4101,
+ title: 'Reuse the test database between local runs',
+ url: 'https://github.com/example-org/example-repo/pull/4101',
+ author_login: 'jane-example',
+ summary: 'Local pytest runs keep the test database, so a second run skips the schema setup.',
+ repository: 'example-org/example-repo',
+ },
+ {
+ pr_number: 4117,
+ title: 'Collapse the dev stack start into one command',
+ url: 'https://github.com/example-org/example-repo/pull/4117',
+ author_login: 'sam-example',
+ summary: 'One command now starts the services, waits for them, and runs pending migrations.',
+ repository: 'example-org/example-repo',
+ },
+ {
+ pr_number: 88,
+ title: 'Print the failing step when setup stops',
+ url: 'https://github.com/example-org/example-tools/pull/88',
+ author_login: 'alex-example',
+ summary: 'Setup errors now name the step that failed instead of a generic exit code.',
+ repository: 'example-org/example-tools',
+ },
+ ],
+ },
slack_message_ts: '1755424800.001900',
error: '',
created_at: '2026-08-17T09:00:00Z',
@@ -34,6 +67,7 @@ const digestRuns = {
// slack_message_ts separates it from a real post.
digestRun({
id: '00000000-0000-0000-0000-0000000000e1',
+ summary: EMPTY_SUMMARY,
audience_key: 'repo:PostHog/hogland',
slack_channel_id: 'C045EF6GH',
slack_channel_name: '',
@@ -45,6 +79,7 @@ const digestRuns = {
}),
digestRun({
id: '00000000-0000-0000-0000-0000000000e2',
+ summary: EMPTY_SUMMARY,
audience_key: 'team-devex',
slack_channel_id: 'C099ZZ9ZZ',
slack_channel_name: 'team-devex',
@@ -58,6 +93,7 @@ const digestRuns = {
}),
digestRun({
id: '00000000-0000-0000-0000-0000000000e3',
+ summary: EMPTY_SUMMARY,
status: 'pending',
pr_count: 0,
slack_message_ts: '',
@@ -90,6 +126,17 @@ export default meta
// Posted, posted-but-empty, failed to reach Slack, and not yet run.
export const DigestsList: StoryObj = {}
+export const DigestExpanded: StoryObj = {
+ play: async ({ canvasElement }) => {
+ const toggle = await waitFor(() => {
+ const button = canvasElement.querySelector<HTMLElement>('.LemonTable__toggle button')
+ expect(button).not.toBeNull()
+ return button as HTMLElement
+ })
+ await userEvent.click(toggle)
+ },
+}
+
export const DigestsListEmpty: StoryObj = {
decorators: [
mswDecorator({
diff --git a/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.tsx b/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.tsx
index 1325d1525002..5f94f0dfa60f 100644
--- a/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.tsx
+++ b/products/stamphog/frontend/scenes/StamphogDigestsScene/StamphogDigestsScene.tsx
@@ -11,7 +11,8 @@ import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { StamphogTabs } from '../../components/StamphogTabs'
import { DigestRunApi } from '../../generated/api.schemas'
-import { digestDestinationLabel, digestStatusDisplay } from './digestDisplay'
+import { digestDestinationLabel, digestRunHasDetails, digestStatusDisplay } from './digestDisplay'
+import { DigestRunDetails } from './DigestRunDetails'
import { DIGESTS_PAGE_SIZE, stamphogDigestsSceneLogic } from './stamphogDigestsSceneLogic'
export const scene: SceneExport = {
@@ -22,7 +23,7 @@ export const scene: SceneExport = {
function DigestsTable(): JSX.Element {
const { digestRuns, digestRunsCount, digestRunsResponseLoading, digestRunsFailed, page } =
useValues(stamphogDigestsSceneLogic)
- const { setPage, loadDigestRuns } = useActions(stamphogDigestsSceneLogic)
+ const { setPage, loadDigestRuns, digestRunExpanded } = useActions(stamphogDigestsSceneLogic)
const columns: LemonTableColumns<DigestRunApi> = [
{
@@ -80,7 +81,8 @@ function DigestsTable(): JSX.Element {
rowKey="id"
expandable={{
expandedRowRender: (run) => <DigestRunDetails run={run} />,
- rowExpandable: (run) => !!run.error || !!run.slack_message_ts,
+ rowExpandable: digestRunHasDetails,
+ onRowExpand: digestRunExpanded,
}}
pagination={{
controlled: true,
@@ -96,17 +98,6 @@ function DigestsTable(): JSX.Element {
)
}
-function DigestRunDetails({ run }: { run: DigestRunApi }): JSX.Element {
- return (
- <div className="flex flex-col gap-2 pl-2 pr-4 py-4 text-xs">
- {run.error && <span className="font-mono text-danger break-all">{run.error}</span>}
- {run.slack_message_ts && (
- <span className="font-mono text-muted break-all">Slack message timestamp: {run.slack_message_ts}</span>
- )}
- </div>
- )
-}
-
export function StamphogDigestsScene(): JSX.Element {
return (
<SceneContent>
diff --git a/products/stamphog/frontend/scenes/StamphogDigestsScene/digestDisplay.ts b/products/stamphog/frontend/scenes/StamphogDigestsScene/digestDisplay.ts
index fd9613b25003..2cecf3762c79 100644
--- a/products/stamphog/frontend/scenes/StamphogDigestsScene/digestDisplay.ts
+++ b/products/stamphog/frontend/scenes/StamphogDigestsScene/digestDisplay.ts
@@ -34,3 +34,27 @@ export function digestStatusDisplay(run: DigestRunApi): { type: LemonTagType; la
export function digestDestinationLabel(run: DigestRunApi): string {
return run.slack_channel_name ? `#${run.slack_channel_name}` : run.slack_channel_id
}
+
+// A real Slack ts is "<seconds>.<micros>". digest_runs.py stores "posted" when Slack accepted the
+// message but returned no ts, and a link built from that opens nothing.
+const SLACK_MESSAGE_TS_PATTERN = /^\d+\.\d+$/
+
+/** Permalink to the posted digest, in the `/archives/<channel>/p<ts without the dot>` form. */
+export function digestSlackMessageUrl(run: DigestRunApi): string | null {
+ if (!run.slack_channel_id || !SLACK_MESSAGE_TS_PATTERN.test(run.slack_message_ts)) {
+ return null
+ }
+ return `https://app.slack.com/archives/${run.slack_channel_id}/p${run.slack_message_ts.replace('.', '')}`
+}
+
+const EMPTY_SUMMARY: DigestRunApi['summary'] = { headline: '', prs: [] }
+
+/** The digest content, empty when an API pod from the previous release answered without it during a deploy. */
+export function digestSummary(run: DigestRunApi): DigestRunApi['summary'] {
+ return run.summary ?? EMPTY_SUMMARY
+}
+
+export function digestRunHasDetails(run: DigestRunApi): boolean {
+ const { headline, prs } = digestSummary(run)
+ return !!run.error || digestSlackMessageUrl(run) !== null || !!headline || prs.length > 0
+}
diff --git a/products/stamphog/frontend/scenes/StamphogDigestsScene/stamphogDigestsSceneLogic.ts b/products/stamphog/frontend/scenes/StamphogDigestsScene/stamphogDigestsSceneLogic.ts
index b6f54a1ba50d..ddc025760f7a 100644
--- a/products/stamphog/frontend/scenes/StamphogDigestsScene/stamphogDigestsSceneLogic.ts
+++ b/products/stamphog/frontend/scenes/StamphogDigestsScene/stamphogDigestsSceneLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -10,6 +11,10 @@ import type { DigestRunApi, PaginatedDigestRunListApi } from '../../generated/ap
export const DIGESTS_PAGE_SIZE = 50
+function digestRunEventProperties(run: DigestRunApi): Record<string, string | number> {
+ return { digest_run_id: run.id, status: run.status, pr_count: run.pr_count }
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface stamphogDigestsSceneLogicValues {
currentProjectId: number | string // teamLogic
@@ -23,6 +28,12 @@ export interface stamphogDigestsSceneLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface stamphogDigestsSceneLogicActions {
+ digestPrLinkClicked: (run: DigestRunApi) => {
+ run: DigestRunApi
+ }
+ digestRunExpanded: (run: DigestRunApi) => {
+ run: DigestRunApi
+ }
loadDigestRuns: () => {
value: true
}
@@ -47,6 +58,9 @@ export interface stamphogDigestsSceneLogicActions {
setPage: (page: number) => {
page: number
}
+ slackMessageLinkClicked: (run: DigestRunApi) => {
+ run: DigestRunApi
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -77,6 +91,9 @@ export const stamphogDigestsSceneLogic = kea<stamphogDigestsSceneLogicType>([
// `loadDigestRuns()` call site would stop compiling.
loadDigestRuns: true,
setPage: (page: number) => ({ page }),
+ digestRunExpanded: (run: DigestRunApi) => ({ run }),
+ slackMessageLinkClicked: (run: DigestRunApi) => ({ run }),
+ digestPrLinkClicked: (run: DigestRunApi) => ({ run }),
}),
reducers({
@@ -124,6 +141,16 @@ export const stamphogDigestsSceneLogic = kea<stamphogDigestsSceneLogicType>([
listeners(({ actions }) => ({
setPage: () => actions.loadDigestRuns(),
+ // The event names are frozen: insights on digest usage break if one is renamed.
+ digestRunExpanded: ({ run }) => {
+ posthog.capture('stamphog digest expanded', digestRunEventProperties(run))
+ },
+ slackMessageLinkClicked: ({ run }) => {
+ posthog.capture('stamphog digest slack message opened', digestRunEventProperties(run))
+ },
+ digestPrLinkClicked: ({ run }) => {
+ posthog.capture('stamphog digest pull request opened', digestRunEventProperties(run))
+ },
})),
actionToUrl(({ values }) => {
@@ -146,6 +173,7 @@ export const stamphogDigestsSceneLogic = kea<stamphogDigestsSceneLogicType>([
})),
afterMount(({ actions }) => {
+ posthog.capture('stamphog digests viewed')
actions.loadDigestRuns()
}),
])
diff --git a/products/stamphog/mcp/tools.yaml b/products/stamphog/mcp/tools.yaml
index 8aead27a7b19..41e22daefd5f 100644
--- a/products/stamphog/mcp/tools.yaml
+++ b/products/stamphog/mcp/tools.yaml
@@ -23,8 +23,9 @@ tools:
description: >
List posted (or attempted) daily digest runs, newest first. Each run reports the audience it drained (a team
slug, or `repo:owner/name`), the Slack channel it went to and why routing chose that channel, its status,
- how many merged PRs it summarized, and the Slack message timestamp. Filter by `slack_channel_id` to see one
- channel's history. The rendered summary text lives only in the Slack post.
+ how many merged PRs it summarized, the Slack message timestamp, and the digest content (`summary`: the
+ headline and each listed PR's number, title, URL, author, repository and one-line summary). Filter by
+ `slack_channel_id` to see one channel's history.
feature_flag: stamphog
stamphog-digest-runs-retrieve:
operation: stamphog_digest_runs_retrieve
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 279e378538a7..ecc076feac8a 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -11525,7 +11525,7 @@
}
},
"stamphog-digest-runs-list": {
- "description": "List posted (or attempted) daily digest runs, newest first. Each run reports the audience it drained (a team slug, or `repo:owner/name`), the Slack channel it went to and why routing chose that channel, its status, how many merged PRs it summarized, and the Slack message timestamp. Filter by `slack_channel_id` to see one channel's history. The rendered summary text lives only in the Slack post.",
+ "description": "List posted (or attempted) daily digest runs, newest first. Each run reports the audience it drained (a team slug, or `repo:owner/name`), the Slack channel it went to and why routing chose that channel, its status, how many merged PRs it summarized, the Slack message timestamp, and the digest content (`summary`: the headline and each listed PR's number, title, URL, author, repository and one-line summary). Filter by `slack_channel_id` to see one channel's history.",
"category": "Stamphog",
"feature": "stamphog",
"summary": "List stamphog digest runs",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 89c0b3ccc57a..11f502c79e99 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -12100,7 +12100,7 @@
}
},
"stamphog-digest-runs-list": {
- "description": "List posted (or attempted) daily digest runs, newest first. Each run reports the audience it drained (a team slug, or `repo:owner/name`), the Slack channel it went to and why routing chose that channel, its status, how many merged PRs it summarized, and the Slack message timestamp. Filter by `slack_channel_id` to see one channel's history. The rendered summary text lives only in the Slack post.",
+ "description": "List posted (or attempted) daily digest runs, newest first. Each run reports the audience it drained (a team slug, or `repo:owner/name`), the Slack channel it went to and why routing chose that channel, its status, how many merged PRs it summarized, the Slack message timestamp, and the digest content (`summary`: the headline and each listed PR's number, title, URL, author, repository and one-line summary). Filter by `slack_channel_id` to see one channel's history.",
"category": "Stamphog",
"feature": "stamphog",
"summary": "List stamphog digest runs",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index f991aeaf9409..4a5f903c73ca 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -32774,6 +32774,34 @@ export namespace Schemas {
Failed: 'failed',
} as const;
+ /**
+ * One merged pull request as the digest listed it.
+ */
+ export interface _DigestSummaryPR {
+ /** Pull request number on GitHub. */
+ readonly pr_number: number;
+ /** Pull request title. */
+ readonly title: string;
+ /** Full URL to the pull request on GitHub. */
+ readonly url: string;
+ /** GitHub login of the pull request author. */
+ readonly author_login: string;
+ /** The one-line summary of the change that the digest posted. */
+ readonly summary: string;
+ /** Repository full name, e.g. 'PostHog/posthog'. Blank on older runs. */
+ readonly repository: string;
+ }
+
+ /**
+ * What the digest posted to Slack: the headline and the pull requests it listed.
+ */
+ export interface _DigestSummary {
+ /** Prose about the merges with real consequence. Blank when the digest led with its first line. */
+ readonly headline: string;
+ /** The merged pull requests the digest listed, in the order it listed them. */
+ readonly prs: readonly _DigestSummaryPR[];
+ }
+
export interface DigestRun {
readonly id: string;
/** Digest bucket this run drained, e.g. a team slug or 'repo:PostHog/posthog'. */
@@ -32797,6 +32825,8 @@ export namespace Schemas {
readonly status: DigestRunStatusEnum;
/** Number of merged PRs included in the posted digest. */
readonly pr_count: number;
+ /** What the digest posted: its headline and the merged pull requests it listed. Both are empty on a run with nothing to post, and on runs stored before this format. */
+ readonly summary: _DigestSummary;
/** Slack message timestamp of the posted digest, if posted. */
readonly slack_message_ts: string;
/** Error message if the run failed, blank otherwise. */