Description
An organization can't set, in one place, what its projects may allow. A workspace's admins own every project and can change each one's settings, but its maintainers, its autopilot or a token that may do everything there can raise them again a minute later: let agents push, run Opus at max effort, give a sandbox 64 CPUs, keep idle sessions a week, turn on claude.ai connectors or Remote Control. Nothing limits how many sessions one person or one project runs at once either: on a shared or autoscaled fleet, one person's batch of twenty sessions takes every runner, and everyone else's sessions wait "for a runner" until theirs stop.
How it works now
- Project settings. What a policy would cap is a project setting (
ProjectSettingsincrates/fctl-proto/src/session.rs):github_access,model,effort,cpus(1 to 64),memory_mb(up to 256 GiB),idle_timeout_minutes(up to 7 days),claude_ai_connectors,remote_control,publish_screenshots,screenshot_days,id_tokens,cloud_access.clean_settings(crates/fctl-control/src/api/projects.rs) checks only their ranges. Maintainers change them (require_maintainerinupdate), and so do the workspace's admins, who own every project (crates/fctl-domain/src/perm.rs), an autopilot with the settings power (ADR 0092) and a token that may do everything (fctl_domain::limits::check). - Saving.
fctl_domain::settings::keep_unsentkeeps what an update leaves out, so that an older client can't reset a setting. It caps nothing. - Limits from above. An access token's
github_access(ADR 0037):limits::session_githubrefuses a session more than the lower of its project's and its token's, andlimits::effectiveholds running sessions to the project's from their next GitHub token. The instance'spublish_screenshots(fctl_domain::published::allowedat spec building), in amber under the project's switch when off (web/src/components/project/settings.tsx). Hosts' allowed images and largest sandbox. The workspace's ownautopilotsswitch. - Model and effort are chosen by the project, each session (
CreateSessionRequest,UpdateSessionRequest), each schedule (Schedule.model), the review agents (ReviewAgents.model) and the autopilot./modeland/effortin a message switch a running Claude, and the Claude apps over Remote Control change its effort (docs/architecture.md#model-and-effort). - Where settings take effect. Each run's spec takes them as they are then (
buildandreview_specincrates/fctl-control/src/spec.rs): connectors (settings::session_env), screenshots,idle_timeout_secs, identity tokens (checked again byid_tokens::mint). Hosts size the sandbox from the spec (Want::ofincrates/fctl-host/src/session.rs); FleetDO places sessions by the stored settings (spec::session_wants). - Sessions at once. Each host's
capacityis the only limit. FleetDO (one per instance,crates/fctl-control/src/do_fleet.rs) queues every session, whatever started it:dispatch_innerreads the 50 oldest queued (ORDER BY enqueued_at ASC LIMIT 50), places each withfctl_domain::schedule::pickand says why one waits (Wait::reason;TokenWait::reasonnames the person). A session keeps its runner's slot (assignments) while idle or paused, until it stops; FleetDO dispatches again as each run ends. A session runs as its Claude connection's owner (ADR 0036),personinspec::session_wants. - Precedents. An autopilot runs at most
crew_maxsessions at once (3 unless its people choose up to 8; ADR 0081):autopilots::crew_roomcounts those queued, starting, working, paused or stopping, and an idle one once messaged (CREW_WORKING), and refuses a start past it, which Let an autopilot's session starts and resumes wait for room at its session limit #559 would make wait. A schedule's events start at mostmax_per_hourandmax_per_daysessions (ADR 0083).
What should happen
- A workspace keeps policies that its admins set and its members read.
- Saving a project's settings, a schedule, review agents or an autopilot can't go past a policy, nor can a session's start, change or message.
- Each run is held to the policies where settings take effect, whatever its project stored before them.
- One person, and one project, run at most as many sessions at once as the workspace allows; the rest wait in FleetDO's queue, saying why.
- The workspace's Settings gets Policies, with a preview, and project settings show each cap by the control it limits.
-
fctl workspaces policiesreads and changes them, with--jsonand--dry-run; docs/ and docs/llms.txt say what each holds.
Policies. WorkspacePolicies in crates/fctl-proto, each field optional (absent: no limit): github_access, models (families: opus, sonnet, haiku, fable), max_effort, max_cpus, max_memory_mb, max_idle_minutes, max_screenshot_days, claude_ai_connectors, remote_control, publish_screenshots, id_tokens (false: off everywhere), max_sessions_per_person, max_sessions_per_project, kept as JSON in a new workspaces.policies column. PATCH /api/v1/workspaces/{id} takes policies from admins, keeping what it leaves out, null lifting one; the audit log records workspace.policies_changed. POST /api/v1/workspaces/{id}/policies/preview answers what a change would hold: projects past a cap, schedules, review agents and autopilots on a model it leaves out, people and projects running more sessions than it allows. The rules go in fctl_domain::policies, with tests (a model ID counts by its family's name; one fctl can't place is in none).
Saving and starting. A save that raises a setting past a policy is refused on its field: "Acme lets agents comment on GitHub at most". A value from before the policy that an update sends back unchanged is kept, since the web app and the CLI send back what they read; the project keeps its choice, so lifting the policy restores it. session_github takes the policy as a fourth bound; starts, session changes, schedules, review agents, autopilots and messages that begin with /model or /effort (api::sessions::send_message) are refused past it the same way.
At each run. spec::build, review_spec and spec::session_wants lower what they read: GitHub access through limits::effective (within the hour, from the next GitHub token), effort, size (FleetDO places by the lowered size) and idle timeout; connectors, Remote Control, screenshots and identity tokens go off where a policy says, and id_tokens::mint refuses.
Sessions at once. FleetDO counts, per workspace, the sessions that hold a runner's slot, by person and by project. One past a limit stays queued with a reason: "Waiting for room: Ada runs 5 sessions in Acme, the most its admins let one person run at once" or "Waiting for room: web runs 12 sessions, the most Acme lets one project run". It starts as one of them stops. queue and assignments need the workspace, person and project on each row (add_column), and the window of 50 must skip sessions whose person or project is at its limit, or one person's queued batch fills it and holds up everyone queued after them. A message to an idle or working session goes at once, as it holds its slot; resuming a stopped one waits like a start.
Design and UX
Policies should read as a short contract that an admin sets in a minute, that shows what it will hold before it's saved, and that everyone it binds meets in plain words at the control or the session it limits, so that nobody is surprised by a refused save or a session that waits.
- Where. Acme's Settings → Policies, after Access: admins change it, members read it. Not a tab of its own: admins see nine tabs already, which their strip fits only when dense.
- First visit. "Limits every project in Acme keeps", then a lead from Acme's facts: "Acme's 9 projects choose their own settings: 4 let agents push, 2 run Opus at max effort, docs keeps idle sessions 2 days. Policies set the most any project may choose, and how many sessions one person or project runs at once; maintainers can still choose less." Beside it, a preview drawn with the app's parts: the "Agents on GitHub" Select with Push greyed and "Acme lets agents comment at most" in amber, and a queued row "web#41 · Waiting for room: Ada runs 5 sessions". [Set policies], with "Acme's admins set them; everyone in Acme reads them here."
- The form. Each policy is a sentence with its control in it, "No limit" when empty: "Agents do at most [Comment ▾] on GitHub." "Sessions run on [Opus] [Sonnet] [Haiku] [Fable] at up to [High ▾] effort." "A sandbox gets at most [8] CPUs and [16 GiB]." "An idle session keeps its runner at most [1 hour ▾]." "One person runs at most [5] sessions at once in Acme, and one project [12]." Then switch rows: "claude.ai connectors are off in every project", "Remote Control is off in every project", "Agents publish no screenshots", "Agents mint no identity tokens".
- The preview, in a sunken box (
aria-live) as values change, in the words--dry-runprints: "3 projects allow more today: web lets agents push, api runs Opus at max effort, docs keeps idle sessions 2 days. They're held to these from their next session; their own settings stay, for when you lift a policy. api's Weekly triage schedule runs on Opus: it starts nothing until someone changes it. Ada runs 7 sessions: they carry on, and her next ones wait until she runs fewer than 5." Past three, "and 9 more projects" opens the rest. Loading: "Checking Acme's 9 projects…"; failed: why, and [Try again]. - Saving. [Save policies] asks only when the preview found something: "Hold 3 projects to Acme's policies?" and [Hold them], primary rather than red, since a policy is changed back as easily. Toast: "Saved: sessions keep them as they next start, GitHub tokens within the hour".
- Where people meet it. Under each capped project control, one amber line naming who can change it: "Acme lets agents comment on GitHub at most. Its admins set this in Acme's Settings (ask Ada, its primary admin)." Options past it stay, greyed, with that reason; an older value says "web chose push; Acme holds it to comment." Composers list only allowed models. Under the start form, as the no-runner note is: "You run 5 sessions in Acme, the most its admins allow at once: this one waits until one of yours stops. See yours". A waiting session's page lists its person's running sessions with Stop. A refused message: "Acme runs sessions on Opus or Sonnet: /model haiku wasn't sent."
- CLI.
fctl workspaces policies -w acmeprints the sentences, or "Acme's admins haven't limited its projects."; flags change them (nonelifts one);fctl show web#41prints why it waits. Refusals say what to do: "Acme lets agents comment on GitHub at most: start it with --github comment, or ask its admins."
$ fctl workspaces policies -w acme --github comment --models opus,sonnet --max-effort high \
--sessions-per-person 5 --sessions-per-project 12 --dry-run
3 projects allow more today: web lets agents push, api runs Opus at max effort, docs keeps idle sessions 2 days.
Ada runs 7 sessions: they carry on, and her next ones wait until she runs fewer than 5.
Nothing changed: run it again without --dry-run to save.
Building it:
- Follow hyperstructure/design's docs:
docs/principles.md;docs/web-app/explaining.mdfor pages that set something up (a headline that names the outcome, a lead built from this place's facts, a preview of the result, one primary action, and who can act);docs/web-app/kit.mdfor controls. - Design every state before building it: the first visit, loading, errors and refusals, waiting, partial setups and long lists.
- Say what happens, plainly, and never leave someone at a disabled control without saying who can act.
- Prototype the main screens with realistic data (
cargo xtask demo's world) and review them before building the rest. - Check both themes, a phone's width, the keyboard, screen readers and reduced motion, and show screenshots in each pull request.
- Give the CLI the same care: readable output,
--json, and errors that say what to do next. - Add or update the pages of hyperstructure/design's docs for each new component, with the reasons behind its choices.
Compatibility
- Control plane, web app and CLI only: hosts and agents one version behind get the policies as each spec's settings, lowered.
- A D1 migration adds
workspaces.policies; FleetDO'squeueandassignmentsgain columns withadd_column, and it reads the person and project of sessions assigned before the deploy from D1 once. WorkspacePolicies,Workspace.policies,UpdateWorkspaceRequest.policiesand the preview are new optional fields incrates/fctl-proto, thencargo xtask gen. An older CLI that saves a project sends back what it read, which is kept.- Docs: docs/cli.md, docs/api.md, docs/architecture.md (Workspaces, GitHub access, Model and effort, Idle sessions), docs/security.md#access, docs/organizations.md and docs/llms.txt, and an ADR for session limits. The CLI's flags ship with the next release. fctl-site's privacy policy needs no change: nothing new is kept about people.
Decisions for a person
- Whether sessions on a person's own runners (ADR 0036, 0072) count toward their limit, as they take nobody else's runner.
- Whether idle sessions count, since they hold a slot until their idle timeout, or only those at work, as an autopilot's crew.
- Whether review agents', schedules', tickets' and autopilots' sessions count toward their person, or have limits of their own.
- What a run does whose stored model the policy leaves out: start on the first allowed and say so, or fail saying why; and whether an effort policy turns Remote Control off, since the Claude apps change a running session's effort there without going through fctl's API, or fctl-agent sets it back.
- Whether a start past a limit waits, as here, or is refused, as an autopilot's is (Let an autopilot's session starts and resumes wait for room at its session limit #559); and whether workspaces need a total limit, or self-hosted instances one policy for all workspaces.
Session: https://app.fctl.sh/s/ses_01M8450BECFP8DN88R0ZP0N0MS
Activity