Skip to content

fix(workflows): keep held sends the email queue delays past the hold - #128093

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/workflows-frequency-cap-hold-continuation
Nov 11, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/workflows-frequency-cap-hold-continuation

Conversation

@mayteio

@mayteio mayteio commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

  • A held marketing email that claimed a frequency cap slot can be dropped if the email queue delays it past the hold deadline.
  • The run log then says no slot opened, and the claimed slot is wasted. Raised by Parameter on #127579.
  • No project is exposed yet: holding is opt-in and the setting has not deployed.

Changes

  • The expired-hold check now ignores an email queue continuation, because that send already passed the cap before its deadline.

How did you test this code?

Test rationale: A new handler test runs a continuation with a past deadline. It fails if the check skips the send again.

Release status

  • No feature flag controls this change

Docs update

  • None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, claude-opus-5-5

Skills: /writing-tests, /writing-pr-descriptions

More context for AI agents
  • Session: PostHog Desktop cloud task, Customer.io to Workflows cutover.
  • Read closely: frequencyCapHoldExpired in hog_function.ts.

Created with PostHog Desktop from a PostHog Desktop task

🤖 Generated with Claude Code

A held send that claimed a frequency cap slot before its deadline could be dropped if the email queue delayed it past the deadline. The expired-hold check now skips email queue continuations, which already passed the cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 436ae568-8289-4257-b029-99ab5ab69aac
@mayteio mayteio added the stamphog Request AI approval (no full review) label Nov 3, 2026
@mayteio mayteio self-assigned this Nov 3, 2026
@trunk-io

trunk-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@parameterai

parameterai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Risk: No findings

This PR stops the workflows email pipeline from dropping a held marketing send when the email queue delays it past its frequency-cap hold deadline: the expired-hold check now ignores continuations (invocations with hogFunctionState), so the send re-runs the atomic, per-visit idempotent frequency-cap check instead of being skipped. I traced the check, the Redis Lua slot script, and the action-state lifecycle and found no cap bypass, double-claim, or stale-state path.

Sentinel reviewed 8539886 · Review settings

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team November 3, 2026 10:51
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

@stamphog stamphog 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.

Approved.

The messaging write-path change has owning-team and STRONG-familiarity authorship assurance, with a targeted regression test. No substantive review concerns or other refusal grounds are present.

  • Author wrote 100% of the modified lines and has 5 merged PRs in these paths (familiarity STRONG).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 9L, 1F substantive, 30L/2F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1b-small (30L, 2F, single-area, fix)
stamphog 2.7.0 .stamphog/policy.yml @ 8539886 · reviewed head 8539886

@mayteio

mayteio commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit f845ed0 into master Nov 11, 2026
242 of 245 checks passed
@trunk-io
trunk-io Bot deleted the posthog/workflows-frequency-cap-hold-continuation branch November 11, 2026 17:43
@deployment-status-posthog

deployment-status-posthog Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-11-11 18:19 UTC Run
prod-us ✅ Deployed 2026-11-11 18:47 UTC Run
prod-eu ✅ Deployed 2026-11-11 18:50 UTC Run

This table shows the posthog release only. Hogstation shows every service that this PR reaches, Kargo services included.

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

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant