Repository navigation
feat: a page of pull requests, sorted by what each needs next - #442
Conversation
/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.
This comment has been minimized.
This comment has been minimized.
…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.
This comment has been minimized.
This comment has been minimized.
…st when a refresh fails
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
# Conflicts: # web/src/components/shell/command-palette.tsx
|
fctl reviewed The only change since the last review is a merge of Reviewed by fctl · Review agent settings |
| 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 }; |
There was a problem hiding this comment.
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.
# Conflicts: # crates/fctl/src/main.rs
|
fctl reviewed Since the last review, the only change is a merge of Reviewed by fctl · Review agent settings |
| 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"; |
There was a problem hiding this comment.
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.
| return "ready"; | |
| if (l.sessions.some((x) => AT_WORK.includes(x.status) || x.question)) return "working"; | |
| return "ready"; |
Found by fctl review in 0be2ee5.
Summary
A page of pull requests, at
/pullsand 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: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, whichshop#12and#12find 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.GET /api/v1/sessionstakes?pulls=open|merged|closed|any: the sessions that list a pull request (frompull_request_sessions) whose ownpull_requestshas one in that state. The page and the CLI ask foranyand 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.fctl pullsprints the same list (-p,-w,--state open|merged|closed|all,--mine,--json). The grouping isfctl_domain::pulls::listed, the twin of the web app'slib/pull-list.ts.I checked it in
cargo xtask demo, in both themes. Along the way I found thatpull_request_sessions.stateonly 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 checkand the web tests pass.Screenshots
From
cargo xtask demo, 1440 px wide, cropped to the page.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'smain.rs, so whichever merges second needs main merged in first; #443 shows how that resolves.Worth confirming
fctl session
Note
Medium risk. It adds a
pullsfilter to the sessions list query, afctl pullscommand 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 pullsto 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 apullsfilter 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.tsandfctl_domain::pullseach 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