Repository navigation
Count only real replies, keep our own domains out, write real subject lines - #172
Merged
Merged
Conversation
… lines
Replies: a human message counts only when its In-Reply-To/References names a
Message-ID we sent, or it comes from an address we wrote to under a reply
subject. The only "reply" in 1,247 prod sends was 20 Porkbun receipts matched
on address alone; migration 0067 refiles them as automated.
Own domains: ownDomains spans the organization's offerings, members and
mailboxes (skipping webmail, shared hosts and RFC 2606 names), and card
creation skips people on those domains, so no intake path queues our products.
Subjects: every cold email went out as "Quick question about {Company}"
because the composer was told never to write one. Email drafts now carry a
model-written subject, checked for grounding and shape; a failing one falls
back to the old default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Why
Prod numbers (2026-10-12), Anthony's workspace:
What
receive-email.ts: a human message counts as a reply only if In-Reply-To/References names a Message-ID we sent (actions.external_id). If the reply comes from a colleague's address, it is still attributed to the thread's person. Fallback when headers are stripped: an address we wrote to and a reply subject (Re:/Aw:/SV:/回复…). Bounce and auto-reply filing is unchanged.recipient-guard.ts:ownDomainsnow covers offerings across the organization, plus members' and sending mailboxes' domains. It skips webmail, shared hosts (github.com, vercel.app…) and RFC 2606 names. NewpersonOnOwnDomain.pipeline.ts: card creation skips people on our own domains, which covers every intake path and every network.composer.ts/draft.ts: email drafts get a model-written subject (2–6 words, about their specific thing). It is checked for grounding, template phrases, fake "Re:", "!", caps, emoji and naming our product. A subject that fails is dropped and the existing default is used.automated. A prod dry run matched exactly the 20 Porkbun rows.Tests
New tests: the Porkbun receipt, threaded colleague replies, foreign References,
threadIds/isReplySubject, org-wideownDomains,personOnOwnDomain, subject split/drop/fallback, andsubjectProblem. Locally: receive-email, recipient-guard, social-intake, composer, draft and composer-reply all pass; typecheck and format are clean. The full suite was left to CI (Postgres), since the local SQLite run is too slow.Not in this PR
The 694 pending and 187 queued email drafts have no subject and will still use the default until they're redrafted.
🤖 Generated with Claude Code