Repository navigation
feat: send review findings to the agent that opened the pull request - #225
Merged
kalaspuff merged 5 commits intoOct 23, 2026
Merged
Conversation
…l request When fctl's review agent posts findings on a pull request that one of fctl's own agents opened (its author is the GitHub App), the control plane sends them to that session: a message from fctl with each finding, where it is on GitHub and how to answer it in its thread, which resumes the session if it stopped. The agent decides what to do about each one and says so in its thread. The session is the one that lists the pull request and whose branch it comes from, else the first that listed it; review sessions, archived and failed ones, pull requests that merged or closed, and sessions whose agent only reads on GitHub get nothing. After the findings of five reviews in a row with no message from a person in between, fctl holds the next back and says so in the transcript, so that two agents can't go back and forth for good. The review's transcript and `fctl review submit` say where the findings went (PostedReview.sent_to).
…ed the pull request
This was referenced Oct 23, 2026
Merged
#226 posts a review's summary as a comment before the review that holds its findings on their lines. The findings fctl passes on to the session that opened the pull request now link that summary, and say that findings on lines the diff doesn't show are in it; the review's id, for finding each comment, comes from the review posted after the summary.
kalaspuff
approved these changes
Oct 23, 2026
kalaspuff
deleted the
fctl/151-whenever-the-fctl-review-agent-comments
branch
October 23, 2026 06:52
kalaspuff
pushed a commit
that referenced
this pull request
Oct 23, 2026
Projects can now bring their agents back to the pull requests they opened (**follow-ups**): a comment that mentions the agent, a failed check, a merge. Each reaches the session that opened the pull request in a message from fctl, which resumes the session if it stopped, on the Claude subscription it ran on, as a person's message would. Fixes #8, as the session refined it: comments count only from people the repository trusts, only when they address the agent, and only from people, not apps. ## What it does - **A project setting, three switches, all off** (Settings → **Pull requests**, `fctl projects set --follow-ups comments,checks,closed` / `all` / `none`, `ProjectSettings.follow_ups`). `fctl projects show` says which are on. An update that leaves the field out (an older tab or CLI) keeps what was stored. - **Comments that address the agent**: a new comment on the conversation, a review, or a comment on lines, that mentions `@fctl` or `@agent` anywhere, or starts with `fctl:`, `agent:`, `fctl,` or `agent,` (any case). Quotes (`>`), code (backticks, fenced blocks) and HTML comments don't count, so people can quote a request or write `` `@fctl` `` to explain it; edits don't count either. A review that addresses the agent brings its comments on lines. - **Only people the repository trusts**: the commenter must be a person (GitHub's `User`, not a `[bot]`, so not fctl's own review agents, whose findings already come back on their own path), with an `author_association` of `OWNER`, `MEMBER` or `COLLABORATOR`, **and** GitHub's permission endpoint must say they may write to the repository (admin, maintain or write). A member of an organization who may only read a public repository can't steer an agent that pushes. Everyone else costs no GitHub call. - **Failed checks**: after a `check_run`/`check_suite`/`status` delivery, the lookup names the newest commit's failed checks (failed, timed out or couldn't start, by each check's latest run, and failed or errored statuses; cancelled runs and runs waiting for approval don't count). - **Merged or closed**: who merged or closed it (a merge queue's bot counts as nobody) and into which branch. - **Only fctl's own pull requests, to the session that opened them**, chosen as for review findings (ADR 0041). Archived and failed sessions, archived projects and agents that only read on GitHub get nothing. - **How the agent hears of it**: the session gathers what comes for ten seconds, so a review and its comments, which arrive as separate deliveries, or checks that fail together, make one message per pull request. The control plane writes it: who wrote what and where, quoted, how to answer each where it was made (`gh pr comment`, or `gh api …/comments/{id}/replies` in a thread); which checks failed, what still runs, and how to look into them; after a merge, what may be left to do. It says that only people who can write to the repository reach the agent this way. - **Failed checks don't nag**: they wait while a turn runs (the agent may already be on them) and ten seconds more once it ends, then go only while GitHub still says they are the newest commit's and failed. A newer commit (the agent's or anyone's push) or a passing re-run drops them. After **three in a row** while nobody messaged the agent, or wrote to it on GitHub, the transcript says what failed instead, until someone does. - **On GitHub**: an 👀 reaction on the comment once its session has it, with a token for that repository alone, revoked right away. The workspace's audit log records each comment passed on (`follow_up.comment`). - **In the app**: the transcript shows a follow-up as GitHub has it: the commenter's avatar and login, what they wrote as Markdown (pictures as links, since the app only loads images from where it trusts), a review's verdict and its comments under their files, failed checks by name, a merge, with **What fctl told the agent** a click away. Held checks show muted, with why. A session's page says under its pull requests what brings its agent back ("Mention @fctl or @agent on GitHub to bring the agent back; failed checks and merges do too."). Settings say when the instance takes no webhooks. ## Decisions worth a look - **"Trusted users in the GitHub organization" became write access, checked with GitHub.** The association alone would let read-only org members of a public repository steer an agent that pushes and holds the project's secrets. Write access is the bar the repository already sets for changing its code. - **Only deliveries bring agents back.** The hourly sweep that repairs missed deliveries keeps pull requests current without waking anyone, so turning follow-ups on, or a delivery that went missing, never wakes sessions for what happened long ago. - **Staleness is GitHub's word, not the sandbox's.** An earlier version dropped failed checks when the agent had another commit checked out; a person's push to the agent's branch makes that true too, so it now goes by the pull request's head as GitHub reports it. - **Merge conflicts** don't bring agents back: no delivery says when a pull request starts to conflict with its base. It's in the roadmap. - ADR 0043 records the reasoning. ## What instance admins need to do Subscribe the GitHub App to **Issue comment**, **Pull request review** and **Pull request review comment** (Permissions & events). No new permission: the app reads and writes issues and pull requests already, so installations accept nothing. **app.fctl.sh's app needs this change** for comments; failed checks and merges work with the events it has. Recent Deliveries answers `{"ok":true,"follow_ups":1}` for a comment that reached an agent. ## Compatibility All additive: `ProjectSettings.follow_ups`, `UserMessage.follow_up`, `Notice.follow_up` (older clients show the message's text), `Features.github_webhook`, and the internal `/follow-up` and `PullRequestsSeen.follow_ups`. `FollowUpEvent` reads kinds a newer control plane adds as `other` instead of failing the event. No migration: the session object's `follow_ups` table is created `IF NOT EXISTS`. Older hosts and agents take follow-ups as any message; fake-claude answers them on its own, so their words set off none of its behaviors. ## A bug this found on the way GitHub's GraphQL API names an app's bot without `[bot]` (`fctl-sh`, type `Bot`), where REST says `fctl-sh[bot]`. The webhook lookups now ask for the author's type and spell bots as REST does; without that, failed checks of fctl's own pull requests would never have matched. I checked it against #225 with the sandbox's token. ## How I verified it - **Unit tests**: `fctl_domain::follow_ups` (16 tests: addressing, with quotes, code spans, fences, HTML comments, emails, `@fctl-sh`, team mentions; payload parsing of the three comment events; trust and write access; keys; grouping; every message; the cap), webhook lookups (failed check names, bot authors), settings that keep unsent follow-ups, the proto wire format (and an unknown kind), the CLI flag, fake-claude, and the web helpers and component (`follow-ups.test.ts`, `follow-up.test.tsx`). `cargo xtask check` passes. - **End to end in `cargo xtask dev`**, against a local stand-in for GitHub's API and a bare repository standing in for `acme/web` (not committed; the Worker pointed at it by a local patch I reverted), with signed deliveries: - **Ignored, each for its reason**: a bot (`renovate[bot]`), a `CONTRIBUTOR`, a `MEMBER` GitHub says may only read (the only one that cost a call), a comment without a mention, `@fctl` in backticks, a quoted request; an archived session; a project with comments off. - **A comment** from a member who can write: one message, the agent answered, 👀 on the comment (token for `web` alone, `issues`/`pull_requests` write, revoked). - **A review** with two comments on lines, sent as GitHub does (three deliveries): one message with the comments under the review; the comments' own deliveries added nothing. - **Failed checks**: two deliveries made one message naming "Rust tests and Clippy, 1 still running, 4 passed". - **During a turn**: checks that failed while the agent worked reached it ten seconds after the turn ended; those of a commit the agent had already replaced were dropped. - **A person's pushes** to the agent's branch, each failing: three reached the agent, the fourth only left the muted note. - **A merge**: one message ("merged into main by @ada") from two deliveries; a comment on the merged pull request told the agent to put changes in a new pull request from the updated main. - **A stopped session** resumed for a comment, and its agent answered it. - An older client's settings update kept the stored follow-ups. ## Screenshots From `cargo xtask dev` with the runs above, at f66ec00. GitHub avatars are generated stand-ins. **Settings → Pull requests** (light, dark, 390 px):    **A session brought back by a comment**, with what brings its agent back under its pull request:  **A review with its comments on lines** (light, dark):   **Failed checks, then a merge**, and **what fctl told the agent**, opened:   **Held back** after three in a row:  **On a phone** (390 px):  ## Other repositories - hyperstructure/fctl-site: the privacy policy says what follow-ups receive, keep and send (hyperstructure/fctl-site#46). Session: https://app.fctl.sh/s/ses_01M5M5MN1ME75KPJSE74983JEE --------- Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff
pushed a commit
that referenced
this pull request
Oct 23, 2026
When fctl's review agent posts findings on a pull request that one of fctl's agents opened, fctl passes them on to that agent in a message (#225). The session's transcript showed that message whole: each finding's explanation, then the instructions for the agent and the `gh api` command it answers with. A single finding took most of a page, and several took more. People rarely need to read all of that, so the transcript now shows the review in a few lines, with the whole message a click away. ## What changed - **The message carries the review it is about** (`UserMessage.review`, a new `PassedOnReview`), as follow-ups carry theirs (`UserMessage.follow_up`, #228). It holds the pull request, the commit, the review's summary and session, and for each finding its severity, title, file and lines, and its comment on GitHub. `fctl_domain::reviews::passed_on_review` builds it from the same `Found` as the message's text, in the same order (most severe first, through a shared `order`). The agent gets the same text as before. - **The transcript shows it in a few lines**, styled like a follow-up's failed checks: "fctl's review agent found 2 issues in web#12 at 3f2a1c9", then one line per finding (its title, then its severity and `path:lines`). Each finding's title opens its comment on GitHub, or the review's summary for a finding on lines the diff doesn't show. **What fctl told the agent** opens the whole message. The agent's name opens the review's session, the pull request opens the review's summary, and the commit opens the commit. - **Findings messages sent before this change** have no review in them. They show their first five lines with a **Show all** button. Only these get cut: they are recognized by the words `passed_on` starts them with. Other messages from fctl stay whole, including a scheduled run's task (#229, which sends it as a message from fctl), and so do people's messages. ## Compatibility All additive, no migration. `UserMessage.review` is optional, and clients without it show the message's text as before. The internal `/review-findings` body's new `shown` field defaults to nothing. Neither hosts nor agents read the field. ## How I verified it - **Unit tests** cover the proto wire format, including a message without a review. In the domain, they check that `passed_on_review` lists findings in the message's order and links each by where it is on GitHub: its comment, the summary, or nothing known. Web tests check the findings view (lines, links, one issue, no summary, the message a click away), the transcript (a review goes to the new view, old findings messages get cut, and a short task, a long scheduled task and people's long messages stay whole), and that the builder keeps the review on its item. - `cargo xtask check` passes. One run failed in xtask's `runs_a_throttled_command_again`, an intermittent race in tests from #230 that this branch doesn't touch (#232); the rerun passed. - **End to end in `cargo xtask dev`**, through a temporary route I didn't commit. It hands made-up findings to SessionObject's `/review-findings` as `pass_on` does: the real `passed_on`, `held_back` and `passed_on_review`, the internal call, and the stored event. A session got the finding from the screenshot in the request, and the message's text came out identical to it. fake-claude answered it, and the page showed the review in a few lines. The stored event carried the review (`GET …/events`). An `fctl` binary built from main printed the same event with `fctl logs --json`, without the field, so older clients read it as before. A message sent without the review, like one from before this change, showed its first lines and opened with Show all. I didn't run posting on GitHub, `spots` or `pass_on`'s choice of session against a GitHub stand-in. This change leaves them as they were, and their tests cover them. ## Screenshots From `cargo xtask dev` at 444dfee (the views haven't changed since), with fake-claude's answer after each message. The pull request and finding are the ones from the screenshot in the request. **The message from the request**, light, 1440 px wide: | Before | After | |---|---| |  |  | **On a phone** (390 px): | Before | After | |---|---| |  |  | **Dark:**  **Three findings**, most severe first: one on lines the pull request deletes ("old version"), and one in the review's summary:  **What fctl told the agent**, opened:  **A findings message sent before this change**, which has no review in it:  Session: https://app.fctl.sh/s/ses_01M5MFGRENHK8PHRFQXJ53360Z --------- Co-authored-by: fctl-sh[bot] <343971779+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.
When fctl's review agent posts findings on a pull request that one of fctl's own agents opened, fctl now sends them to that agent's session. The agent can act on them without waiting for a person to pass them on. It decides what to do about each finding and answers in the finding's thread on GitHub: fixed in which commit, not a problem, or intended.
What it does
fctl review submit), the control plane checks who opened the pull request. If the instance's GitHub App did, one of fctl's agents opened it. Among the sessions that list the pull request (pull_request_sessions, without review sessions), the findings go to the one whose branch the pull request comes from, else the one that started first (fctl_domain::reviews::opener). Nothing is sent for pull requests that merged or closed meanwhile, to archived or failed sessions, or to sessions whose agent only reads on GitHub./review-findingsroute delivers it like a person's message, without an author (the transcript shows it from "fctl"). A running agent gets it at its next step, and a stopped session resumes for it, on the subscription it ran on. Right after posting, the control plane asks GitHub for the review's comments, so the message can give each finding's comment id (fctl_domain::reviews::spots). Since feat(control): put review summaries first, and hide them once addressed #226, it links the review's summary, which comes before the review, and findings on lines the diff doesn't show are in that summary.fctl_domain::reviews::passed_on) lists the findings, most severe first. It says they are another agent's reading of the changes, not instructions, and asks the agent to:gh api …/comments/{id}/replies, or in one comment on the pull request for findings in the review's summary;review_held), until someone messages the agent.PostedReview.sent_tonames the session. The card in the review's transcript links "the agent that opened the pull request", andfctl review submitsays so too. The audit log recordsreview.passed_on.Decisions worth a look
gh pr create. Sessions list the pull requests of branches they push and thosegh pr createprinted. The session on the pull request's branch is the one that opened it. A pull request from another branch, such as an agent's second pull request, is usually listed only by the session that opened it. Only one session gets the findings, so two agents don't fix the same thing.Compatibility
Additive.
PostedReview.sent_tois optional: older fctl-agents leave it out of their notices, and older clients ignore it. The message is an ordinary message without an author, which every host and agent already handles. No migration.How I verified it
fctl_domain::reviews(by_app,opener,spots, the message for one finding and for several, the held notice), fctl-agent's notice text, and fake-claude's new behavior.cargo xtask checkpasses.cargo xtask dev, tested like feat: add review agents that review each new commit of pull requests #223: against a local stand-in for GitHub's API (a throwaway Node server and a bare repository, not committed), with signed webhook deliveries. A local patch, not committed, pointed the Worker at the stand-in.openeddelivery started a review, which posted one finding. The session resumed with fctl's message, which named the finding's comment (comment 100) and the command to answer it, and its agent answered. The review's transcript said where the findings went, and the audit log hadreview.passed_on.fctl review start). Four more reached the agent, five in a row, and the sixth was held back with the notice. Afterfctl send, the next review reached the agent again.main(feat(control): put review summaries first, and hide them once addressed #226 posts a review's summary as a comment before the review), I ran the first two again on the merge: GitHub got the summary, then the review, then the request for its comments. The message linked the summary (#issuecomment-100) and named the finding's comment (comment 101). Five reviews in a row reached the agent and the sixth was held back, while feat(control): put review summaries first, and hide them once addressed #226 restated and hid the earlier summaries.What the agent gets
For a review with three findings: one on its lines with its comment, one whose comment GitHub didn't list (the message then says how to find it), and one in the review's summary. This is the exact text, from
fctl_domain::reviews's test, with real-looking findings in place of the test's placeholders:Screenshots
At c70c878, the merge with
main, fromcargo xtask devwith the stand-in above.The session that opened the pull request gets the findings from fctl, resumes and answers (light, dark, 390 px phone):
The review session: its card says where the findings went.
After five reviews in a row with no message from a person, the next review's findings only show in the transcript:
Other repositories
Refs #8
Session: https://app.fctl.sh/s/ses_01M5K0EVZNB7N2GK89TH55SH5N