Repository navigation
fix(control): keep recording a session's pull requests until D1 has them - #681
Merged
kalaspuff merged 3 commits intoDec 4, 2026
Merged
Conversation
A session records each pull request its agent finds in D1's pull_request_sessions, which GitHub's webhooks, review agents' findings and follow-ups find sessions by. It did so once, in the background, as its agent first reported the pull request: a D1 error or a deploy that cut it short left the session listing the pull request while hearing nothing of it, for good, as the hourly sweep looks up only the rows it has. Now the session keeps the pull requests it hasn't recorded (fctl_domain::pulls::Unrecorded) and its alarm records them, trying again a minute later and then as long after as it has tried, up to an hour, for a day. The hourly job records those that sessions of the last two weeks list but D1 doesn't (pull_requests::heal), which also covers a project or workspace that reaches a repository only later, and existing sessions that missed theirs. Either way the session then gets what it would have: its reviews' unsent findings, a lookup, and its agent word of conflicts.
This comment has been minimized.
This comment has been minimized.
… recorded From the review of #681: a session cleared what it hadn't recorded as soon as the rows were in D1, though passing on its reviews' findings came after, and nothing passed those on once the rows were there. It now counts a try once both are done; a lookup that fails is left to the hourly job, which looks up first the rows nobody has. The hourly job also went by when sessions were created, so an older session that found a pull request today, and couldn't record it for a day, got no repair: it now goes by when sessions last changed.
This comment has been minimized.
This comment has been minimized.
… send From the review of #681: reviews::listed logged a send that failed and returned Ok, so the session counted its pull requests recorded and never sent those findings. It now tries every review and then returns the first error, and the session tries again; findings that went meanwhile don't go twice, as sending claims them first.
kalaspuff
approved these changes
Dec 4, 2026
kalaspuff
deleted the
fctl/1826-i-have-one-session-that-doesn-t-seem-to
branch
December 4, 2026 07:24
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.
Summary
A session hears GitHub's news about a pull request (checks, state, conflicts, review findings, comments that mention
@fctl) only once the pull request is recorded as the session's in D1 (pull_request_sessions). The session recorded each one only once, in a background task, when its agent first reported it. If that task failed (a D1 error) or was cut short (a deploy resets the session's object), the session kept listing the pull request but heard nothing of it, permanently: the hourly sweep looks up only the rows it already has. That fits a session whose pull request cards show no checks and whose review says "Its findings went to no session".This makes the recording heal itself, in two layers:
Either way, the session then gets what it would have got at the start: the findings its reviews kept for it, a lookup of checks and state, and, where its project follows up on conflicts, word of them to its agent.
The new logic has unit tests, and the hourly job's query has tests against the D1 stand-in: what it records (an old session's new pull request included), and what it leaves out (merged pull requests, repositories out of reach, archived, quiet and review sessions, rows already recorded).
cargo xtask check lintand the fctl-control and fctl-domain test suites pass. I couldn't run it end to end, as dev projects have no repository and open no pull requests.Worth confirming
fctl session
Note
Medium risk. It changes how a session's object records its pull requests in D1 and hands review findings to it, which webhooks, review findings and follow-ups depend on, though only the retry and repair paths are new.
What it does. A session that lists a pull request now keeps it in its own storage and retries from its alarm, with growing waits for up to a day, until D1 records it and the reviews' unsent findings have gone to the session. After a day, the hourly job repairs it, going by
sessions.updated_at.reviews::listednow returns the first error of a failed send once it has tried every review, so a failed hand-over counts as an unfinished try.Retry state in the session. A new
unrecorded_pull_requestsentry in each session's storage and a new step in the session's alarm; the hourly repair scanssessionsby the unindexedupdated_at.fctl review's first look at
687f118· 5 files, +607 −43 · Review agent settings