Skip to content

fix(control): let only a workspace's admins create its projects - #194

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/121-admins-create-projects
Oct 22, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/121-admins-create-projects

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

Any member of a workspace could create a project in it and become its owner. A project uses the repositories of the workspace's GitHub accounts that its owners choose, and its sessions get tokens that write to them, so a member whose base role and project roles opened one project, or none, could reach every repository the workspace's connections cover. Creating a project now takes being one of the workspace's admins (ADR 0035).

  • Control plane. POST /api/v1/projects refuses members (fctl_domain::workspace::check_create_project, with unit tests): "Only the workspace's admins create its projects. Ask one of them to create it and add you to it." Without a workspace named, a new project goes into the only one the caller administers; a member of workspaces they don't administer is told to ask an admin or create a workspace of their own. GET /api/v1/github/repos, which uses the same lookup, still answers every member.
  • Web app. New project shows only where the person is an admin: the + beside a workspace in the sidebar and its empty state, the workspace page's button and empty states, the command palette, and the home page's setup step (which tells a member that a workspace admin creates its projects). The new project page lists the workspaces the person administers, and explains when there are none.
  • Docs. The architecture, getting started, CLI and security docs say who creates projects.

Projects that exist keep their owners. Choosing a project's repositories stays with its maintainers and owners, within the workspace's connections, as admins or the project's owners give those roles; the ADR says so, since a maintainer base role lets every member point their projects anywhere the connections cover.

Screenshots

At 9a60638, as a member (not an admin) of the dev workspace, light theme, 1280 px wide; admins see what they saw before.

Before After
Before: the workspace page offers New project to a member After: no New project for a member
Before: the new project form, for a member After: the new project page tells a member that admins create projects

The new project page for a member in the dark theme:

After, dark: the new project page tells a member that admins create projects

Verified

In cargo xtask dev: a member creating a project in the workspace got 403 with the messages above, with and without the workspace named, and the workspace's primary admin created one. The screenshots show the app as that member. cargo test -p fctl-domain, the web app's tests (a new one for createsProjects) and cargo xtask check --quick pass.

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

Any member of a workspace could create a project in it, become its owner,
point it at any repository the workspace's GitHub connections cover and
start sessions that write there, whatever the base role and their project
roles opened to them. Creating a project now takes being an admin of the
workspace (fctl_domain::workspace::check_create_project, ADR 0035); a new
project without a workspace named goes into the only one the caller
administers. The app offers New project only where the person is an
admin, and tells a member to ask one. Projects that exist keep their
owners.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 22, 2026 01:37
@kalaspuff
kalaspuff merged commit cfbc02e into main Oct 22, 2026
9 checks passed
@kalaspuff
kalaspuff deleted the fctl/121-admins-create-projects branch October 22, 2026 01:47
kalaspuff pushed a commit that referenced this pull request Oct 22, 2026
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](docs/adr/0036-members-run-their-sessions-on-their-own-runners.md)):

- **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 #195's
0022, and the ADR after #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](https://app.fctl.sh/api/v1/published/nrH29cRZ90kfwMT4BGvdeWsXytJaq5SUfbGDWkGzx97/own-before-runners.png)
| ![After: the Runners tab for a member, with a form to register a
machine for their sessions and marked personal
runners](https://app.fctl.sh/api/v1/published/g3cAk9b6qnpEg3YUWCE2yzhLLf0q4kMx24f3bdsZZJ4/own-after-runners.png)
|

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

| Before | After |
|---|---|
| ![Before: Settings → You without the
switch](https://app.fctl.sh/api/v1/published/7N5S847hyFaD0TKEVEXvBck3MYXgHhJ9AUNxZx5cPzb/own-before-settings.png)
| ![After: Settings → You with the Only on my runners
switch](https://app.fctl.sh/api/v1/published/M2owdgz5HujRWHiiLicwIrrT2wMbW2rmttX6kpO7I49/own-after-settings.png)
|

The switch on, dark:

![After: the Only on my runners switch on, dark
theme](https://app.fctl.sh/api/v1/published/B3A8gLroNMwuPrjyvVKh5F4IbecoAf13e847C6vueTi/own-after-settings-on-dark.png)

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](https://app.fctl.sh/api/v1/published/AHFay0dCwWsLwrsTgSzKZJs96NMsatLZSk52A5DntHu/own-after-waiting.png)

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](https://app.fctl.sh/api/v1/published/SFJwaMtizj7TSfylEPrPefuV5JdrJB8bjz80VlZZXMO/own-after-home-note.png)

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](https://app.fctl.sh/api/v1/published/wv7tw8Ztu7Skf3QfAfRSh1n7inAdKq3J6EVVh0LPn7o/own-after-runners-admin.png)

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

![After: the Runners tab at phone width,
dark](https://app.fctl.sh/api/v1/published/G4PAZ6XSXEjre1lqoDblO8LPQTfyOBk4Kyim6rcGf0h/own-after-runners-390-dark.png)

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

![After: Settings → Workspaces marks the
workspace](https://app.fctl.sh/api/v1/published/45nZBxSnnxrejGbNexMQV6ATS5Ce0P8FbqlHjU0aAEz/own-after-app-settings.png)

## 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

---------

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