Skip to content

ONRAMP-6068 spike — synthesis and recommendations ​

Written 2026-08-10 against main 24864a73a5 for ONRAMP-6068. Code line numbers are stale; current facts live in the ONRAMP-7078 stories.

Run 2026-08-10 against main 24864a73a5. Three parallel investigations; this file is the one-pager the story asks for. Detail lives in the sibling reports and is not repeated here:


Verdict: GO on reply-by-email v1 — but the decision order inverts ​

The spike's headline is not which vendor wins. It is that the vendor choice is gated on a measurement that needs no infrastructure and can run this week.

D1 recommends SES inbound receipt rules (classic receiving, us-west-2 — verified as an SES email-receiving region), conditional on a pre-registered parse-quality threshold: at or above 90% clean extraction we ship SES; below 80% we buy the vendor's stripped-reply. D3 then establishes that the benchmark measures what the replying client produces, which does not depend on how mail reaches us — so a human can send real nudges through the existing POST /tasks/nudge_email, reply from each client, and save the .eml files by hand. Roughly 2–4 hours with five mailboxes.

Consequence for sequencing: run the corpus exercise before committing to a transport. The epic's plan of record treats parse quality as a risk to be discovered during W3. It is measurable now, for the cost of an afternoon, and it decides a vendor contract. That is the single most valuable thing to come out of this spike.

The risk D3 names is that this gets deferred behind the infrastructure it does not depend on. Guard against that explicitly.

Token scheme: settled, and it does not block on E3 ​

DB-backed opaque tokens, hashed at rest. or_email_action_token keyed on a token_hash (sha256, unique), with purpose, tenant and entity scoping, expiry, and consumption columns; every column Internal[...], no __sql_tool_policy__, no PortalAccessible, no or_readonly grant. Full column list in the D2 report. A companion or_inbound_email table stores raw MIME plus SPF/DKIM verdicts for audit and parse debugging.

Two things worth pulling forward:

The plan had a real gap. PLAN.md §5.2 mints one row per option button and never invalidates siblings — so a recipient could click "Yes", then click "No" from the same email, and both would succeed. D2 fixes it with a mint_group_uuid that consumes the whole minted set atomically. That is a correctness bug in my own design, caught by the spike.

E3 is not a W3 blocker. Nothing outside preview_token.py reads SECRET_KEY, so its forgeability is irrelevant to a DB-backed scheme. ONRAMP-6137 stays worth doing on its own merits — preview and impersonation logins are forgeable today — but it does not gate 6070/6073/6074.

Addressing deviates from the brief twice, both for good reasons: r-<48 hex>@reply.onramp.us uses a hyphen rather than + (plus-tag stripping by intermediaries) and token_hex rather than token_urlsafe (mixed-case local parts get normalized by some agents, which would silently drop replies). Receive-only subdomain, single-domain for all orgs, per-env via the config map with a separate gdpr-reply for eu-west-1 residency.

Ingestion: the brief posed a false choice ​

D5's finding is that "synchronous vs durable" is not a tradeoff we have to make, and this repo already proves it — the DocuSign receiver is synchronous and durable and has an authenticated cron backstop. Recommended shape: SES → S3 (raw MIME durable before Flask is in the picture) + Lambda → HMAC-signed POST → verify → stage → process inline → authenticated backstop drain for anything stranded.

The subtle discipline worth naming here: a failure after staging must still return 2xx, or provider retries turn one flaky parse into duplicate task answers.

Adjudicated: the two reports disagreed about HTML-only mail ​

Both flagged that we send no text/plain part. That is confirmed — Email.py:560 builds a multipart/alternative container and attaches exactly one child, the HTML part (:562); the only two MIMEText sites in the app are both "html".

D1 listed this as the reason a vendor's stripped-reply advantage would not materialize. D3 is right and D1 is wrong on the mechanism: Postmark's StrippedTextReply condition concerns whether the inbound reply carries a text part, which the replying client decides — not what we sent. Do not use D1's risk #2 as an argument about vendor value.

The underlying concern survives in a narrower and still-real form: we hold no lever over how each client down-converts our 8-table, 15KB layout into quoted text, and an HTML-only reply is a total loss for any text-only parser, vendor field included. Adding a text/plain part is worth doing regardless — it is robust to that uncertainty — but it is its own ticket, because part order must be plain-first and the two-pass Jinja render means it cannot be produced by stripping the HTML.

Parser: quotequail + email_reply_parser, layered ​

talon is disqualified, not merely stale: talon-v2 fails to build on Python 3.12 (cchardet needs longintrepr.h, removed in 3.12) and pins scikit-learn 0.24.1. quotequail (MIT, released 2026-05-28) is the only actively maintained candidate and the only one that reads text/html, but it splits quotes without stripping signatures; email_reply_parser does both and is text-only. Layering costs zero net-new transitive dependencies — lxml and typing-extensions are already in uv.lock.

Honest caveat from D3: a 20-line naive baseline outscored both libraries on synthetic scaffolding. If they do not clearly beat regex on the real corpus, the dependency has not earned its place. Another reason to run the corpus first.

Autoresponder detection: two tiers with deliberately asymmetric authority ​

Tier A (headers — RFC 3834 Auto-Submitted, X-Auto-Response-Suppress, Precedence, X-Autoreply, List-Id, null Return-Path, multipart/report, robot localparts) is reliable and permitted to discard. Tier B (out-of-office and bounce prose, first 600 characters only) fires on genuine prose and may therefore only downgrade to hold-and-post-as-comment, never discard. That caps a Tier-B false positive at "a CSM reads one comment" and lets it be tuned for recall. Tier B is not optional — header-less Exchange out-of-office replies are invisible to Tier A.

The harness caught a bug in D3's own first rule set that is worth inheriting as a test: an absent Return-Path matched the null-Return-Path rule, flagging every human reply as automated at 29% precision. That failure shape silently discards every real answer while looking like a working filter. Pin it before writing the rules.


What this changes in the plan of record ​

  1. Open question 12 (render digests at drain) is load-bearing, not a follow-up. Measured July production volume: the §6 scope decision confines one-click to 7,006 customer-facing sends/month out of 95,249 reply-eligible (7.4%). The excluded digests are 82,683 (87%), with weekly_summary alone at 51,618 across 112 vendors, and the hero task_nudge_reminder is 2,327 — 1.4% of all mail. The infrastructure lift should be weighed against 7.4% reach, or open question 12 should be pulled into scope so it is weighed against 94%.
  2. A hard blocker nobody had listed: infra/ci-identity/boundary-policy.ts grants no SES action at all, so any Pulumi-created SES resource is denied today. Fixing it is an admin-applied bootstrap change to the permissions boundary, and it appears in no planning document.
  3. EU/GDPR inbound residency is raised nowhere in the epic. D2 proposes a separate gdpr-reply subdomain in eu-west-1; someone needs to own that decision.
  4. or_email_tracking.recipient_id is NULL in 100% of production rows — there is no writer (Email.py:526-533 never passes it). Any funnel correlation design that assumed that column works needs to lean on transaction_id instead, which is populated and unique.
  5. Trust the SQL-tool CI gate, not the skill's docstring. The gate walks every ORM model and fails unclassified columns regardless of whether the table is exposed (test_sql_tool_classification_gate.py:114-128). The skill's own docstring says otherwise; an implementer who believes it ships red CI.
  6. The EasyCron registration list carries URLs, not schedules, so nudge/digest cadence is not derivable from this repo. Token TTLs are anchored on in-repo constants instead; if real cadence matters, it has to come from the EasyCron console.

Immediate next actions, in order ​

  1. Gather the parse corpus (2–4 hours, no infrastructure, no blockers). It gates the D1 vendor decision and the parser choice simultaneously.
  2. Decide open question 12 before committing to inbound infrastructure, on the volume evidence above.
  3. Get the SES permissions-boundary grant applied — long lead time, admin-gated, currently unowned.
  4. Ratify the security decisions a human owns: reply-token writable TTL (30d vs 14d proposed), sender-mismatch policy (hold-for-review proposed), and the attachment limits, which are net-new policy rather than an inheritance from the portal.
  5. ONRAMP-6138 must land before the attachment half of 6073. The spike found that task-file S3 uploads key on the raw caller-supplied filename in a flat global namespace, so one org can overwrite another's file — and inbound email would hand that filename choice to an unauthenticated sender.

Internal documentation — gated behind Cloudflare Access.