Skip to content

fix(sessions): dedupe cloud completion notifications#3572

Merged
richardsolomou merged 4 commits into
mainfrom
posthog-code/fix-cloud-completion-notifications
Jul 20, 2026
Merged

fix(sessions): dedupe cloud completion notifications#3572
richardsolomou merged 4 commits into
mainfrom
posthog-code/fix-cloud-completion-notifications

Conversation

@richardsolomou

@richardsolomou richardsolomou commented Jul 20, 2026

Copy link
Copy Markdown
Member

Problem

Cloud runs can write duplicate turn_complete entries for the same prompt. SessionService treated every live entry as a new completion, so one task could trigger two toasts and two sounds. Completion notifications should follow the prompt lifecycle, not the raw event count.

Changes

I only send the completion notification while the cloud turn is still active. Duplicate and unarmed completion entries can still update idle state without notifying, with regression cases covering both sequences.

How did you test this?

  • pnpm --dir packages/core exec vitest run src/sessions/cloudTaskUpdateNotifications.test.ts
  • pnpm exec biome lint packages/core
  • pnpm --filter @posthog/core typecheck

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 456e7b37-67a4-4163-a9c9-749c5ff36cbe
@trunk-io

trunk-io Bot commented Jul 20, 2026

Copy link
Copy Markdown

😎 Merged manually by @richardsolomou - details.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 84fcbab.

@richardsolomou
richardsolomou marked this pull request as ready for review July 20, 2026 06:18
@richardsolomou
richardsolomou requested a review from a team July 20, 2026 06:19
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(sessions): dedupe cloud completion n..." | Re-trigger Greptile

Comment thread packages/core/src/sessions/sessionService.ts Outdated
@posthog

posthog Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Visual changes approved by @richardsolomou — baseline updated in 84fcbab.

View this run in PostHog

1 changed.

Generated-By: PostHog Code
Task-Id: 456e7b37-67a4-4163-a9c9-749c5ff36cbe
richardsolomou and others added 2 commits July 20, 2026 14:06
1 updated
Run: ad8db4b1-d88d-42ea-a362-ce200a22839c

Co-authored-by: richardsolomou <2622273+richardsolomou@users.noreply.github.com>
@richardsolomou
richardsolomou merged commit 95b90f0 into main Jul 20, 2026
29 of 30 checks passed
@richardsolomou
richardsolomou deleted the posthog-code/fix-cloud-completion-notifications branch July 20, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants