Skip to content

docs: add fctl's Automation page, and what limited tokens keep - #40

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/133-it-would-be-great-to-be-able-to-create-a
Oct 22, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/133-it-would-be-great-to-be-able-to-create-a

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

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

fctl's docs gain docs/automation.md (hyperstructure/fctl#207): access
tokens limited to what they are for, and review agents from GitHub
Actions. It renders at /docs/automation/, beside the CLI.

The privacy policy says what app.fctl.sh keeps of an access token's
limits and of what a session's agent may do on GitHub, and that the
task being written keeps the GitHub access chosen for it.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner October 22, 2026 12:43
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Oct 22, 2026
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`)
- A session asks for a level as it starts
(`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.
- GitHub enforces it, not the agent. The session's GitHub token carries
the level's permissions (`fctl_domain::repos::permissions`):
- comment: `pull_requests` and `issues` write, `contents` read, no
`workflows`;
  - read: one read-only token for every repository.
- Lowering a project's level reaches running sessions with their next
token (within the hour), the same way removing a repository does.
- fctl-agent pushes nothing for these sessions, moves no work onto
session branches, and tells Claude what it may do instead of how to
push. The transcript says so as the session starts.
- **Resolving review threads.** GitHub only lets tokens that can write
contents (and therefore push) resolve review threads. So an agent that
comments runs `fctl resolve PRRT_…` in its sandbox, a new agent call
like `fctl 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.md` tells comment agents how, with the
GraphQL query that lists a pull request's threads.
- The session page shows a **Comments only** / **Read only** chip beside
the status and an **On GitHub** row in the details. Changes says "kept
in the sandbox" rather than "not pushed yet". `fctl show` prints the
level too.

**Limited access tokens**
- A token can be limited three ways (`tokens.scope`,
`fctl_domain::limits::Limits`):
- what it does: `read` (as a viewer), `run` (as an editor: start and
steer sessions, stop and resume its own, keep memory) or `full`;
- where: some workspaces (including projects made later) and/or some
projects;
  - the most its sessions' agents may do on GitHub.
