Skip to content

feat: a page of pull requests, sorted by what each needs next - #442

Merged
kalaspuff merged 10 commits into
mainfrom
fctl/850-pull-requests
Nov 7, 2026
Merged

kalaspuff merged 10 commits into
mainfrom
fctl/850-pull-requests

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A page of pull requests, at /pulls and in ⌘K. It lists the pull requests agents opened or worked on, each once, with the sessions that list it. Open ones are sorted by what each needs next:

  1. Ready for review: their agents finished, and nothing failed.
  2. Checks failing.
  3. Agents at work.
  4. In a merge queue.
  5. Drafts.

Merged and closed ones are grouped by when that happened. Each row shows the repository and number, the session and its status, the checks, fctl's review and who started it. The row opens the session, and the arrow opens the pull request on GitHub. Tabs count each state. A filter matches the title, the reference as the row shows it (acme/shop#12, which shop#12 and #12 find too), the link, or a session, a picker narrows the list to a workspace or project, and Mine keeps the ones from your own sessions. On the keyboard, j and k move, Enter opens the session, o opens GitHub, and / filters. The page stays live: the feed patches the sessions it is built from, and refetches it when a session lists a new pull request. If the list doesn't load, the page says so with Try again; if a later refresh fails, the list stays and a line above it says it didn't refresh.

  • API. GET /api/v1/sessions takes ?pulls=open|merged|closed|any: the sessions that list a pull request (from pull_request_sessions) whose own pull_requests has one in that state. The page and the CLI ask for any and give each pull request the state from the session that heard of it last, since several sessions can list one and an earlier one may still say open.
  • CLI. fctl pulls prints the same list (-p, -w, --state open|merged|closed|all, --mine, --json). The grouping is fctl_domain::pulls::listed, the twin of the web app's lib/pull-list.ts.

I checked it in cargo xtask demo, in both themes. Along the way I found that pull_request_sessions.state only changes when the control plane hears from GitHub: in the demo every row still said open while the sessions said 18 were merged. That is why the filter reads the sessions' own lists. Unit tests cover the grouping, the filter and the "what it needs" rules in Rust and TypeScript, the CLI's arguments, the ⌘K entry, and the page when the list fails to load or to refresh. Clippy, npm run check and the web tests pass.

Screenshots

From cargo xtask demo, 1440 px wide, cropped to the page.

Open pull requests, dark
Open pull requests, light
Merged, by day

Related

The sidebar work comes in four pull requests: #440 (merged), this one, #441, and #443, which builds the tree sidebar on all three. This branch has main merged in since #440 merged. #441 and #442 both add a command on neighboring lines of fctl's main.rs, so whichever merges second needs main merged in first; #443 shows how that resolves.

Worth confirming

  • Decision: the page lists what fctl's sessions found, not every pull request in the connected repositories; people's own pull requests stay on GitHub, and those fctl reviews stay in the project's Reviews tab.
  • Decision: "Ready for review" means open, not a draft, its agent's session not at work, and no failed checks. It doesn't wait for fctl's review agent.
  • Decision: the page looks at the newest 200 sessions with pull requests, and says so when there are more; narrowing it to a project reaches older ones.

fctl session


Note

Medium risk. It adds a pulls filter to the sessions list query, a fctl pulls command and a new web page with live refetching, but only reads existing data and changes no stored data.

What it does. Adds a Pull requests page to the web app, and fctl pulls to the CLI, that list every pull request the sessions know of, once each, in tabs for open, merged and closed. Open ones are grouped by what they need next: ready for review, checks failing, agents at work, in a merge queue, or draft. The sessions list API gets a pulls filter to feed it, and the live feed refetches those lists when a session finds a new pull request.

Two twins of one rule. web/src/lib/pull-list.ts and fctl_domain::pulls each implement the grouping rules, so a change to one has to be made in the other.

fctl review's first look at 0be2ee5 · 21 files, +1320 −7 · Review agent settings

fctl-sh Bot added 3 commits November 7, 2026 01:14
/pulls lists the pull requests agents opened or worked on, each once
with the sessions that list it, as the session that heard of it last
has it. Open ones come sorted by what they need: ready for review
(their agents finished and nothing failed), checks failing, agents at
work, in a merge queue, drafts; merged and closed ones by when. Tabs
count each state, a filter finds them by title, repository, number or
session, a picker narrows them to a workspace or a project, and Mine to
your sessions'. j/k move through them, Enter opens the session, o the
pull request on GitHub, / filters. The feed keeps it current.

GET /api/v1/sessions takes ?pulls=open|merged|closed|any for it, and
fctl pulls lists the same in a terminal (fctl_domain::pulls::listed).
Pull requests is in ⌘K too.
The open pull requests come in a list of their own, as the sidebar
will ask for them, so that the page shows them at once; the merged and
closed ones load beside them for their tabs and counts. Shorter copy
and a filter hint that fits.
The pulls filter read pull_request_sessions.state, which changes only
when the control plane hears from GitHub: pull requests that agents saw
merged on an instance without webhooks stayed open there, and the page
counted none merged. The filter now reads the sessions' own lists, as
their pages show them. The page and fctl pulls ask for every state and
take each pull request's from the session that heard of it last, since
one that heard of it earlier may still say open.
@fctl-sh
fctl-sh Bot requested a review from kalaspuff as a code owner November 7, 2026 01:28
@fctl-review

This comment has been minimized.

Comment thread web/src/routes/pulls.tsx Resolved
Comment thread web/src/routes/pulls.tsx Resolved
Comment thread web/src/routes/pulls.tsx Resolved
Comment thread crates/fctl/src/cmd/pulls.rs Resolved
Comment thread crates/fctl-domain/src/pulls.rs Resolved
…e live

- Merged and closed ones come by when they merged or closed, in their
  days' order, with that time on their rows: GitHub's last change (a
  comment, say) put one merged long ago first.
- A session that lists a new pull request brings the lists of pull
  requests again: one opened mid-run showed only once its session's
  status changed.
- The page says when it can't load, with Try again.
- fctl pulls says when it looked at only the newest sessions, and its
  --json carries next_before.
- fctl_domain::pulls::listed keeps only GitHub's pull request links, as
  the web app's list does.
@fctl-review

This comment has been minimized.

Comment thread web/src/lib/pull-list.ts Resolved
Comment thread web/src/routes/pulls.tsx Resolved
@fctl-review

This comment has been minimized.

Comment thread web/src/routes/pulls.tsx Resolved
@fctl-review

This comment has been minimized.

Comment thread web/src/routes/pulls.tsx Resolved
@fctl-review

fctl-review Bot commented Nov 7, 2026

Copy link
Copy Markdown

fctl reviewed 960ddb0 and found 1 issue.

The only change since the last review is a merge of main (project icons, #440); its one conflict, in command-palette.tsx, is resolved correctly and keeps both sides.

Reviewed by fctl · Review agent settings

Comment thread web/src/routes/pulls.tsx
const scope = { workspace: kind === "w" ? slug : undefined, project: kind === "p" ? slug : undefined };
// Every session that lists one, whatever its state: each pull request takes the state the session
// that heard of it last says, which one that heard of it earlier may not.
const q = { pulls: "any" as const, limit: LOOK_AT, ...scope, mine: search.mine };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull requests of archived sessions never show

Medium severity. The query q doesn't set archived, so the server adds AND s.archived = 0 and leaves out archived sessions. Once someone archives the session that opened a pull request, it drops out of every tab and count (the merged and closed ones most, since finished sessions are the ones people tidy away), and fctl pulls does the same. Neither the page nor the empty state says so.

Found by fctl review in 960ddb0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and I missed it before #442 merged. It's tracked in #446. That issue leaves to a person whether archived sessions' pull requests show in every tab or only under Merged and Closed, and fctl pulls needs the same change.

@fctl-review

fctl-review Bot commented Nov 7, 2026

Copy link
Copy Markdown

fctl reviewed 0be2ee5 and found 1 issue.

Since the last review, the only change is a merge of main (fctl ask, #441), which merges cleanly with this pull request. The earlier open finding about archived sessions still applies.

Reviewed by fctl · Review agent settings

Comment thread web/src/lib/pull-list.ts
if (s === "draft") return "draft";
if (checksMark(l.pr) === "failed") return "failing";
if (l.sessions.some((x) => AT_WORK.includes(x.status))) return "working";
return "ready";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A pull request whose agent asked a question shows as ready for review

Low severity. needOf ends in "ready" for any session that isn't at work, but since #441 an idle session can hold an open question (from fctl ask) and wait for a person's answer. Its pull request then sits under "Ready for review", whose hint says the agents finished, when the agent is waiting for input.

Suggested change
return "ready";
if (l.sessions.some((x) => AT_WORK.includes(x.status) || x.question)) return "working";
return "ready";

Found by fctl review in 0be2ee5.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, and I missed it before #442 merged. It's tracked in #446. That issue leaves to a person whether such a pull request goes under "Agents at work", as you suggest, or in a group of its own; either way it shouldn't count as ready.

@kalaspuff
kalaspuff merged commit ce9e4f0 into main Nov 7, 2026
12 of 13 checks passed
@kalaspuff
kalaspuff deleted the fctl/850-pull-requests branch November 7, 2026 10:47
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