Repository navigation
Conversation
- Schedule sequence enrollment from the first published email’s delay - Clarify sequence and broadcast delay semantics in MCP and docs
Adds a multi-day journey test that drives enroll -> poll -> send with a faked clock, so a first email that ignores its delay fails a test. Before sending a sequence email, check that the contact's entry time plus the delays so far has passed; if not, log a warning and send `sequence_email_sent_early` to PostHog. Report only: the email still goes out. Skipped when an email involved changed after the contact entered. Enrollment now stamps created_at from the app clock the check uses.
A sequence that has sent nothing can still have contacts waiting for a delayed email, which "Sent" alone hid. - Stats gain a Waiting figure; each email row shows "N waiting". - Clicking the count opens a dialog listing the waiting contacts with their own due times, soonest first, with search by email or name and cursor paging. - API: GET /sequences/:id/schedule and GET /sequences/:id/emails/:emailId/waiting (q, after, limit; 400 invalid_cursor). MCP: get_sequence_schedule and list_sequence_email_waiting_contacts. - Index ongoing_sequences (sequence_id, next_email_scheduled_time, id) so a sequence's list doesn't walk other sequences' rows (427 ms -> 0.4 ms worst case at 100k waiting). - SequenceEmailList gains renderEmailDetail. - Docs for sequences, MCP and the component.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A sequence whose only email was set to 13 days showed "Sent 3" the day after it was activated. Enrollment set the first send to "now", and the first email's delay was never read: only follow-up emails waited their delay.
Fix (
e1e09a1)delayInMillisdescription say where delays count from.Guardrails (
d5948e5)setSystemTime). It fails if the fix is reverted.sequence_email_sent_early(sequence_id,email_id,ongoing_sequence_id,early_by_ms) to PostHog. The email still goes out. Skipped when an email involved changed after the contact entered.Visibility (
b45c23d)GET /sequences/:sequenceId/scheduleandGET /sequences/:sequenceId/emails/:emailId/waiting(q,after,limit; a cursor that can't be read returns 400invalid_cursor).get_sequence_schedule,list_sequence_email_waiting_contacts.SequenceEmailListgainsrenderEmailDetail.Migration
0030_waiting_contacts_indexaddsongoing_sequences (sequence_id, next_email_scheduled_time, id). Without it, a sequence's list walks every other sequence's rows in the global due-time index.It's a plain
CREATE INDEX, because drizzle runs migrations in a transaction, and it blocks writes toongoing_sequenceswhile it builds. That took about 1 s for 500k rows. Check the production row count before deploying. If it's in the millions, build the index by hand withCONCURRENTLYfirst.Testing
bun test --parallel src(api): 959 of 960 pass. The one failure is the pacing test "(Scope new-account pacing to the risk: don't throttle a customer's own ESP by account age #122)", which times out under parallel load and does the same onmain.bun run test(web): 110 pass.test:conformanceandcheck:driftpass.Follow-up
sequence_email_sent_early.