Skip to content

fix(signals): deliver note-only report edits to Slack as the note - #83039

Merged
trunk-io[bot] merged 2 commits into
masterfrom
claude/scouts-work-duplicate-slack-0x0cg8
Aug 14, 2026
Merged

fix(signals): deliver note-only report edits to Slack as the note#83039
trunk-io[bot] merged 2 commits into
masterfrom
claude/scouts-work-duplicate-slack-0x0cg8

Conversation

@andrewm4894

@andrewm4894 andrewm4894 commented Aug 14, 2026

Copy link
Copy Markdown
Member

Problem

  • A team with a scout Slack destination sees the same report message twice when a scout later adds a note to a report it already posted.
  • edit_report enqueues the same delivery as a fresh emit, so the worker re-renders the unchanged title and summary.
  • The note, the only new content, never reaches the channel.

Changes

  • A note-only edit now posts the note itself: a context line saying the scout added a note to an existing report, the report title, the note body, and the usual "View report in PostHog" button.
  • _do_edit_report marks a delivery as note-only when a note was appended and the title and summary were untouched. An edit that rewrites content still posts the report message, even when it also appends a note.
  • The note snapshot rides the Celery payload, clipped to 6,000 chars. Snapshotting at enqueue keeps the message on the note this edit added, not whatever the work log holds at send time.
  • enqueue_scout_slack_delivery omits the edit_note kwarg when unset, so deliveries without a note keep the payload shape workers on the previous task signature accept during a rolling deploy.

What the channel sees when a scout adds a note to a report it already posted (mockups, not screenshots):

Before, a second copy of the report message:

Scout · Support trends
Login failures spiked after the 1.2 release
(the full report summary again, identical to the message above it)
View report in PostHog

After, the note framed as an update:

Scout · Support trends added a note to an existing report
Login failures spiked after the 1.2 release
Re-checked this morning: error rate is back to baseline since the fix deployed.
View report in PostHog

The note body gets the same treatment as a summary: markdown to mrkdwn conversion, mention-injection escaping, chart references reduced to labels, section truncation.

No app UI changes. I could not post a rendered message to a Slack workspace from this session, so the examples above are mockups.

How did you test this code?

  • New test in test_scout_slack_delivery.py: a delivery carrying a note renders the note, not the summary. Catches a revert of the note branch, which would re-post the duplicate report message.
  • Extended test_report_emit_and_edit_enqueue_configured_slack_destination_after_commit: only the note-only edit carries edit_note; an emit and a summary rewrite with a note do not. Catches the discriminator regressing to "any note".
  • New test: the enqueue omits the edit_note kwarg when unset. Catches a payload-shape change that would make old workers reject every delivery during a rolling deploy.
  • Not run to completion locally: the Django suite needs a database this sandbox had to bootstrap from scratch, and the run was still migrating at PR time. CI runs these files.

Automatic notifications

  • Publish to changelog?

Docs update

None: the scout Slack destination behavior is not separately documented.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Written by Claude Code in a remote session directed by a PostHog engineer; the driver asked for note-only report edits to stop reading as duplicate Slack messages.
  • Skills invoked: /writing-user-facing-copy, /writing-tests, /writing-code-comments, /writing-pr-descriptions.
  • Considered re-reading the note from the report's work log at send time instead of snapshotting it into the payload, and rejected it: later notes could swap in, and the delivery task cannot tell which note this delivery was for.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYWXRYPWd3cK7pza5gjHd4

A scout edit that only appends a note re-posted the full report message,
which reads as a duplicate in the channel. Note-only edits now post the
note itself, framed as an update to the existing report.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DYWXRYPWd3cK7pza5gjHd4
@trunk-io

trunk-io Bot commented Aug 14, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@andrewm4894
andrewm4894 marked this pull request as ready for review August 14, 2026 08:42
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team August 14, 2026 08:43
@andrewm4894 andrewm4894 added the reviewhog ($$$) Reviews pull requests before humans do label Aug 14, 2026 — with Claude
@posthog

posthog Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦔 ReviewHog reviewed this pull request

Found 0 must fix, 1 should fix, 0 consider.

Published 1 finding (view the review).

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(signals): deliver note-only report e..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80f50d16dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread products/signals/backend/tasks.py
@posthog

posthog Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

ReviewHog Alpha 🦔 If you find any issues helpful - please reply "valid", "invalid", etc., for evaluation purposes 🙏

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewHog Report

Found 1 should fix.

Comment thread products/signals/backend/tasks.py
@trunk-io

trunk-io Bot commented Aug 14, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@andrewm4894 andrewm4894 added the stamphog Request AI approval (no full review) label Aug 14, 2026
@andrewm4894

Copy link
Copy Markdown
Member Author

/trunk merge

@stamphog

stamphog Bot commented Aug 14, 2026

Copy link
Copy Markdown

Note

🤖 stamphog reviewed 24d52e46bbf8721b46a1f7a3641bafbf33b16e2a — verdict: ESCALATE

A ReviewHog finding confirms this PR's producer can send an edit_note kwarg to a Celery worker still running the previous task signature during a rolling deploy, dropping the note notification with a TypeError. The bot explicitly said this is a release-sequencing tradeoff for a human to decide, not something it can resolve, and the thread remains unresolved with no human sign-off on accepting that risk.

  • Author wrote 0% of the modified lines and has 143 merged PRs in these paths (familiarity MODERATE).
  • 👍 on the PR from greptile-apps[bot].
  • Unresolved inline thread on products/signals/backend/tasks.py: note-only Slack deliveries enqueued during the rollout of this PR can land on an old worker that rejects the new edit_note kwarg, dropping the note notification (bounded to this one deploy, report data itself is unaffected).
  • Author (via Claude Code) argued for accepting this risk rather than fixing it, and offered a two-stage deploy alternative on request, but no maintainer has weighed in to accept that tradeoff.
  • No approving review from a human or an agent reviewer with no outstanding concerns is present — all reviews are COMMENTED.
Gate mechanics and policy version
Gate Result
prerequisites all clear
deny-list no deny categories matched
size 99L, 4F substantive, 182L/7F incl. docs/generated/snapshots — within ceiling
tier T1-agent / T1c-medium (182L, 7F, single-area, fix)
stamphog 2.0.0b4 .stamphog/policy.yml @ aa7b182 · reviewed head 24d52e4

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Aug 14, 2026
@trunk-io
trunk-io Bot merged commit 4713d51 into master Aug 14, 2026
302 checks passed
@trunk-io
trunk-io Bot deleted the claude/scouts-work-duplicate-slack-0x0cg8 branch August 14, 2026 17:31
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-14 18:06 UTC Run
prod-us ✅ Deployed 2026-08-14 18:28 UTC Run
prod-eu ✅ Deployed 2026-08-14 18:30 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewhog ($$$) Reviews pull requests before humans do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants