Skip to content

docs(legal): say what notifications keep and who delivers them - #8

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/15-implement-https-github-com-hyperstructur
Oct 18, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/15-implement-https-github-com-hyperstructur

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

app.fctl.sh now sends web push notifications (hyperstructure/fctl#4, hyperstructure/fctl#48), so the privacy policy says what that keeps, who delivers them and for how long:

  • What we collect: for each browser where someone turns notifications on, its push subscription (the address its push service delivers to and the keys notifications are encrypted with), its name, and when it was added and last notified; which sessions they follow; and what they want to be notified about. The browser keeps a note of which account turned them on, and the app's service worker shows them.
  • Why: sending the notifications people turn on is part of running app.fctl.sh for them (contract).
  • Who else receives it: the browser's push service (Google for Chrome and most browsers built on it, Mozilla for Firefox, Apple for Safari, Microsoft for Edge). Notifications are encrypted for the browser, so the push service learns when one is sent, to which subscription and how big it is, not what it says.
  • How long: a subscription until notifications are turned off there or the browser is removed in Settings, the person signs out of that browser or its browser session expires, or the push service says it expired. A notification waits about a minute at most before it goes out and isn't kept afterwards. Follows last until unfollowed or the session is deleted; settings until the account is deleted.
  • Your rights: the export includes notification settings, browsers and followed sessions; Settings → Notifications is where to change them.

updated is now 2026-10-18. #5 changes the last line of the "Cookies and browser storage" paragraph; this change leaves that paragraph alone so the two merge cleanly (both set the same date).

Checked with npm run check and FCTL_DOCS_DIR=<fctl checkout> npm run build, which renders /privacy with the new text. Text only, so no screenshots.

Made in fctl session https://app.fctl.sh/s/ses_01M56C5VTFNC4JGZ8XVFW36J3G

app.fctl.sh sends web push notifications (hyperstructure/fctl#4): it
keeps each browser's push subscription, the sessions people follow and
what they want to hear about, and browsers' push services deliver the
encrypted notifications.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kalaspuff
kalaspuff merged commit 146c3de into main Oct 18, 2026
3 checks passed
@kalaspuff
kalaspuff deleted the fctl/15-implement-https-github-com-hyperstructur branch October 18, 2026 03:22
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Oct 18, 2026
fctl now tells people when a session needs them. A session that finishes
a turn and waits for a reply, pauses on a Claude usage limit, or fails
sends a web push notification to the people who follow it, in every
browser where they turned notifications on. Starting or resuming a
session follows it; anyone who can see a session can follow it from its
page or with `fctl follow`. Several notifications that arrive close
together go out as one digest, at most one a minute. Settings →
Notifications chooses what notifies you.

Fixes #4

## What happens

1. **SessionDO** sees the change: `running` → `idle` (a finished turn; a
resumed session that idles without a turn doesn't count), anything →
`paused`, anything → `failed`. It leaves out people who can see the
session right now (the web app now reports whether its tab is visible)
and whoever interrupted the turn, and asks D1 for the other followers
who can still see the session (access is checked at send time, so
leaving a project stops its notifications), want this kind of news, and
have a browser for it. A finished turn carries the start of the agent's
last message; a failure says why.
2. Each recipient's **NotifyObject**, a new Durable Object per person,
holds the news for ten seconds so that a burst goes out as one, and
sends at most one notification a minute: what arrives in between goes
out together ("3 sessions need you"). Before sending it drops sessions
that moved on, such as one that got a reply. Its alarm does the timing,
and it deletes what it stored once that is sent.
3. **The control plane encrypts** each message for each browser (RFC
8291, `aes128gcm`) and posts it to the browser's push service with a
VAPID token (RFC 8292). The instance makes its VAPID key on first use
with WebCrypto and keeps it in D1's `settings`, sealed with the master
key, so there is nothing to configure and no push provider account.
WebCrypto does ECDH and ECDSA; the rest of the encryption is pure Rust
in `fctl_domain::webpush`, checked against the RFC's worked example. A
push service that answers 404 or 410 gets its subscription deleted; a
message about one session carries a `Topic`, so a newer one replaces it
at the push service while the browser is offline.
4. **The service worker** (`web/public/sw.js`, main's offline/install
worker plus push and click handlers) shows it. A click opens the
session, in an app window that is already open when there is one; a
digest closes the notifications about the sessions it sums up.

The decision record is [ADR
0010](docs/adr/0010-notifications-are-web-push-from-a-durable-object-per-person.md);
docs/architecture.md has a Notifications section.

## Following, settings and browsers

- `session_followers` (migration 0007): the starter of each existing
session follows it. Starting or resuming a session follows it unless the
person turned "Follow the sessions I start or resume" off.
- `notification_settings`: waits for my reply, pauses on a usage limit,
fails (all on by default), and the follow-on-start switch.
- `push_subscriptions`: a browser's endpoint and keys, tied to the
sign-in that made it (`token_id`, `ON DELETE CASCADE`): signing out,
revoking or the sign-in's expiry deletes it, so another account signing
in on that browser doesn't inherit notifications. The web app
re-registers its subscription at start-up, so a new sign-in or new keys
carry over, and ends one another account made. Endpoints must be
`https://` addresses of named hosts (development allows local ones), at
most 20 per person.
- The account export includes notification settings, browsers and
followed sessions; deleting an account deletes them.

## API and CLI

| | |
|---|---|
| `PUT`/`DELETE /api/v1/sessions/{id}/follow` | follow or unfollow;
`Session.following` says whether you do |
| `GET`/`PATCH /api/v1/me/notifications` | settings, browsers, and the
VAPID public key |
| `POST /api/v1/me/notifications/devices`, `DELETE …/devices/{id}` |
turn a browser on or off |
| `POST /api/v1/me/notifications/test` | a test notification to your
browsers |

```
fctl follow my-app#12 / fctl unfollow my-app#12
fctl notifications status | set --waiting off | test | remove psh_…
```

## Web app

- **Settings → Notifications**: turn them on in this browser (with the
permission prompt), send a test, turn them off; switches for each kind
and for following what you start; the browsers that get them. On an
iPhone or iPad outside the Home Screen app it explains how to add fctl
there (Safari only offers web push to Home Screen apps; main's manifest
makes that possible).
- **The session page**: a bell follows or unfollows, on the accent tile
while you follow. On phones it is in the ⋯ menu, so the title keeps its
room.
- Signing out unsubscribes the browser.

## Compatibility

- `Session.following`, the viewer message `visibility` and every new API
type are additive and optional. Hosts and agents don't change.
- Deploying adds the `NOTIFY` Durable Object binding and migration tag
`v3` (`wrangler.toml` and the rendered deploy config), and D1 migration
`0007_notifications.sql`, which `cargo xtask deploy` applies first.

## Verification

- `cargo xtask check` passes (fmt, generated types, Biome and
TypeScript, Clippy native and wasm, all tests, the production web
build).
- New tests: RFC 8291's example encrypted byte for byte, VAPID tokens,
push service answers, endpoint and key validation; which transitions
notify, recipients (access, settings, watchers), digest timing,
excerpts, single and digest messages and their size limits; settings
defaults; the service worker run in a stand-in scope (showing, digests
closing notifications, unreadable pushes, click handling); key helpers
in `push.ts`; browser names (iPhones were labeled macOS before, fixed
while moving the helper).
- `cargo xtask dev`, with a stand-in push service in Node that verifies
each request's ES256 VAPID signature, `aud` and `exp` with the key in
the request, and decrypts the body with the subscriber's private key:
- a test notification arrives decrypted; a subscription answered with
410 is deleted;
- a finished turn arrives 10 s later with the agent's last words and the
session as `Topic`;
- three sessions finishing within a minute of the last notification
arrive as one digest exactly 60 s after it; a pause and a recovered
crash arrive as a mixed digest ("2 sessions need you");
- a session crashing until it fails sends one "failed" notification with
the reason, replacing its earlier "waiting" ones;
- nothing goes to someone watching the session with a visible tab; a
hidden tab gets it; the person who interrupts a turn doesn't;
unfollowing, or turning "waits for my reply" off, stops it;
- a reply made 5 s into the gather window drops the stale "waiting"
notification, and the reply's own turn notifies 10 s after it ends.
- **A real browser through a real push service**: Firefox 157
(Playwright, under Xvfb) turned notifications on from Settings,
subscribed through Mozilla's push service, and its service worker showed
the test notification and a session's "waits for your reply"
notification, sent by the dev control plane. Mozilla accepted the VAPID
signatures and the encryption.
- Not tried: Chrome or Edge with Google's or Microsoft's push service
(Chromium builds without Google API keys can't subscribe), and a real
iPhone, Android phone or Mac.

## Screenshots

At 9e6aad6, Chromium and Firefox against `cargo xtask dev`. This fctl
session can't attach images (#40), so they are described here:

- **Session header, before and after, dark and light (1280 px)**: after
adds the bell left of Share. While you follow, it is a ringing bell on
the accent tile (yellow on dark, ink on lime in the light theme);
otherwise an outline bell like the other icons.
- **Session page after unfollowing (dark)**: the plain bell and the
toast "You no longer get notifications about this session".
- **Settings → Notifications, dark and light**: "On in this browser ·
Firefox on Linux" with Send a test and Turn off; the switches under
"Notify me when a session I follow" and "Follow the sessions I start or
resume"; "Browsers that get them" with "this browser" marked; the note
that several close together come as one.
- **Phone (390 px)**: the Settings section stacks under its heading; the
session header keeps three icons and the ⋯ menu has "Stop following".

## Related

- hyperstructure/fctl-site#8: the privacy policy says what notifications
keep, that browsers' push services deliver them, and how long things are
kept.
- Not in this change: email notifications (on the roadmap next to this
item), and notifying when a session stops because its runner went away
(it is `stopped`, not `failed`).

Made in fctl session
https://app.fctl.sh/s/ses_01M56C5VTFNC4JGZ8XVFW36J3G

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant