Repository navigation
feat: show changes and pull requests while a session's turn runs - #143
Merged
kalaspuff merged 7 commits intoOct 20, 2026
Merged
Conversation
fctl-agent reported changes, pushes and pull requests only when a turn ended and when the session stopped, so a long turn showed "No changes yet" for as long as it ran. Now it also refreshes the state soon after tool results that can change the repositories (Bash, Write, Edit, NotebookEdit, a subagent's too) and when a background task ends: a burst costs one refresh, two seconds after the last result, and refreshes come at most every ten seconds. A refresh emits a git event only when the state changed. It only reads: pushes and moving work onto the session branch still wait for the end of the turn. It looks up a pull request only where one can have appeared: on a branch pushed since the last report, or whose pushed head moved, or after `gh pr create` ran. One refresh runs at a time; the one after a turn follows the one under way. The refresh reads a copy of each clone's index: `git diff` against the working tree rewrites the index it reads when stat data is stale, under the index lock, even with GIT_OPTIONAL_LOCKS=0, which would make the agent's own `git commit` fail if it ran at that moment. Refs #132
The transcript had a "files changed · commits" line for every git event, one per turn. Now that fctl-agent reports the state while Claude works, most reports only move files, so the session page and `fctl attach` show a line only when a repository's branch changes: a commit of its own, a push, or a pull request the session hadn't had, as decided in #132. The line names only the repositories that changed. The sidebar's Changes section still takes the newest state. The rule is fctl_domain::branches for the CLI and branchChanges in web/src/lib/git.ts for the web app. Refs #132
A refresh that caught a repository mid-rebase reported its HEAD detached: the session's branch would read HEAD until the next one, and the transcript would show the half-replayed commits. A refresh while Claude works now skips such a state; the next tool result calls for another. The supervisor also checks that a refresh is due before it copies the session's configuration, which it did every second. Refs #132
fake-claude takes two more words: `push` pushes the branch, to a bare repository in ~/.fake-github when there is no origin (the dev instance's projects have no repository), and `watch <seconds>` watches the checks in one tool call that long, as agents wait for CI before they end their turn. The smoke test's task uses both, and fails unless the session shows the commit pushed before the first turn's result. Refs #132
ADR 0027 records the decisions in #132: refreshes while Claude works, at most every ten seconds, without pushes, with pull request lookups only where one can have appeared, reading a copy of the index, and transcript lines only when a branch changes. The architecture, development and getting-started docs, EventBody::Git and the comments that said "after each turn" now say so. Refs #132
One refresh of the repositories' state runs at a time, so one that hung (a push or a pull request lookup stuck on the network) would hold back every later report, the ones after each turn included. A refresh now gives up after ten minutes and the next one goes ahead; the commands it ran are killed with it. Refs #132
kalaspuff
approved these changes
Oct 20, 2026
kalaspuff
deleted the
fctl/79-look-into-https-github-com-hyperstructur
branch
October 20, 2026 15:11
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.
Fixes #132
While a session's turn ran, its page said No changes yet., and neither it nor the session lists showed pull requests, even after the agent had committed, pushed and opened one. fctl-agent reported the repositories' state only when a turn ended, and agents often do their whole task, waiting for CI included, in one turn.
What changed
crates/fctl-agent/src/refresh.rs). It refreshes after the results ofBash,Write,EditandNotebookEditcalls, a subagent's too, and when a background task ends. A burst costs one refresh, two seconds after the last result, and refreshes come at most every ten seconds. Agitevent goes out only when the state changed. The end of a turn and a stop still report as before.workspace::Moment). Pushing and moving work onto the session branch still wait for the end of the turn. A refresh looks up a pull request (gh pr view) only where one can have appeared: on a branch pushed since the last report, or whose pushed head moved, or aftergh pr create. A pull request it found stays until a lookup finds another.HEAD.git diff <base>rewrites the index it reads and holdsindex.lockwhile it does, even withGIT_OPTIONAL_LOCKS=0(tested on git 2.39). An agent'sgit commitat that moment would fail with "Unable to create index.lock". The state is now read from a copy of each clone's index, andgit statusruns without optional locks.fctl attach/fctl logs. A change is a commit of the branch's own, a push, or a pull request the session hadn't had, and the line names only the repositories that changed (fctl_domain::branches,branchChangesinweb/src/lib/git.ts). A state that only moves files shows only in the sidebar, which takes the newest state.pushpushes the branch, to a bare stand-in remote in~/.fake-githubwhen there is no origin.watch <seconds>is one long tool call, likegh pr checks --watch. The smoke test now fails unless the session shows the commit pushed before the first turn'sresult.docs/architecture.md,docs/development.md,docs/getting-started.md,EventBody::Git, and the comments that said "after each turn".This follows the decisions in the issue: a refresh at most every ten seconds, no pushes mid-turn, and a transcript line whenever a commit, a push or a new pull request happens.
Compatibility
There is no protocol change, and SessionDO already takes any number of
gitevents. The web app and the CLI decide which states get a line. Sessions from older agents (onegitevent per turn) keep a line only for turns that committed, pushed or found a pull request, and that applies to old sessions' transcripts too. Sessions show changes during turns once their hosts run agents of this release.There will be more
gitevents: at most one every ten seconds while files change. Each one is stored and broadcast and can list up to 500 files.Verification
refresh.rs);result, saying nothing for an unchanged or detached state, and running the after-turn sync once the refresh under way ends (commits_show_while_claude_works);reading_the_state_leaves_the_index_to_the_agent, which fails without the copy);fctl_domain::branches,branchChangesand the transcript builder.commits_pushes_and_watches_the_checks_in_one_turn.cargo xtask dev --smokepasses and prints: "the agent committed "Add notes.md" and pushed it, the session showed both before the turn ended, …". With mid-turn refreshes switched off it fails with "the agent's first turn ended before the session showed its commit pushed".cargo xtask checkpasses.cargo xtask dev,fctl logsshows± 1 files (+3 −0) · 1 commits · pushedwhile the agent watches its checks, and no repeat at the turn's end.Screenshots
These were taken at ab80206; later commits don't change what they show. The session page is in the light theme, 1440 px wide, a few seconds into fake-claude watching its checks after it committed and pushed
notes.md(task: "write notes.md, push it, watch 120 seconds of checks"). The before screenshot is this branch with mid-turn refreshes switched off, which is how agents report today.Session: https://app.fctl.sh/s/ses_01M5CSW6SK9RB34FTXA7ZMHPQV