Repository navigation
feat(features): show diffs on the Sessions and Review agents pages - #106
Merged
Merged
Conversation
The Sessions page gets a section on the diff view: a changed file of platform#437 over its page, and on a phone shop#231's change to money.ts, in place of the session the page showed twice. The Review agents page's review is beside the pull request's change it read, on a phone. The two pages' shots of session pages are taken again, with additions in green. Taken with fctl's xtask/demo/shoot.mjs --features, which defines the new shots (hyperstructure/fctl#386).
kalaspuff
pushed a commit
to hyperstructure/fctl
that referenced
this pull request
Nov 5, 2026
…ge (#386) ## Summary A file under Changes on a session's page now opens its diff in a dialog over the page. The diff is highlighted by the file's language and numbered as the file is, and the words that changed between a removed line and the line that replaced it are marked. Lines go one below the other or side by side (`s`), and wrap with `w` (by default on phones). The session's other changed files sit beside the diff, grouped by directory, and `j`/`k` steps through them. Languages come from Shiki, chosen by the file's name, extension or `#!` line: Markdown, Python, TypeScript, Rust, JavaScript, shell scripts, Dockerfiles, `.gitignore` and `.dockerignore` (a small grammar of our own), `.env` and `.env.example`, Terraform, TOML, JSON, lockfiles in JSON or TOML (`Cargo.lock`, `package-lock.json`, `uv.lock`, others by their first line), and the rest of Shiki's languages. The transcript's Edit, MultiEdit and Write diffs are highlighted too, and numbered as the file is when Claude Code's result carries hunks. Additions are now green wherever the session viewer counts them (the rail's letters, bars and totals, and the transcript's commit and tool lines), and in session rows, so the numbers agree everywhere. The diffs come from the sandbox. Each time fctl-agent reads the repositories' state, it also reads each changed file's diff, gives the file its diff's digest in the `git` event, and hands the diffs to its host. The host sends SessionDO, over the session's uplink, the diffs it doesn't have yet, ahead of the `git` event that lists them. SessionDO keeps the latest diff of each file and serves them at `GET /api/v1/sessions/{id}/diff`, which `fctl diff` prints as git does. Diffs therefore still show after a session stops ([ADR 0074](docs/adr/0074-sessions-keep-their-changes-diffs-for-their-viewers.md)). Along the way, Changes stops listing renamed files as `src/{old.rs => new.rs}` and quoted paths without their quotes, since numstat is now read with NULs. fake-claude's replayed edits and writes now report Claude Code's `structuredPatch` too. Every protocol addition is optional. Hosts and agents from before keep working, and the dialog says why a file from one of them has no diff. Agents send diffs only to hosts that ask for them (`AgentConfig.diffs`). Verified with unit tests in each layer: git output parsing, the agent reading real repositories (renames, untracked and binary files), the supervisor's frame order, the host's framing, and the web app's renderer, dialog and rail. `cargo xtask check` passes. I also ran `cargo xtask demo` end to end: every demo session's agent sent its diffs, the API served them, and their digests matched the sessions' `git` events. The screenshots come from that stack. The privacy policy needs a matching change before app.fctl.sh runs this: the draft below adds it. The demo's shooter (`xtask/demo/shoot.mjs --features`) now also takes the diff view for fctl.sh's Sessions and Review agents pages, which the second draft below puts there; it takes the Review agents page's phone diff in place of that page's phone shot of the same review. ## Screenshots At 7bb9f38, from `cargo xtask demo`. A file's diff over its session (milkfloat#97), dark:  Terraform in the light theme (infra#37):  Side by side (`s`):  The transcript's edits, and Changes in the rail, before and after: | Before | After | |---|---| |  |  | On a phone, 390 px wide, the diff and its list of files: | Diff | Files | |---|---| |  |  | ## Related - hyperstructure/fctl-site#105 - hyperstructure/fctl-site#106 ## Worth confirming - **Decision:** The control plane now keeps code: the latest diff of each changed file (at most 512 KB a file and 8 MB a session, deleted with the session's project), so that diffs show for sessions that have stopped. Asking the live sandbox instead would show nothing for most sessions people read. - **Decision:** The dialog links to the file on GitHub only while the branch is pushed and its pull request isn't merged, since GitHub may delete a merged branch. - **Decision:** Additions are green in session rows on the project and session lists too, not only in the session viewer, so the same numbers have the same color everywhere. [fctl session](https://app.fctl.sh/s/ses_01M6PAS5NQ948REQTXK0C18MGQ) <!-- FCTL_REVIEW_SUMMARY --> --- > [!NOTE] > **Medium risk.** It adds a path from the sandbox agent through the host to SessionDO that stores and serves file contents (diffs) for every session, and changes how Changes are read from git, though every protocol addition is optional. > > **What it does.** A changed file under Changes on a session page now opens its diff in a dialog, highlighted by language, with word-level marks, unified or side-by-side views and keyboard stepping between files. fctl-agent reads each changed file's diff (at most 16 MB per refresh), the host forwards new ones to SessionDO, which keeps the latest per file (up to 512 KB a file and 8 MB a session) and serves them at `GET /api/v1/sessions/{id}/diff`, which `fctl diff` prints. The transcript's edit diffs are highlighted too and additions are green throughout the viewer. The latest commit only adds diff shots to the demo screenshot script for fctl.sh's feature pages. > > **Control plane stores code.** SessionDO now keeps the latest diff of each changed file, and the privacy policy on fctl.sh needs a matching change (fctl-site#105) before app.fctl.sh runs this. > > <sub>[fctl review](https://app.fctl.sh/s/ses_01M6PM5VQJ305813XZ3KB9E76P)'s first look at [`3472659`](3472659) · 55 files, +5948 −234 · [Review agent settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub> <!-- /FCTL_REVIEW_SUMMARY --> --------- Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com> Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
kalaspuff
marked this pull request as ready for review
November 5, 2026 20:30
kalaspuff
approved these changes
Nov 5, 2026
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
The Sessions feature page gets a section on the diff view that hyperstructure/fctl#386 adds: a changed file of platform#437 open over its session's page (desktop shot, both themes). In "Your factory, at a glance", shop#231's change to
money.tson a phone replaces the phone session shot that the page showed twice. On the Review agents page, the phone beside the review now shows the pull request's change the review read, instead of the same review again, and the copy mentions it. The two pages' other shots of session pages (session, follow-up, phone session, review, findings) are taken again, so that additions show in green as they will after the release; the Agent Floor shots stay as they were, since retaking them would only swap the task box's random placeholder.The shots come from fctl's
xtask/demo/shoot.mjs --featuresagainstcargo xtask demo, where #386 adds their definitions.npm run check,npm run buildandnpm testpass, and I looked at both pages in both themes and at a phone's width.This shows behavior that app.fctl.sh doesn't have yet: merge it once app.fctl.sh runs a release with hyperstructure/fctl#386.
Screenshots
The new section on the Sessions page, dark, light and on a phone:
"Your factory, at a glance", before and after:
"Every review is a session you can open", before and after:
Related
Worth confirming
fctl session
Note
Low risk. It changes marketing copy and screenshots on two feature pages, but it shows behavior that app.fctl.sh doesn't have until hyperstructure/fctl#386 is released.
What it does. Adds a section on the diff view to the Sessions feature page, with a new desktop shot, and replaces a duplicated phone shot there with a phone diff. On the Review agents page the phone shot now shows the pull request's change the review read, and the copy mentions it. The other session-page shots on both pages are retaken so additions show in green.
Merge order. The pages describe the diff view from hyperstructure/fctl#386, which is still open, so this should merge only once app.fctl.sh runs a release with it.
fctl review's first look at
e36e7c0· 20 files, +30 −9 · Review agent settings