Skip to content

feat: notify people when a session waits for them, pauses or fails - #48

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

kalaspuff merged 8 commits 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

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. Push services see when a message goes, to which subscription and how big it is; nothing else goes unencrypted (no Topic header, which would name the session).
  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/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. At start-up the web app ends a subscription the server no longer has for its sign-in (removed in Settings from any device, or the sign-in ended), so a removed browser stays removed, and subscribes again if the instance's VAPID key changed. Endpoints must be https:// URLs on DNS names (no IP addresses in any notation, no localhost; 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; a push service that refuses says so in a sentence, with a pointer for Brave), 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;
    • 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. A Firefox removed through the API while it was away stayed removed when the app opened there again (it unsubscribed itself).
  • Revoking a browser's sign-in deletes its subscription (D1 cascade); migration 0007 on a database with sessions makes their active starters follow them, and runs again harmlessly.
  • An independent review of the diff found no high-severity problems; its three medium and five low findings are fixed in af05458 (digests replacing each other on screen, out-of-order events, removed browsers coming back, IPv4 in other notations, turn ends during a host reconnect, following failing a session start, the export listing sessions people can no longer see, session ids in Topic).
  • 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

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

fctl-sh Bot and others added 8 commits October 18, 2026 02:27
fctl-proto: notification settings, push devices (Web Push subscriptions)
and the push payload; Session.following; a viewer message that says
whether the session's tab is visible.

fctl-domain: RFC 8291 message encryption (checked against the RFC's
example) and VAPID tokens (RFC 8292) around WebCrypto's ECDH and ECDSA;
which status changes notify, who hears about them, what they say, and
when a burst becomes one digest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A session that finishes a turn, pauses on a usage limit or fails tells
its followers' NotifyObjects (a Durable Object per person), except people
who can see it right now and whoever interrupted the turn. The object
gathers a burst for ten seconds, sends at most one notification a minute
(several become a digest), drops sessions that moved on meanwhile, and
encrypts each message for each browser (RFC 8291) with the instance's
VAPID key, which it makes on first use and keeps sealed in D1.

Starting or resuming a session follows it, unless the person turned that
off; anyone who can see a session can follow it (PUT/DELETE
/sessions/{id}/follow). /me/notifications holds the settings, the
browsers (push subscriptions, tied to the sign-in that made them) and a
test notification. The export and account deletion cover all of it.

CLI: fctl follow, fctl unfollow, fctl notifications status|set|test|remove.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…page

A service worker (public/sw.js) shows the notifications the control plane
sends and opens what a click is about, in an open app window when there
is one. Settings → Notifications turns them on for this browser, sends a
test, lists the browsers that get them and chooses what notifies you. The
bell on a session's page follows it. The session page tells the server
whether its tab is visible, so people who are looking at a session are
not notified about it; signing out ends this browser's subscription.

A web app manifest lets iPhone and iPad add fctl to the Home Screen,
where Safari allows web push.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Notifications and an iPhone's Home Screen need raster icons, and
@hyperstructure/design ships the mark as SVG. The web build draws the app
icons, the Apple touch icon and an Android notification badge from the
package's favicon, so the mark keeps one source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Notifications use main's service worker, manifest and design icons (v0.2.0)
in place of this branch's: the worker shows notifications besides the
offline page, and the icons drawn from the mark go.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Oct 18, 2026
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

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
@kalaspuff
kalaspuff merged commit ca134aa into main Oct 18, 2026
4 of 5 checks passed
@kalaspuff
kalaspuff deleted the fctl/15-implement-https-github-com-hyperstructur branch October 18, 2026 03:23
kalaspuff pushed a commit that referenced this pull request Oct 18, 2026
…er (#52)

Follow-up to #48, which was merged before these commits reached it. An
independent review of #48 found no high-severity problems and three
medium and five low ones; this fixes all of them, and words a refused
subscription plainly.

**Medium**

- **Digests replaced each other on screen.** Every digest had the tag
`digest`, so a second one replaced a first that was still shown, and
that one's sessions disappeared from the notification tray. Each digest
now has its own tag (`digest-<time>`); a digest still closes the older
notifications of the sessions it sums up.
- **An older change could overwrite a newer one.** A session's status
changes reach its followers' NotifyObjects from separate background
tasks, so two close together (a turn ends, then Claude exits for the
third time and the session fails) could arrive in reverse order, and the
stale "waiting" replaced "failed", which was then dropped. The pending
upsert keeps the newer one (`WHERE excluded.at >= pending.at`).
- **A removed browser came back.** Removing a browser in Settings (or
with `fctl notifications remove`) deleted its subscription on the
server, but the browser still held it, and start-up sync posted it again
the next time the app opened there. Start-up sync now never re-creates a
subscription: if the server no longer has one for this browser's sign-in
(removed, or the sign-in ended), the browser ends its subscription too
and Settings shows "Off in this browser". It still subscribes again with
a new VAPID key, replacing its own entry.

**Low**

- Push endpoints must be on DNS names whose top-level domain starts with
a letter: IPv4 in other notations (`127.1`, `0x7f.0.0.1`, `0177.0.0.1`),
`localhost` and trailing dots no longer pass.
- A turn that ended while the host was reconnecting notifies when its
result is replayed into a session that is already idle. A host reports
its state before it replays the events it kept, so the status change
alone missed it or quoted the turn before.
- Following a session you start or resume is best effort: a failure
there no longer leaves the session unscheduled.
- The account export lists only the followed sessions you can still see.
- No `Topic` header: it showed push services the session id unencrypted.
- Docs: `fctl attach` counts as watching (docs/cli.md); the ADR's
example of a burst; how start-up sync treats a removed browser
(architecture, ADR).
- A push service that refuses a subscription gets a sentence in Settings
("This browser's push service didn't take the subscription (…)"), with a
pointer for Brave, which turns push off by default. ROADMAP links #49
for email.

## Verification

- `cargo xtask check` passes. New tests: unique digest tags; the
endpoint check refuses `127.1`, `0x7f.0.0.1`, `0177.0.0.1`, `localhost.`
and trailing dots and still takes FCM, Mozilla, Apple, Windows and IDN
hosts.
- The upsert in SQLite: a newer change arriving first is kept when the
older one arrives late.
- `cargo xtask dev` with the stand-in push service: a finished turn
still notifies, now without `Topic`.
- Firefox through Mozilla's push service: turned on in Settings, removed
through the API, page reloaded: the browser unsubscribed itself,
Settings showed "Off in this browser", and it didn't reappear among the
browsers.
- Headful Chromium (no Google API keys, so its push service refuses):
Settings shows "This browser's push service didn't take the subscription
(Registration failed - permission denied)."

## Screenshots

At e1dc27e, headful Chromium (whose push service refuses here) on
Settings → Notifications, dark, 1280 px. This fctl session can't attach
images (#40), so they are described:

- **Before**: the error banner under "Off in this browser" reads only
the browser's message, "Registration failed - permission denied".
- **After**: it reads "This browser's push service didn't take the
subscription (Registration failed - permission denied)."

Refs #4

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]>
kalaspuff pushed a commit that referenced this pull request Oct 18, 2026
)

Every host built the default sandbox image itself with `fctl host image
build`, and its Claude Code stayed as old as that build, since fctl
turns off Claude Code's auto-updater. #2 asks for CI to publish the
image instead, for arm64 and amd64, under a stable name with version
tags and labels, rebuilt when Claude Code moves on, with a documented
layout that custom images (#16) can build `FROM`; hosts on the default
image pull the tag of their own version.

The image now lives in a public repository of its own,
[hyperstructure/sandbox](https://github.com/hyperstructure/sandbox) (set
up in hyperstructure/sandbox#1), which publishes it as
`ghcr.io/hyperstructure/sandbox`. This pull request makes hosts pull it
and takes the image out of this repository.

## What changed

**The image moves to hyperstructure/sandbox.** `images/agent` (the
Dockerfile, `provision.sh`, `check.sh`) and the Image workflow leave
this repository; hyperstructure/sandbox#1 adds them there, with a
README, AGENTS.md, skills, lint and title checks. Its Image workflow
keeps what this pull request had built: each architecture builds on a
native runner and is checked with `check.sh`, then both are tagged as
one image.

- `ghcr.io/hyperstructure/sandbox:<version>` for every fctl release,
plus `:<major>.<minor>` and `:latest` when that release is the newest
they cover. Each is the sandbox's `main` with that release of fctl and
the newest Claude Code.
- It looks for new fctl releases on fctl.sh every hour, rebuilds the
newest release's image as soon as a change to the image merges there,
and every day when Claude Code has a newer release or the image is a
week old. Only its `main` publishes; its pull requests build and check
both architectures.
- Labels and index annotations as before: `sh.fctl.version`,
`sh.fctl.claude-code.version`, and the commit and date it was built
from, which the workflow reads back to decide whether an image is
current.

The Release workflow no longer starts an image build: its token can't
start workflows in another repository, so the sandbox's hourly run
notices the release. Why a separate repository: [ADR
0012](docs/adr/0012-the-sandbox-image-lives-in-its-own-public-repository.md)
(the image has to be public, and it has a cadence of its own). It's 0012
because #55 adds 0011.

**Hosts: `crates/fctl-host`, `crates/fctl`**

- `image` in `host.toml` is optional. Unset, sessions start from
`ghcr.io/hyperstructure/sandbox:<the host's version>`, so upgrading a
host moves its new sessions to the new version's image.
`fctl-agent:latest`, which every host installed so far has in its
`host.toml`, also means the default, in `host.toml` and in project
settings.
- The daemon pulls the host's image in the background when it starts and
the image is missing. A session pulls a missing image itself. Nothing
pulls over an image that is already there, so a local build is kept.
- When the version's image can't be pulled (the hour between a release
and its image, or a development build), a session on the default image
starts from `:latest` and says so in its log. A failure that isn't about
the image (the image is there but `run` fails) no longer tries a pull.
- Apple's `container image pull` gets `--platform linux/<the host's
architecture>`. Without it, Apple's CLI downloads every platform of a
multi-arch image (`DefaultPlatform.resolve` in apple/container).
- `fctl host image build` downloads an archive of the sandbox's `main`
from GitHub and builds its Dockerfile with the host's driver, under the
host's image name so sessions use the build, or gives the Lima VM its
`provision.sh`. `--source DIR` builds from a checkout instead, to try
changes to the image with fctl. The binary no longer carries the files.
- CLI: `fctl host image pull` (new, `--json`) pulls the host's image
again, for a newer build of its tag. `install` says which image sessions
start from, `status` (and `--json`) shows it, `doctor` says whether it's
there, and `install --image ""` goes back to the default.
- A sandbox without fctl now says in its log that the default image has
one, instead of suggesting `fctl host image build`.

**Docs:** `docs/sandbox-images.md` (new) covers the image, its tags and
labels, how hosts get it, and its layout as an interface for images
built `FROM` it: the `agent` user (uid 1000, passwordless sudo),
`~/.local/bin`, `~/.cargo/bin`, `~/.bun/bin` and `/opt/fctl/bin` first
on the PATH, and the tools. It's the "Sandbox images" page #16 asks for,
which #16 can extend; the image's README in hyperstructure/sandbox lists
the versions. Getting started, the CLI, self-hosting, security,
architecture, development and the top-level README say that hosts pull
the image instead of building it. AGENTS.md lists hyperstructure/sandbox
among the other repositories (what the host relies on there, and that
its Rust follows `rust-toolchain.toml`), and the release and issues
skills point to it. The roadmap item is ticked.

**Web:** the runner dialog drops step 3 ("Build the sandbox image"), and
the project's image field shows `ghcr.io/hyperstructure/sandbox` as its
placeholder instead of `fctl-agent:latest`.

## For a person

0.3.0 shipped without this pull request, so the next release (0.4.0) is
the first whose hosts pull the image.

1. **Merge hyperstructure/sandbox#1.** Its Image workflow then publishes
`ghcr.io/hyperstructure/sandbox:0.3.0`, `:0.3` and `:latest` from the
sandbox's `main`, which creates the package.
2. **Make hyperstructure/sandbox public** and apply its settings: the
commands are in hyperstructure/sandbox#1.
3. **Make the package public**: the organization's Packages → sandbox →
Package settings → Change visibility. A package starts private even when
its repository is public, and hosts pull without signing in. The
organization's settings must allow public packages. Until then, sessions
on hosts of 0.4.0 fail with "ghcr.io/hyperstructure/sandbox:0.4.0 is not
on this host and can't be pulled (`fctl host image build` builds it
here)".
4. **Merge this pull request**, then hyperstructure/fctl-site#7 once
fctl's CI has pinned fctl.sh past it (`gh pr update-branch 7 -R
hyperstructure/fctl-site`).

## Compatibility

- No protocol or control-plane change. `HostHello.image`, already
optional, now carries the image the host actually uses. Hosts pick up
the new behavior with the release that includes it; hosts of 0.3.0 and
earlier keep building `fctl-agent:latest` from the files in their
binary.
- `image = "fctl-agent:latest"` in `host.toml` now means the published
image. A host that ran a modified image under that name should rename it
and set `image`, or rebuild it with `fctl host image build`, which tags
it with the default name.
- `fctl host image build` needs to reach github.com, as its build
already needed Debian's mirrors and the tools' installers.
- Hosts keep the images of earlier versions until someone removes them
(`docker image rm …`), as they kept the images `fctl host image build`
replaced. Removing them automatically, and refreshing a tag when its
image is rebuilt, is #47.

## Verification

- **The sandbox's Image workflow** ran on hyperstructure/sandbox#1: both
architectures built natively (amd64 in 2m56s, arm64 in 2m20s) and
`check.sh` passed in each with fctl 0.3.0 and Claude Code 2.1.302
([run](https://github.com/hyperstructure/sandbox/actions/runs/39123588178)).
Its lint (ShellCheck, actionlint) and title checks pass too.
- **Its planning step**, run locally against stubbed fctl.sh,
downloads.claude.ai and registry responses, decides correctly in 19
cases: a pull request; hourly with no image (build), a current image
with an older Claude Code (skip: hourly runs ignore Claude Code), an
image built from the last change to the image (skip) and one from before
it (build), an index without annotations (build); daily with an older
Claude Code or a week-old image (build) and a current one (skip); a push
after a change (build); dispatches of 0.2.0 (no `:0.2`: 0.2.1 exists),
v0.2.1 (`:0.2`), a current image with an older Claude Code (build), a
forced rebuild, another branch (build without publishing), a version
fctl.sh doesn't have and a malformed one (errors); and odd answers from
fctl.sh and downloads.claude.ai (errors).
- **`fctl host image build`** with a stand-in `docker`: `--source` with
a checkout builds it with `FCTL_VERSION=0.3.0` and
`FCTL_DOWNLOAD=https://fctl.sh/releases`. The download path, pointed at
a `git archive` of the sandbox served locally (GitHub's format, with its
pax header), unpacks it, builds `…/sandbox-main` and removes the
temporary directory; pointed at a real GitHub archive of a public
repository, it follows the redirect, unpacks it and says the result has
no `provision.sh`; against the real URL while the repository is still
private, it fails with HTTP 404. Unit tests cover unpacking a
GitHub-style archive and refusing a checkout without `provision.sh`.
- **End to end with the stand-in:** an old `host.toml` with
`fctl-agent:latest` resolves to `ghcr.io/hyperstructure/sandbox:0.3.0`
in `status` and `status --json`; `doctor` reports it "not here yet",
then ✓ after `fctl host image pull --json`.
- **Unit tests:** the config tests cover unset, empty and old-default
images, a custom image and saving. The driver tests use a stand-in
`docker`/`container` CLI with an image store and a registry: an image
already there, a pull, Apple's `--platform`, falling back to `:latest`,
both images missing (with and without a fallback), and a `run` failure
that isn't about the image.
- `cargo xtask check --quick` passes locally on the move and on the
merges with `main` (#48, #50, #52, then #54, #57, #58), and CI's full
`cargo xtask check` passes. The merge with #57 keeps its startup retry
loop and starts the background pull once the runtime answers; a `run`
that times out under #57's limits now fails at once instead of being
taken for a missing image and trying a pull.
- hyperstructure/fctl-site#7, with its `main` merged, builds against
this branch's docs: 8 pages, Sandbox images among them, linking to
hyperstructure/sandbox.
- Earlier on this pull request, before the move: the publish step's
commands against a local registry (one OCI index for both architectures
that all three tags point to, with the annotations) and `fctl host
install --driver docker` with a stand-in, which writes no `image` and
says which image sessions start from.
- **Not verified here:** pushing to GHCR with the sandbox workflow's
token, creating the package and its visibility. They need `packages:
write` on the sandbox's `main`, so merging hyperstructure/sandbox#1 is
their test, well before a release depends on them.

## Screenshots

Sessions can't attach screenshots yet (#40), so here is what they show.
Taken at 7771600 with Playwright against `cargo xtask dev` (before:
`main` from a worktree), in both themes and at 390 px:

- **Runner dialog, "Bring studio mac online":** before, three numbered
steps: 1. Install fctl, 2. Register it as a runner and start the
service, 3. Build the sandbox image (once, a few minutes) with `fctl
host image build`. After, steps 1 and 2 only, and the note under them
reads "It shows up here as online within seconds and pulls the sandbox
image in the background. With Lima, prepare the base VM once with `fctl
host image build`. `fctl host doctor` checks everything, including
whether the Mac is set to never sleep." Both themes and the phone width
wrap cleanly.
- **Project → Settings → Sandbox:** the Image field's placeholder reads
`ghcr.io/hyperstructure/sandbox` (at 7771600 it read
`ghcr.io/hyperstructure/fctl-agent`; `main` has `fctl-agent:latest`).
Nothing else in the section changes. The move changed only this
placeholder's text, which wasn't screenshotted again.

Refs #2

Sessions: https://app.fctl.sh/s/ses_01M56C4589JCHJ2W8TXC8V2S4P,
https://app.fctl.sh/s/ses_01M56FZDD6WY8J56E3TA0SEMZX for merging #45 and
v0.3.0, and https://app.fctl.sh/s/ses_01M57B991V0YYBRJFN0WKEW118 for
moving the image to hyperstructure/sandbox

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
kalaspuff pushed a commit that referenced this pull request Oct 18, 2026
Commits from sessions credited the GitHub App's bot and Claude, never
the person who started the session. People can now choose a commit email
in Settings → Profile (or with `fctl account set --commit-email`), and
the commits in the sessions they start end with a `Co-authored-by`
trailer with their name and that address, so GitHub links the commits to
their account. Without one nothing changes, and the sign-in email never
goes into a commit. Each project chooses who its commits credit, with a
switch for the person and one for Claude.

Refs #15. The privacy policy change it asks for is
hyperstructure/fctl-site#9.

## What changed

- **A commit email people choose** (the issue's proposal). Settings →
Profile has a "Commit email" field whose hint says what it does and who
sees it, and links GitHub's email settings for the noreply address. From
the CLI: `fctl account set --commit-email ADDRESS` (`""` removes it,
`--json` prints `Me`), and `fctl whoami` shows it. It is stored on the
user row (migration `0009_commit_email.sql`), returned in `Me` but not
in `User`, which admins also get, included in the data export, and
cleared when the account is deleted. `validate::commit_email` keeps its
case (GitHub matches it against accounts) and allows only a plain
dot-atom before the `@`, so it can't break a trailer.
- **Projects choose who their commits credit**, with two switches in the
project's settings (Agents), both on by default: **Credit people in
commits** (`credit_people`) and **Credit Claude in commits**
(`credit_claude`). From the CLI: `fctl projects set --credit-people
on|off --credit-claude on|off`, a new command that changes what it's
given and sends the other settings back as they are (an update replaces
all settings). Without people, the control plane doesn't look up the
starter's commit email, so it never reaches the sandbox. Without Claude,
fctl-agent leaves Claude's trailer out of `attribution.commit` (the
person's trailer alone, or an empty string for none) and sets
`attribution.sessionUrl: false`, so Remote Control sessions leave out
the claude.ai session link too (that key came in Claude Code 2.1.183;
fctl-agent writes it only when Claude is off). An update that leaves
either field out keeps its stored value, as for `claude_ai_connectors`,
so a tab opened before the deploy or an older CLI can't turn crediting
back on. The Profile hint says a project can turn it off.
- **A new spec field, `co_authored_by`**, which `creator()` fills with
the starter's name and commit email, only when they chose one. The issue
planned to reuse `co_authors`, but every control plane so far fills that
with the sign-in email, so a new agent reading it would publish the
sign-in email whenever it runs against an older control plane: a host
updated between the Release workflow publishing archives and redeploying
app.fctl.sh, or a self-hosted instance that lags. `co_authors` stays in
the spec, empty, because older agents require it.
- **fctl-agent sets Claude Code's `attribution.commit`** in Claude's
user settings when there is someone to credit:

  ```
  Co-authored-by: Claude <[email protected]>
  Co-authored-by: Ada Lovelace <[email protected]>
  ```

This replaces Claude Code's default trailer, which names the model in
use. fctl-agent writes the settings before Claude starts, so it says
`Claude`, as Claude Code itself does when it can't tell the model's
version. Names lose control characters and angle brackets, and an
address with spaces or brackets is skipped, so each trailer stays one
line. `attribution.commit` came in Claude Code 2.0.62 together with
`attribution.pr`, which fctl already writes, so it can't make an older
Claude Code skip the file. With nobody to credit, the settings are as
before.
- **Pull requests stay plain** (`attribution.pr` stays empty, #23).
GitHub's squash merges carry the `Co-authored-by` trailers of the
squashed commits into the commit on `main`: #48's description has none,
its commits have Claude's, and its squash commit ca134aa ends with it.
So the credit reaches `main` without naming people in descriptions.
- **fake-claude** ends the commit `write <name>` makes as Claude Code
does: with `attribution.commit` from `~/.claude/settings.json`, nothing
when that is empty, or Claude's trailer when it is unset. So `cargo
xtask dev` shows every combination.
- **Docs**: architecture.md (Sessions → Commits), security.md (a Commits
section, and retention), cli.md, getting-started.md, development.md, and
[ADR
0011](docs/adr/0011-commits-credit-people-with-an-address-they-choose.md),
which records the decision and the alternatives the issue weighed (git
hooks, rewriting commits).

## Left as they were

- Only the starter is credited. The issue's open question, whether
people who message a session become co-authors too, is a person's call;
`co_authored_by` can carry more people.
- Commits a script makes get no trailer, and a repository's own Claude
settings (`attribution`) or a CLAUDE.md rule against attribution take
precedence (Claude Code 2.1.269 and later). As the issue suggests, this
starts with the setting to see whether it is reliable enough.
- Sessions take a changed address or project setting when they next
start or resume.

## Compatibility

- The API and protocol changes are additive and optional:
`Me.commit_email`, `UpdateMeRequest.commit_email`,
`SessionSpec.co_authored_by`, and `ProjectSettings.credit_people` and
`credit_claude` (on when absent; an update without them keeps the stored
values).
- Turning Claude's credit off needs hosts from this release: older
agents ignore `credit_claude` and keep Claude's trailer. Turning
people's credit off works with any agent, since the control plane then
sends nobody.
- Older agents ignore `co_authored_by` and add no trailers. Newer agents
ignore `co_authors`, so with an older control plane they add none
either.
- Deploying applies D1 migration `0009_commit_email.sql`, which adds a
nullable column.
- **Privacy policy**: hyperstructure/fctl-site#9 updated fctl.sh's
policy (what is stored, who receives it, how long, where to change it).
It was merged on 2026-10-18 and is live on fctl.sh/privacy, ahead of
this pull request: until this ships, the policy describes an opt-in
setting app.fctl.sh doesn't have yet.

## Verification

- `cargo xtask check --quick` passes: fmt, generated types, Biome and
TypeScript, Clippy (native and wasm), all Rust and web tests.
- New tests: commit email validation (`fctl-domain`); the spec in both
directions of version skew (`fctl-proto`); the settings fctl-agent
writes, and one-line trailers (`fctl-agent`).
- `cargo xtask dev` (process driver, fake-claude), driven with the CLI:
- Without a commit email, the sandbox's `~/.claude/settings.json` has
`"attribution": {"pr": ""}` only, so Claude Code's own trailer stays and
nobody else is credited, and the sign-in email appears nowhere in the
sandbox's data.
- `fctl account set --commit-email "
[email protected] "` stores it trimmed with its
case; `fctl whoami` shows it; `fctl admin users --json` doesn't contain
it; `fctl account export` has it as `account.commit_email`. `Dev
<[email protected]>`, `dev@example` and `"dev"@example.com` are refused
with "Enter a valid email address".
- A new session's commit ends with both trailers; `git log
--format='%(trailers:key=Co-authored-by,valueonly)'` reads both, and
`fctl logs` shows them in the commit's output.
- A session started before the address was set takes it when stopped and
resumed.
- `--commit-email ""` removes it, and the next session's commit has no
trailer for the person.
- Settings → Profile in Chromium against the dev stack: saving an
address (it comes back trimmed and survives a reload), the server's
error under the field for `dev@example`, both themes, 390 px.
- After merging `main` (4b94afa; #58 had taken migration number 0008, so
this one is now 0009): `cargo xtask check --quick` passes again, and on
fresh dev state the migrations apply in order (`0008_claude_usage.sql`,
`0009_commit_email.sql`) and a session's commit ends with both trailers.
- The project's switches, with the dev owner's commit email set, one
session each (the trailers its commit ended with, and Claude's
`attribution` setting):
  - both on: Claude's and the person's trailers;
  - people only: the person's trailer, with `sessionUrl: false`;
- Claude only: `attribution.commit` unset, so fake-claude, like Claude
Code, adds Claude's own trailer;
- both off: `attribution.commit: ""` and `sessionUrl: false`, and no
trailers.

With people off, the address appeared nowhere in the sandbox. A `PATCH`
whose settings leave both fields out, as an older client sends them,
kept both off, and `fctl projects set --credit-claude on` changed only
that one. In Chromium, each switch saved, and the API read back the
value.
- Not tried: real Claude Code following `attribution.commit` (the dev
stack runs fake-claude, and this sandbox can't start another Claude),
and GitHub crediting a noreply address.

## Screenshots

At 1c69f94, in Chromium against `cargo xtask dev`, with `main` (012337e
for Profile, 9587c2b for the project) against the same control plane as
the before. This session can't attach images (#40), so in words:

**Settings → Profile**

- **Before**, light and dark: the section reads "How you appear in
sessions and to your team." and has first and last name, Avatar URL and
Save.
- **After**, light and dark: the description reads "How you appear in
sessions, in commits and to your team." A "Commit email" field follows
Avatar URL, styled like it, with the placeholder "None: commits don't
credit you" and the hint "Commits in the sessions you start credit you
as a co-author with this address, which anyone who can read the
repository sees; a project can turn this off. Use one your GitHub
account has, such as your noreply address, so GitHub links the commits
to you." ("noreply address" links to github.com/settings/emails,
underlined in the accent color).
- **The server's error**: with `dev@example` saved, "Enter a valid email
address" replaces the hint in the danger color, as the other fields'
errors do.
- **Dark, 390 px, with an address saved**: the fields stack,
`[email protected]` fits the field, and the hint
wraps.

**The project's settings → Agents**

- **Before**, light and dark: three switches, "Open a pull request when
done", "Remote Control" and "claude.ai connectors".
- **After**, light and dark: two more switches below them, on by default
and styled like them: "Credit people in commits" ("Commits name the
person who started the session as a co-author, with the commit email in
their profile.") and "Credit Claude in commits" ("Commits name Claude as
a co-author, Claude Code's default. Off: they leave out its trailer and
the claude.ai session link.").
- **Dark, 390 px, with Credit Claude in commits switched off and
saved**: that switch shows off, the text wraps beside each switch like
the others', and "Settings saved" shows.

Session: https://app.fctl.sh/s/ses_01M56GAEEHP8WBMTPQ9ZY9VVA0

---------

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
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.

Notifications when a session waits for you or fails

1 participant