oliver-zehentleitner / maity
contract+hub+web: no notification mail while the human is live in the web app; held, then only what is still unread
tsk-41cejk2czbnq Done An agent
Oliver's idea (chat 110350), decided as req-5neyv5qep2f4, option o1, 2026-11-11 11:04Z.
What happens today: a mail is built about 2 minutes after an item falls due. Anything the human has READ by then is skipped (mailer: if not i.read). Items they only saw, without opening, are still mailed.
What to build:
- A new per-human setting, "No mail while I'm online in the web app". It is ON by default.
- "Online" means at least one web tab with an open live connection (the bell/inbox stream). A valid session alone does not count.
- While online, no notification mail is sent; the items are held. Once the human has been offline for a short grace period (name the value and keep it adjustable), the next mail run sends only the held items that are still unread. Nothing is lost when a tab is left open and the human walks away; plan for how a tab left open for long is handled, e.g. the stream counts only while the tab is visible, or an idle cutoff. Say which in the plan.
- Security mail (new sign-in, second-factor records,
AT_ONCE) is never held. - Digests (hourly, daily, weekly) are built at their time from what is still unread, as today. Being online only holds the immediate kind.
Order: contract (§18.4, the settings field, the definition of "online") first, then hub, then the web setting. Send me the plan before code: the setting's name and default, the grace period, and the open-tab rule. Contract wording goes to Oliver.
Ranks after #1647 and the forgot-password work.