- A limited token reaches projects and sessions only. One rule in the
router (`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.
- Its roles are capped in `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/me` shows a limited token only whose it is and the token
itself.
- Sessions started by a limited token don't auto-follow, since every
finished CI review would otherwise notify its owner.
- **Web:** Settings has a new **Access tokens** section, separate from
**Devices**. Its dialog asks the three questions plus expiry, shows in a
sentence what the token will do before it's created, and shows the
secret once with a ready-to-run example.
- **CLI:** `fctl token NAME --access run -p web -w acme --github comment
--days 90`; `fctl tokens` lists tokens and what each does; `fctl tokens
revoke NAME|ID`. `fctl whoami` describes the token in use. Account
commands refuse limited tokens clearly instead of showing an empty
account.

**Docs:** a new [Automation](docs/automation.md) 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](docs/adr/0037-access-tokens-and-sessions-limit-what-agents-do-on-github.md).

## Compatibility

- Migration `0024` adds `tokens.scope` and `sessions.github_access`.
NULL means today's behavior, so existing tokens and sessions don't
change.
- New fields are optional, and the new agent call is a new variant.
- An older **control plane** ignores token limits and `--github`. `fctl
token` revokes a token made without the limits it asked for, and `fctl
run --github` stops a session started without the level it asked for;
both say why.
- Older **hosts and agents** ignore a session's level. Their agents try
to push, and GitHub refuses.
- An older agent answers `fctl resolve` with "did not understand the
request".

## Verification

- **Unit tests:**
- domain: the router rule, role caps, the GitHub level decision,
permission sets, stored-limits round trip and fail-closed parsing, the
read-only token plan, thread GraphQL parsing, keeping the project
setting when an update omits it;
- agent: prompts for each level, `~/AGENTS.md`, a comment agent pushing
and moving nothing, the stale write token dropped;
  - CLI: token descriptions;
- web: token form logic, start choices, the composer picker, the draft,
"kept in the sandbox".
- `cargo xtask check --quick` passes: fmt, types, Clippy for host and
wasm, all Rust tests, 561 web tests.
- **End to end on `cargo xtask dev`** with the CLI:
- **Read token:** reads sessions and logs; refused `run`, `token`,
`tokens`, `projects create`, `admin` and memory writes with "it only
reads projects and sessions"; `claude status` says it can't see the
account.
  - **Run token, one project, comment cap:**
    - its sessions default to comment, and `--github push` is refused;
- it doesn't see the other project (`Project not found`), and doesn't
follow its sessions;
- it can message and stop its own sessions, but can't message, resume or
stop a pushing session ("…may at most comment on GitHub, and this
session's agent may push: the token only reads it").
  - **Workspace token:** sees that workspace's projects.
  - **Validation:** blank or unknown places are refused.
  - **Cookie:** the read token sent as a cookie is still limited.
- **Project cap:** `fctl projects set --github read` refuses `--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".
- **Agent side:** a comment session on a public repository got the
comment-only system prompt, the transcript line, and the "Review
threads" section in `~/AGENTS.md`.
- `fctl resolve` went sandbox → fctl-agent → host → control plane, which
answered "No GitHub App is configured" (the dev stack has none);
malformed thread ids are refused.
    - A read session's agent refuses `fctl resolve` locally.
- Screenshots via Playwright against the dev stack, both themes, desktop
and phone.

**Not verified:** resolving a thread against real GitHub. The dev stack
has no GitHub App, and GitHub doesn't document which App permission
`resolveReviewThread` needs. Several community reports say `contents:
write`, which is what the control plane's token gets; one more report
saw the same error but didn't try `contents: 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 access tokens
list](https://app.fctl.sh/api/v1/published/8L6fz2OozyzzaUdwFFAvwc0lLPt0dsGvdaJZRWzVnsu/settings-tokens-light.png)

The new token dialog, for review agents in one project (light and dark),
and on a phone:

| Light | Dark | Phone |
|---|---|---|
| ![The new access token dialog,
light](https://app.fctl.sh/api/v1/published/dY7kVzioIQ3zawM7ZZiPB9oCHs4Z7Qk3ZntPRWP4QoI/new-token-light.png)
| ![The new access token dialog,
dark](https://app.fctl.sh/api/v1/published/PbjpYHb5U0L8ifKj7OYRQOPl2sUWE3ziTRsqLpV3r9v/new-token-dark.png)
| ![The dialog on a phone, a whole workspace
chosen](https://app.fctl.sh/api/v1/published/tB1Gq4TtgTSnZuQPbEKPha8mzNjI2v75cLCBVV8qN31/new-token-phone-light.png)
|

The token, once (masked here), with a command that uses it:

![The new token and how to use
it](https://app.fctl.sh/api/v1/published/CacY4JnnHnYzTu48dqnOaZ0GjAP1TSKvV6WQ8OE71Pj/token-made-light.png)

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:

| Desktop | Phone |
|---|---|
| ![The composer's GitHub access
list](https://app.fctl.sh/api/v1/published/jOKYsTudxjsae0OkZSb8wvkDgbMf0j72RRF5zySb80C/composer-light.png)
| ![The composer on a
phone](https://app.fctl.sh/api/v1/published/fy3bccbkJXSFD26e2YyaufrIk6EMGULCjICdBB2Uh8x/composer-phone-dark.png)
|

A session whose agent only comments: the chip beside its status, **On
GitHub** in its details, and its commit "kept in the sandbox":

| Light | Dark |
|---|---|
| ![A comment-only session,
light](https://app.fctl.sh/api/v1/published/ZQl4RnQFF02TvsPl8Joda7wGKw7eUUGmK3Nfm8BKmsA/session-light.png)
| ![A comment-only session,
dark](https://app.fctl.sh/api/v1/published/fnUaOD9h5bSlxXhLTRJbKoyGj4st7fUAjWLT42YFcAw/session-dark.png)
|

A project's **Agents on GitHub** setting (dark):

![The project
setting](https://app.fctl.sh/api/v1/published/kqcErANRFvzSpqSLBl9K2brDXp9d5sB0ZV9shSUgCN4/project-settings-dark.png)

## Related

- hyperstructure/fctl-site#40 adds the Automation page to fctl.sh/docs
and updates the privacy policy (what tokens and drafts keep). It must
merge **after** this one, once fctl's CI has pinned a docs commit that
has `docs/automation.md`.

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

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
@kalaspuff
kalaspuff merged commit 4cca71b into main Oct 22, 2026
4 checks passed
@kalaspuff
kalaspuff deleted the fctl/133-it-would-be-great-to-be-able-to-create-a branch October 22, 2026 13:14
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