Skip to content

feat: let members run their sessions only on their own runners - #199

Merged
kalaspuff merged 3 commits into
mainfrom
fctl/121-own-runners
Oct 22, 2026
Merged

kalaspuff merged 3 commits into
mainfrom
fctl/121-own-runners

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

A session's sandbox holds the Claude token of the person it runs as: an access token that lasts hours, or a claude setup-token token that lasts a year. Every runner of a workspace ran everyone's sessions there, so each member's token reached every machine the workspace's admins added. A full Claude sign-in, which passes a long-lived refresh token through a host, could run on any of those runners too. Members had no way out: only admins add runners.

Now each member can keep their sessions on machines they control, per workspace (ADR 0036):

  • Only on my runners. A member's setting in each workspace (workspace_members.own_runners): in the workspace's Settings → You, fctl workspaces own-runners on|off -w acme, PATCH /api/v1/workspaces/{id}/membership with own_runners. While it's on, their sessions there run only on runners they registered. Turning it on stops their sessions running on others' runners, and they resume on theirs.
  • Members add runners for their own sessions. A runner added to a workspace runs everyone's sessions there, or only its owner's (runner_workspaces.personal). Members can now register a machine for a workspace (fctl host install --workspace acme, or the Runners tab), or add one of theirs. Such a runner runs only their own sessions, which show the machine nothing they can't already read in the session. Runners for everyone's sessions still take an admin, and admins can choose --personal too. Adding a runner again changes whose sessions it runs. Demoting an admin now turns their runners into ones for their own sessions; before, it took them out of the workspace.
  • One rule. A session runs as the owner of its Claude connection. fctl_domain::schedule::runs_for decides whether a runner runs a session (unit tests). FleetDO's scheduling, spec::runner_serves (credentials, uplinks, files, screenshots) and Claude sign-ins all use it, so a runner that stops running a session gets nothing more for it.
  • Claude sign-ins run on one of the person's own runners when one is online. Otherwise they run on a runner that runs their sessions; with the setting on everywhere, only on their own.
  • Waiting says why. A queued session that no runner takes says whose runner it waits for: "Waiting for one of Grace Hopper's runners: their sessions in this workspace run only on their own, and none of those is online". It also says when the only runners online run only their owners' sessions. The note under the task box counts only the runners that run your sessions.
  • Wire changes are additive. Workspace.own_runners, Runner.personal (the workspaces where it runs only its owner's sessions), UpdateMembershipRequest.own_runners, CreateRunnerRequest.personal, and a new optional body for PUT /workspaces/{id}/runners/{runner} (AddRunnerRequest). Hosts and agents don't change. An older CLI that registers or adds a member's runner gets one for their own sessions.
  • Migration 0023 adds the two columns. It is numbered after fix(control): keep GitHub connections to their account, by id #195's 0022, and the ADR after fix(control): let only a workspace's admins create its projects #194's 0035.

It also corrects copy that said sessions on a runner taken out of a workspace carry on: they stop and resume elsewhere, and have done so since #171. The architecture, security, CLI and getting-started docs describe all of this.

Screenshots

At 3765a8b, in cargo xtask dev as Grace Hopper, a member of the Development workspace. Dev Owner's dev-host runs everyone's sessions; Grace's grace-mini and Ken Thompson's ken-box run only their own. 1280 px wide unless noted.

The workspace's Runners tab, light. Before: members could only ask an admin. After: they register a machine for their own sessions, and the list marks the runners that run only their owner's sessions.

Before After
Before: the Runners tab for a member, who can only ask an admin After: the Runners tab for a member, with a form to register a machine for their sessions and marked personal runners

The workspace's Settings → You, light, with the new switch off:

Before After
Before: Settings → You without the switch After: Settings → You with the Only on my runners switch

The switch on, dark:

After: the Only on my runners switch on, dark theme

With it on and grace-mini offline, a new session waits for one of Grace's runners, though dev-host is online:

After: a queued session waiting for one of Grace Hopper's runners

The note under the home page's task box says the same before she starts one:

After: the note under the task box says none of her runners is online

The Runners tab as the primary admin, who sees whose each runner is and can take any out:

After: the Runners tab as an admin

The Runners tab at 390 px, dark, where the marks wrap whole:

After: the Runners tab at phone width, dark

The app's Settings → Workspaces says which workspaces keep your sessions on your runners:

After: Settings → Workspaces marks the workspace

Verified

In cargo xtask dev, with a second host running as Grace's grace-mini, and Ken as another member:

  • Grace's personal runner took nobody else's sessions. Ken's sessions all went to dev-host while grace-mini sat idle. With dev-host full, his next one waited instead of using hers.
  • Turning the setting on and off. With it off, Grace's sessions ran on either runner. Turning it on stopped her session on dev-host, and a message resumed it on grace-mini. With grace-mini offline, a new session waited with the reason above; turning the setting off started it on dev-host.
  • Ken's waiting reasons. With dev-host disabled, his session said the runners online run only their owners' sessions. With dev-host out of the workspace, it said the workspace's runners run only their owners'. Adding dev-host back started it.
  • Demotion. Grace, made an admin, shared grace-mini, and a Ken session ran there. Demoting her made it hers alone, stopped his session, and a message resumed it on dev-host.
  • Claude sign-ins. Grace's ran on grace-mini though dev-host was online; Ken's on dev-host. With Ken's setting on and no runner of his, his sign-in is refused (503).
  • API rules. A member registering or adding a runner for everyone's sessions gets 403, and an admin adding a member's runner gets 403. Without a body, PUT …/runners/{runner} adds a member's runner for their own sessions.
  • CLI. fctl workspaces own-runners, add-runner --personal (and again without it), runners, show, and fctl host install --workspace as a member ("Registered runner ken-box … for your sessions in Development").

cargo test -p fctl-domain (new tests for runs_for, check_add_runner and the waiting reasons), the web app's tests (runnersOf, the note, the Runners tab), cargo xtask check and a session through cargo xtask serve (cargo xtask dev --smoke --server http://localhost:8787) pass.

One of four pull requests on the issues the security review (#189) left open, with #193, #194 and #195.

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

fctl-sh Bot added 2 commits October 22, 2026 02:06
A member chooses, per workspace, to run their sessions there only on
runners they registered (Only on my runners, fctl workspaces own-runners).
Members may add their own runners to a workspace for their own sessions;
runners for everyone's sessions stay with admins (--personal for their
own). Scheduling, runner_serves and Claude sign-ins share one rule,
fctl_domain::schedule::runs_for. ADR 0036.
Waiting sessions say when only other members' runners are online; a
runner that stops running a session says so without blaming the
workspace; the runner list keeps its marks on one line at phone width;
fctl workspaces own-runners suggests adding a runner only to people
without one there.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 22, 2026 02:23
# Conflicts:
#	crates/fctl-domain/src/workspace.rs
#	docs/adr/README.md
@kalaspuff
kalaspuff merged commit 845d594 into main Oct 22, 2026
9 checks passed
@kalaspuff
kalaspuff deleted the fctl/121-own-runners branch October 22, 2026 02:28
kalaspuff pushed a commit that referenced this pull request Oct 23, 2026
People who want their Claude token to stay out of other people's hands
could already keep their sessions on their own runners (**Only on my
runners**, #199), but the token itself still had to be handed to the
control plane, which kept it encrypted in D1: a breach of D1 and the
master key, or an operator of the instance, had every token, and a token
from `claude setup-token` lasts a year. Now a token can stay on the
runners its owner operates. It is never given to fctl, and sessions on
it run only on those of the owner's runners that keep it ([ADR
0050](docs/adr/0050-claude-tokens-can-stay-on-their-owners-runners.md)).

## How it works

- **On each runner**, `claude setup-token` makes a token, and the new
`fctl host claude set-token` keeps it in `~/.config/fctl/claude-token`
(mode 0600, or `claude_token_file` in `host.toml`). It asks for the
token with the input hidden, or reads it from stdin. `fctl host claude
status` shows whether the runner keeps one and whether the control plane
knows. `fctl host claude remove-token` removes it. `fctl host status`
and `fctl host doctor` report it too, and doctor flags a token file that
others can read.
- **Hosts say only whether they keep one, and since when.** `HostHello`
and `HostHeartbeat` carry `claude_token: { saved_at }`, never the token.
FleetDO keeps it in the runner's hello, so a token saved or removed
while the host runs shows up within one heartbeat (15 s). The runner's
owner sees it (`Runner.claude_token`); nobody else does.
- **A connection without a secret.** People connect "On your runners" in
Settings → Claude, with `fctl claude connect --on-runners` or `POST
/api/v1/me/claude/on-runners`: a `claude_credentials` row with
`on_runners` set and an empty `secret_enc` (migration 0029, one per
person). Its kind is `setup_token`, so older clients show it as a
long-lived token. `fctl workspaces claude on-runners -w acme` chooses it
for a workspace.
- **Its sessions run only on the owner's runners that keep a token.**
For `runs_for` it counts as **Only on my runners**, in every workspace
(`fctl_domain::schedule::only_theirs`), so `spec::runner_serves`
(credentials, uplinks, files, screenshots) applies it too. FleetDO then
starts such a session only on a runner whose host keeps a token. A
queued session says why it waits (`TokenWait`): none of the person's
runners is in the workspace, none of them is online, or the ones online
keep none or run an fctl too old to keep one.
- **The host fills the token in.** The spec, and the fresh credentials
FleetDO answers with, carry the connection with `on_runners: true` and
an empty `access_token`. The host puts its own token in before the agent
sees either. When it keeps none, it refuses the session and says what to
run (`dev-host keeps no Claude token: run fctl host claude set-token on
it`). Agents need no change.
- **Hosts redact Claude tokens** from every frame an agent sends to the
control plane: events, logs, state and calls, in every session. That
covers the token the session started with, any it got since, and the one
the host keeps. Claude's streamed deltas split text anywhere, so for
each content block the end that could start a token waits for the next
delta, and goes out as soon as it differs or before the block ends
(`claude_token::StreamRedactor`). An agent that runs `printenv`, or
repeats the token in its reply, leaves `[Claude token, redacted by
fctl]` in the transcript and in what viewers see live.

## In the app

Settings → Claude has a third way to connect, **Keep the token on your
runners**, with a guided setup. It walks through `claude setup-token`
and `fctl host claude set-token` with copy buttons, then lists your
runners live as they report whether they keep the token. The steps tick
off once one does, and **Use the token on my runners** connects it.
Under the connection, each of your runners says whether it keeps the
token. While none does, the steps show there. Elsewhere:

- The note under the task box (Agent Floor, project page) says why
sessions will wait: none of your runners is in the workspace, none keeps
the token, or none that keeps it is online. It links to the setup.
- On a workspace's Runners tab, your runners that keep the token are
marked, and "Add another runner" gains a step for keeping the token on
the new one.
- In a workspace's **Settings → You**, **Only on my runners** shows as
on and locked while your sessions there run on the token, with the
reason.

## Screenshots

At e49af51, in `cargo xtask dev` (dev data only). Settings → Claude,
1440 px wide, light. Before: two ways to connect. After: a third,
collapsed until **Set up**.

| Before | After |
|---|---|
| ![Before: Settings → Claude with Sign in with Claude and Paste a
long-lived
token](https://app.fctl.sh/api/v1/published/dCkMmUuEQAtlaq0oVB9iyPtakMvZfMflxHCxYoB34Ie/before-claude-light.png)
| ![After: the same, with Or keep the token on your runners and a Set up
button](https://app.fctl.sh/api/v1/published/u1vY2rwwLMF8mGg4ANgeGssSASYAq8ODcZygNjKNDIo/after-claude-light.png)
|

The setup, dark: the dev host keeps a token already, so the steps on the
runner are ticked off. Then light, before any runner keeps one, and dark
at 390 px.

| A runner keeps it (dark) | None does yet (light) | Phone (dark, 390
px) |
|---|---|---|
| ![The guided setup in the dark theme, steps 1 to 3 ticked
off](https://app.fctl.sh/api/v1/published/t5eDlOzcxl5F0LTC9P5vpI7IJ5zJRD9NKuq9jC2kzlw/after-setup-kept-dark.png)
| ![The guided setup with numbered steps and an amber note that none of
your runners keeps it
yet](https://app.fctl.sh/api/v1/published/VwiN0k64aH23HBDAwyjiEaKa7Jcxdq5zeusFtLRtTCS/after-setup-none-light.png)
| ![The guided setup on a phone,
dark](https://app.fctl.sh/api/v1/published/xsbHwZrtkpN6jpmv1sAfaJea61bfoqXAAEhDDafYJQP/after-setup-none-390-dark.png)
|

Once connected: each of your runners and whether it keeps the token.
Light and dark, then light while none keeps it, where the steps show
under the connection.

| Connected (light) | Connected (dark) | None keeps it |
|---|---|---|
| ![The connection Token on your runners, used for new sessions, with
dev-host keeping
it](https://app.fctl.sh/api/v1/published/OHgsreP6bkIK4xPcJ99XvIcbdZGclOsxz42QbRhBQMm/after-connected-light.png)
| ![The same,
dark](https://app.fctl.sh/api/v1/published/fY1ng8idvy1pNMeEVjz2fGcmVWaY6N2O1iyAqJJIAzh/after-connected-dark.png)
| ![The connection with an amber note and the steps to keep the token on
a
runner](https://app.fctl.sh/api/v1/published/8wIrfOUb4kJHWWXsLpRBQjoGtVwShO11pLImeq3O7JN/after-connected-none-light.png)
|

The Agent Floor while no runner keeps the token, then a workspace's
Runners tab and its **Settings → You** while sessions there run on it:

![The Agent Floor with the note: None of your runners in Development
keeps your Claude token yet: sessions you start here wait until one
does. Keep it on a
runner](https://app.fctl.sh/api/v1/published/2bJdSTnUVtw5VXkTVXBwbDzlmDFmVvpr4wgmw89rXYN/after-floor-none-light.png)

| Runners tab | Settings → You |
|---|---|
| ![The Runners tab: dev-host marked Keeps your Claude token, and a
fourth step, Keep your Claude token on
it](https://app.fctl.sh/api/v1/published/ZpFHIs3bYQ8zBWe6E3VGANVtocbphr8utj5qKo1lclG/after-runners-tab-light.png)
| ![Only on my runners on and locked, saying
why](https://app.fctl.sh/api/v1/published/irxwQmuEuxaskfNbCxH54z8GbbqYmDSLI4bqufR553J/after-you-light.png)
|

## On the runner

```
$ fctl host claude set-token
Your sessions on the Claude connection you keep on your runners run with the token
this runner keeps. You never give it to fctl: it stays on this machine and goes only
into your sessions' sandboxes here.

Create one with Claude Code, here or on any machine you use it on:

    claude setup-token

Paste the token (input hidden):
✓ studio-mac keeps your Claude token (sk-ant-oat01-…Xy3Q) in /Users/ada/.config/fctl/claude-token, which only you can read.
  studio-mac tells fctl within 15 seconds that it keeps one, never what it is.
  Next, if you haven't: choose Keep the token on your runners in Settings → Claude, or run `fctl claude connect --on-runners`.

$ fctl host claude status
● studio-mac keeps your Claude token (sk-ant-oat01-…Xy3Q), saved 2m ago
  file:  /Users/ada/.config/fctl/claude-token
  fctl:  knows studio-mac keeps one, and never what it is

$ fctl claude status
○ fake-claude · setup_token · inference only · crd_01…
● On your runners · kept on your runners · inference only · crd_01…
    kept on studio-mac (online)
```

A session that waits says, for example: `Waiting for one of Dev Owner's
runners that keeps their Claude token: the ones online keep none. fctl
host claude set-token on one of them keeps it there.`

## What it protects, and what not

The token is safe at rest and from other people's machines. It is never
given to fctl, so D1 holds no secret for these connections. Hosts tell
the control plane only whether they keep one, and take it out of what
sessions send wherever it appears whole, also when it is streamed in
pieces. The agent still has it in its environment, as with any
connection. So whoever may direct the agent (the person, people they
share the session with to message, the project's editors, text in a
repository) can still have it sent elsewhere, or written in a form the
redaction doesn't know. Hosts also trust the control plane to send them
only their owner's sessions on such a connection, so a control plane
that someone has taken over could start a session there to the same end.
The security page and the ADR say so. Removing the token from a runner
applies to the runs that start after; sessions running there keep it
until they stop. A token from `claude setup-token` can't use Remote
Control, as before.

## Compatibility

All wire changes are additive and optional: `HostHello.claude_token`,
`HostHeartbeat.claude_token`, `ClaudeCredential.on_runners`,
`ClaudeCredentialInfo.on_runners`, `Runner.claude_token` and
`AddClaudeOnRunnersRequest`. Hosts too old to keep a token send nothing
and never get these sessions. Older agents get the token like any other.
Older clients show the connection as a long-lived token. One small fix
along the way: without a chosen default, `/auth/me` now marks the newest
working connection as used for new sessions, which is the one
`credential_for` actually runs them on (it marked the oldest).

## Verification

- Unit tests for the token check and masking (`fctl_domain::claude`),
the scheduling rule and waiting reasons (`schedule`), wire compatibility
(`fctl-proto`), keeping, filling and redacting tokens, also streamed in
pieces of 1 to 40 characters, and the daemon's refusals and fresh
credentials (`fctl-host`), the CLI's helpers, and in the web app the
helpers, the setup and details, the note under the task box, the Runners
tab and the locked switch.
- `cargo xtask check` passes: 691 Rust tests, 693 web tests, Clippy
native and wasm, generated types and the production build. `cargo xtask
dev --smoke` passes, against `wrangler dev` and against `cargo xtask
serve` (all 32 migrations applied on workerd).
- End to end in `cargo xtask dev`, and again against `cargo xtask
serve`: `fctl host claude set-token` on the dev host, the control plane
learning it within a heartbeat, then `fctl claude connect --on-runners`.
A session with fake-claude's new `printenv` ran on the dev host, and
`/proc/<pid>/environ` of fake-claude showed the runner's token. The
stored events showed `[Claude token, redacted by fctl]` and no token,
and no file in the control plane's local state (`.wrangler/`,
`.fctl-serve/`) or in the logs held it. After `remove-token`, a new
session waited with the reason above while the running one kept going.
After `set-token` with a new token, the waiting session started within
15 s with the new token, while the earlier one kept the old one. With
`printenv` also saying the token back in five-character pieces, a viewer
(`fctl attach`) saw `Claude Code got the token [Claude token, redacted
by fctl].` live.

The privacy policy says what app.fctl.sh stores, so it needs to change
with this: hyperstructure/fctl-site#50.

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

---------

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.

1 participant