Repository navigation
feat: limit access tokens, and what agents may do on GitHub - #207
Merged
kalaspuff merged 3 commits intoOct 22, 2026
Merged
Conversation
Access tokens can be limited to reading, running sessions or everything their person may, to some workspaces and projects, and in what the agents of their sessions may do on GitHub. A limited token reaches projects and sessions only, with its roles there capped. Sessions' agents push (as before), comment (review, comment and label, push nothing) or only read on GitHub, as the session asks, within its project's settings and the token that starts it. The session's GitHub tokens carry those permissions, fctl-agent pushes nothing for them and tells Claude, and agents that comment resolve review threads through the control plane (fctl resolve), since GitHub lets only tokens that can push do that.
…itHub Settings has an Access tokens section, whose dialog asks what a token can do, where, what its sessions' agents may do on GitHub and when it expires, says what the token will do before it makes it, and shows the secret once with how to use it. Devices lists browsers and CLI sign-ins on their own. The task boxes choose what the agent may do on GitHub (push, comment or read, within the project's setting), the session page says so beside its status and in its details, and a project's settings hold its agents to less. The guide in docs/automation.md runs review agents from GitHub Actions.
The CLI, security and self-hosting docs cover limited access tokens, fctl run --github, fctl resolve and fctl projects set --github. A token refuses blank places, which would have left it reaching every project, and fctl run stops a session that an older control plane started without the GitHub access it asked for.
kalaspuff
approved these changes
Oct 22, 2026
kalaspuff
deleted the
fctl/133-it-would-be-great-to-be-able-to-create-a
branch
October 22, 2026 13:01
kalaspuff
pushed a commit
that referenced
this pull request
Oct 22, 2026
Follow-ups to #207. A review of #207, by an agent reading the code without my notes, found one way past the limits, a design gap, and four smaller issues. I checked each against the code, and this fixes all of them. Refs #207 ## What changed 1. **A comment-capped token could steer an agent that can push** (the bypass). - The old rule decided who may steer a session from its *effective* access: what it started with, within its project's setting now. - Lowering a project's setting (a maintainer's change, or the token itself if it could do everything) made a running push session look comment-only right away. A token capped at comment could then message it. - The sandbox still held a token that pushes, valid for up to an hour, and its agent still pushed after every turn. - Now whom a token may steer goes by what the session *started* with (`SessionRow::started_github`), for both HTTP and socket rechecks. Tokens and pages keep the effective value. - The error says why: "…this session's agent started able to push: the token only reads it." 2. **"Everything" plus a GitHub limit held nothing** (design gap). - A token that may do everything in its projects can change their setup script, instructions, image and secrets, and so steer every agent there, push agents included. - The control plane now refuses that combination with a clear reason (`fctl_domain::limits::check`). - `fctl token --github comment` without `--access` makes a token that runs sessions. - The web dialog asks the GitHub question only for "Run sessions", and says why it's absent for "Everything" (screenshot below). 3. **`GET /auth/me` for a limited token** listed the person's other email addresses, and whether they have a password, two-factor or passkeys. It now shows only their name and primary address, as the docs said. 4. **`GET /workspaces/{id}/avatar`** ignored a token's places, since its handler checks membership itself. Limited tokens no longer reach it; nothing that uses them needs it. 5. **Unknown values fail closed.** Values a newer version may store used to read as the most an agent may do. Now: - an unknown session or project GitHub access reads as `read` for tokens and as `push` for steering decisions; - an unknown `github_access` no longer makes a project's whole settings unreadable, which had fallen back to defaults that push; - a stored token limit with a field this version doesn't know reaches nothing. 6. **`fctl resolve` refusals** named the repository of a thread outside the session's repositories, and told a missing thread from a foreign one. Both now get the same answer, which names no repository. The docs (architecture, CLI, Automation, security) and ADR 0037 say all of this. ## Verification - **New unit tests:** - "Everything" with a GitHub limit is refused, whatever the order of fields; - limits with an unknown field reach nothing; - the avatar route and device approval are refused; - an unknown project GitHub access reads as `read` and keeps the other settings; - the web form only asks a token that runs sessions to hold its agents lower. - `cargo xtask check --quick` passes: fmt, generated types, Clippy for host and wasm, all Rust tests, 566 web tests. - **On `cargo xtask dev`:** - **Steering:** a comment-capped token was refused on a session that started able to push. After `fctl projects set -p hello --github comment`, `fctl show` says the session "reviews and comments", and the token is still refused. - **Refusals:** `fctl token x --access full --github comment` is refused with the reason, and the avatar route answers 403. - `fctl token x -p hello --github comment` makes a token that runs sessions. - `whoami --json` with a limited token shows no other addresses or sign-in details. ## Screenshots The new token dialog with **Everything** chosen (light), at 8486659: no GitHub question, and a sentence that says why.  Session: https://app.fctl.sh/s/ses_01M5HPGZ4R0NQCXSMFR659JEHJ Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff
pushed a commit
to hyperstructure/fctl-site
that referenced
this pull request
Oct 22, 2026
Adds fctl's new **Automation** guide to fctl.sh/docs, and updates the privacy policy for limited access tokens (hyperstructure/fctl#207). hyperstructure/fctl#207 is merged and fctl's CI pinned it (`fctl-docs.ref` at 9ced8ea), which this branch now has from `main`, so the build finds the page: ready to merge. hyperstructure/fctl#209, which follows #207, changes these docs' wording only; the next pin brings it. ## What changed - `scripts/docs.mjs`: `docs/automation.md` renders at `/docs/automation/`, after the CLI in the navigation. It covers access tokens limited to what they are for, what agents may do on GitHub (push, comment, read), and review agents from GitHub Actions. Links from other pages to it now stay on the site. The 404 page's suggestions test lists it too. - `legal/privacy.md` (`updated` is already today): - **Sign-in sessions and tokens**: for an access token you limit, app.fctl.sh keeps what it may do, the workspaces and projects it reaches, and what its sessions' agents may do on GitHub. - **Projects and sessions**: each session keeps what its agent may do on GitHub, and which access token started it, if one did. - **Browser storage**: the draft task keeps the GitHub access chosen for it, beside the project, model and effort level. ## Verification - `FCTL_DOCS_DIR=<fctl at fctl/133-…> npm run build` renders 9 docs pages. `/docs/automation/` links to `/docs/architecture/#access-tokens` and `/docs/cli/`, and the nav lists it on every page. - `npm run check`: no new findings (the two `!important` warnings in 404.html and 500.html are on main too). - `node --test scripts/*.test.mjs`: 13 pass. Session: https://app.fctl.sh/s/ses_01M5HPGZ4R0NQCXSMFR659JEHJ Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Access tokens can now be limited to what they are for, and every session says what its agent may do on GitHub: push (as before), comment (review, comment, label and resolve review threads, no pushes) or read. That covers review agents started from CI that read and comment but can't push, and planner agents that only read.
What changed
What a session's agent may do on GitHub (
GithubAccess:push>comment>read)CreateSessionRequest.github_access,fctl run --github, a new picker beside model and effort in the task boxes). It gets at most what its project allows (ProjectSettings.github_access,fctl projects set --github, Agents on GitHub in project settings) and what the token that starts it allows. If it asks for nothing, it gets the most they allow; if it asks for more, it's refused with the reason.fctl_domain::repos::permissions):pull_requestsandissueswrite,contentsread, noworkflows;fctl resolve PRRT_…in its sandbox, a new agent call likefctl memory. The control plane checks the thread is on a pull request in a repository the session may write to, then resolves it with a token of its own for that one repository, which it revokes at once and never hands out.~/AGENTS.mdtells comment agents how, with the GraphQL query that lists a pull request's threads.fctl showprints the level too.Limited access tokens
tokens.scope,fctl_domain::limits::Limits):read(as a viewer),run(as an editor: start and steer sessions, stop and resume its own, keep memory) orfull;limits::allows) refuses everything else before any handler runs: the account, Claude connections, workspaces' people and settings, other tokens, admin. A token handed to CI therefore can't mint itself another one.access.rs. A session whose agent may do more on GitHub than the token allows is read-only to that token, with an error that says why. Lists filter its places in SQL, so pages stay full. WebSocket rechecks apply its limits, and it can't open the dashboard feed. Limits hold however the token is sent, as a bearer token or in a cookie.GET /auth/meshows a limited token only whose it is and the token itself.fctl token NAME --access run -p web -w acme --github comment --days 90;fctl tokenslists tokens and what each does;fctl tokens revoke NAME|ID.fctl whoamidescribes the token in use. Account commands refuse limited tokens clearly instead of showing an empty account.Docs: a new Automation guide: tokens, GitHub access, a GitHub Actions workflow for review agents (one session per pull request, messaged on new commits), forks and other security caveats, and other recipes (triage, nightly maintenance, planning, dashboards, the API). Also updated: architecture (Access tokens, GitHub access), CLI, security, self-hosting, and ADR 0037.
Compatibility
0024addstokens.scopeandsessions.github_access. NULL means today's behavior, so existing tokens and sessions don't change.--github.fctl tokenrevokes a token made without the limits it asked for, andfctl run --githubstops a session started without the level it asked for; both say why.fctl resolvewith "did not understand the request".Verification
~/AGENTS.md, a comment agent pushing and moving nothing, the stale write token dropped;cargo xtask check --quickpasses: fmt, types, Clippy for host and wasm, all Rust tests, 561 web tests.cargo xtask devwith the CLI:run,token,tokens,projects create,adminand memory writes with "it only reads projects and sessions";claude statussays it can't see the account.--github pushis refused;Project not found), and doesn't follow its sessions;fctl projects set --github readrefuses--github push("This project's agents may at most read on GitHub"), defaults new sessions to read, and an earlier session now shows "reads only".~/AGENTS.md.fctl resolvewent sandbox → fctl-agent → host → control plane, which answered "No GitHub App is configured" (the dev stack has none); malformed thread ids are refused.fctl resolvelocally.Not verified: resolving a thread against real GitHub. The dev stack has no GitHub App, and GitHub doesn't document which App permission
resolveReviewThreadneeds. Several community reports saycontents: write, which is what the control plane's token gets; one more report saw the same error but didn't trycontents: write. If GitHub refuses, the agent gets GitHub's message and is told to name the threads in its reply instead.Screenshots
At 36a1395, from the dev stack.
Settings → Access tokens, each with a sentence that says what it does (light):
The new token dialog, for review agents in one project (light and dark), and on a phone:
The token, once (masked here), with a command that uses it:
The task box's new On GitHub list (desktop, light), and on a phone (dark), where it is a symbol in the joined model/effort control:
A session whose agent only comments: the chip beside its status, On GitHub in its details, and its commit "kept in the sandbox":
A project's Agents on GitHub setting (dark):
Related
docs/automation.md.Session: https://app.fctl.sh/s/ses_01M5HPGZ4R0NQCXSMFR659JEHJ