Skip to content

Workspace admins see who has Claude connected, on which plan, and whose token runs out soon #627

Done

Description

@fctl-sh

Sessions run on each person's own Claude subscription, and organizations give their people Claude Team or Enterprise seats for it. A workspace's admins can't see who in it has Claude connected, which plan their sessions run on, whose connection stopped working or whose long-lived token runs out next month: they learn it when someone's sessions fail. fctl can't warn anyone either: it never learns that a long-lived token stopped working, and the expiry it records for one is a guess it shows nowhere.

How it works now

  • What fctl keeps. claude_credentials (crates/fctl-control/migrations/0001_init.sql, then 0029, 0043, 0068): kind (setup_token or oauth), label, account_email, subscription_type, rate_limit_tier, status (active or invalid), expires_at, created_at, last_used_at, on_runners, provisioned (an admin token set it). People see their own in Settings → Claude and fctl claude status. A person's sessions in a workspace run on the one they chose for it (workspace_members.credential_id), else their default, else their newest active one (api::sessions::credential_for).
  • The plan. Only a full login records subscription_type and rate_limit_tier, from its sign-in (FleetDO's store_login). A long-lived token is kept with the user:inference scope and no plan; the app tells only Ultra apart, by the limits its sessions report (fctl_domain::usage::is_ultra, web/src/lib/usage.ts).
  • Expiry. docs/security.md says a long-lived token works until a year after claude setup-token made it. fctl can't tell when that was: it records expires_at a year after the token was connected (api::claude::add_token, api::provision::set_claude). An admin token that sets the same token again moves it a year on and deletes its usage readings (api::provision::replace_claude), so a provisioning job that sets it on every run keeps it a year away. A token kept on runners has none (hosts report when they saved it, RunnerClaudeToken.saved_at); a login's is its access token's, renewed within hours (spec::refresh). Neither Settings → Claude nor fctl claude status shows it.
  • Ended. A login turns invalid when Claude refuses to renew it (spec::refresh), and Settings marks it as needing reconnecting (web/src/lib/settings.ts). A long-lived token is never renewed, so fctl never finds one ended (EndedLogin in web/src/components/claude/connect.tsx says so): sessions on a revoked or expired token fail with Claude's error while it reads active.
  • Last used. last_used_at is when a run last took the credential, or its host asked for it again (spec::claude_credential), whether Claude accepted it or not.
  • Usage limits. claude_usage keeps each limit's latest reading per credential (crates/fctl-control/migrations/0008_claude_usage.sql, crate::usage::record). A session that reaches one pauses (BillingGuard::LimitReached in fctl_domain::events, a Paused notification, the session.paused webhook); nothing counts how often a person's sessions do.
  • What admins see. The People tab shows admins who has two-factor sign-in (WorkspaceMember.two_factor), nothing of Claude. With an admin token, GET /api/v1/admin/users/{user} gives the token an admin token set (AdminUser.claude: label, status, default, dates, no expiry), and AdminClaudeToken's doc comment (crates/fctl-proto/src/api.rs) says "Their own Claude connections are theirs alone". Admin tokens set and remove that token (PUT and DELETE /api/v1/admin/users/{user}/claude, docs/organizations.md#people-from-your-directory) on self-hosted instances that take them.
  • Telling people. Email is optional (crates/fctl-control/src/email.rs, Features.email): invitations, resets, notices such as a new Claude connection (api::claude::connected_notice). Web Push is about sessions (fctl_domain::notify::Kind).
  • Subscriptions only. fctl refuses API keys (fctl_domain::claude::setup_token_problem) and stops sessions that would bill an API account or paid extra usage (fctl_domain::events::billing_guard): an organization that wants one bill gives its people Team or Enterprise seats.

What should happen

Recording. claude_credentials.answered_at, set as usage::record stores a reading and as a run's first answer from Claude arrives, since both mean Claude accepted the token. fctl-agent recognizes Claude's authentication error and reports it (a new optional field), and the control plane marks the connection invalid, as it does a login it can't renew, once more than one session saw it, so that an outage doesn't. Setting the same token again keeps its expiry (the control plane compares it with the one it holds), and AddClaudeTokenRequest takes an optional made_at; otherwise the year from connecting stays, and copy says "around". Limit pauses get a row each (connection, window, when), deleted after 30 days.

For admins. GET /api/v1/workspaces/{id}/claude (its admins): each member and the connection credential_for finds for them there, with its kind and who set it, plan where known, state (works, ended, never used), answered_at, expiry and whether it's estimated, limit pauses in 7 and 30 days, and whether their sessions are paused now. Never the token, its account's email or a label its person gave it. AdminUser.claude gains the expiry.

Warnings. The hourly job finds connections whose expiry is within 30 days, then 7, and tells their person once at each (claude_credentials.warned_at): an amber line under it in Settings → Claude, the mark Settings already shows an ended login, a card on the Agent Floor in the last week, and email where the instance has it. Admins see it on the People tab. An ended connection is told at once, the same ways.

Design and UX

An admin should see at a glance whether everyone in Acme can run sessions this week and next, and know exactly what to do about each person who can't, without ever seeing anyone's token, while each person knows what their admins see.

  • Where. Acme's People tab, for admins, beside the two-factor facts they see there. Not a tab: admins see nine already.
  • The summary, above the list: "11 of 12 people have Claude connected for Acme · 2 tokens run out within a month · 1 stopped working", then pills that narrow the list, with counts, those at zero left out: Everyone, No Claude, Runs out soon, Stopped working, Pausing on limits.
  • Each row gains a facts line under the address: "Long-lived token, set by an admin token · Team · Claude answered 2h ago · runs out around Dec 14" (the date amber within 30 days); "Claude login · Max · answered 5m ago"; "Token on her runners · plan unknown · answered yesterday"; "No Claude connection for Acme: her sessions here can't start" in amber; "Claude refused it on Nov 20: her sessions here can't run" in red.
  • Opening it (in place; a sheet on a phone) says it whole: "Grace's sessions in Acme run on a long-lived token an admin token set on Dec 14, 2025, on a Team plan. Claude last answered it 2 hours ago. It runs out around Dec 14, 2026, a year after it was set: fctl can't read the date from the token. Her sessions paused on usage limits 6 times this week, the last on the weekly limit." Then the way out: where the instance takes admin tokens, "Set her a new one with an admin token, from a token claude setup-token printed:" and a CodeBox, fctl admin users set grace@acme.dev --claude-token - --claude-label "Acme seat"; elsewhere, "Grace connects a new token in Settings → Claude: fctl has told her too." [Copy the link to her Settings → Claude]. Frequent pauses say "Her plan's limits are short for this work: a Max or Ultra seat has more."
  • First visit, while nobody has Claude connected for Acme: "Claude for everyone in Acme", the lead "Acme's sessions run on each person's own Claude subscription: 3 of its 12 people have connected one. You see whether their sessions can run and when their tokens run out, never the tokens.", and two example rows as a preview.
  • The person's side. Within 30 days, under the connection in Settings → Claude: "Runs out around Dec 14. Make a new one with claude setup-token and paste it here before then, or your sessions stop." [Connect a new token]. The workspace's Settings → You says: "Acme's admins see what kind of Claude connection your sessions here run on, its plan, when Claude last answered it and when it runs out: never the token or the account." The email: "Your Claude token for fctl runs out around Dec 14", how to make a new one, the link.
  • States. Loading: the facts lines as skeletons, never "No Claude connection" first. Failed: "Claude connections didn't load: … Try again", the people still listed. An empty pill: "Nobody's token runs out within a month." Members see none of it about others.
  • CLI. fctl workspaces members -w acme --claude, with --expiring 30d, --problems and --json; fctl claude status adds "runs out around Dec 14".
$ fctl workspaces members -w acme --claude
NAME           CLAUDE                      PLAN   ANSWERED   RUNS OUT        LIMIT PAUSES (7D)
Ada Lovelace   login                       Max    5m ago     -               0
Grace Hopper   token, set by admin token   Team   2h ago     ~Dec 14 (21d)   6
Linus Lee      none                        -      -          -               -
1 person has no Claude connection for Acme: their sessions here can't start.

Building it:

  • Follow hyperstructure/design's docs: docs/principles.md; docs/web-app/explaining.md for 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.md for 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

  • D1 migrations: claude_credentials.answered_at and warned_at, and a table of limit pauses.
  • Protocol: optional fields on ClaudeCredentialInfo, AdminClaudeToken and AddClaudeTokenRequest, a new type for the workspace's list, and fctl-agent's report of a refused token as an optional field; then cargo xtask gen. Agents one version behind report nothing new, and their sessions on a refused token fail as today. Detecting refusals needs a release; the rest a deploy, with the CLI's flags in the next release.
  • Email goes out only where the instance has it; Email notifications when a session waits for you or fails #49 covers email about sessions.
  • Docs: docs/organizations.md (People from your directory, Oversight), docs/security.md#access, docs/cli.md, docs/api.md, docs/architecture.md#claude-credentials and docs/llms.txt.
  • fctl-site's legal/privacy.md: workspace admins see facts about members' Claude connections; fctl keeps when Claude last accepted each one and 30 days of limit pauses; it emails people before their token runs out.

Decisions for a person

  • How much admins see of a connection its person made, which AdminClaudeToken's doc keeps theirs alone: kind, plan, state and expiry as proposed, or only whether their sessions can run.
  • Whether admins see usage-limit pauses, or only that a member's sessions are paused now.
  • Whether admins get email about tokens that run out or stopped working, each or as a weekly digest.
  • Whether Admin → People shows the same for the whole instance, where seats are set with admin tokens.
  • How many refusals mark a long-lived token ended, and whether fctl checks a token that hasn't run in a while.

Refs #49

Related: #621, #619, #622

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

Activity

  1. added
    enhancement
    control-plane
    web
    cli
    agents
    on Nov 23, 2026
  2. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    Done in #640 (merged as 41ec80b), with hyperstructure/fctl-site#139 (privacy policy) and hyperstructure/design#77 (design docs).

    • Deployed to app.fctl.sh: the control plane (recording answers, refusals and limit pauses, ending refused tokens, the warnings and emails, GET /api/v1/workspaces/{id}/claude and /api/v1/admin/claude) and the web app (People tab, workspace and instance settings, Settings → Claude, Agent Floor). The docs and the privacy policy are live on fctl.sh.
    • Ships with the next release: the CLI's fctl workspaces members --claude, fctl admin claude, the new --claude-* flags of fctl workspaces set and fctl admin set, --made-at/--claude-made-at, and the expiry lines in fctl claude status. Agents and hosts need no update: the control plane reads Claude's refusals from the events sessions already send.

    The decisions this issue left open are settings (Claude seats, ADR 0098): how much workspace admins see (details by default, readiness or nothing, capped by the instance), whether they see limit pauses (on), email to admins (weekly by default, each, or off), Admin → People showing everyone's (off), and refusals that end a token (2, 1 to 5). fctl doesn't check tokens that haven't run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentsclicontrol-planeenhancementweb

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions