Skip to content

feat(features): show diffs on the Sessions and Review agents pages - #106

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/677-diff-view-shots
Nov 5, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/677-diff-view-shots

Conversation

@fctl-sh

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

Copy link
Copy Markdown
Contributor

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.ts on 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 --features against cargo xtask demo, where #386 adds their definitions. npm run check, npm run build and npm test pass, 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:

The Sessions page's new section, dark

The Sessions page's new section, light

The new section at a phone's width

"Your factory, at a glance", before and after:

Before After
Before: the Agent Floor and a session on phones After: the Agent Floor and a diff on phones

"Every review is a session you can open", before and after:

Before After
Before: the review, on a desktop and a phone After: the review, and the change it read on a phone

Related

Worth confirming

  • Decision: I retook the other session-page shots on both pages, which also brings in the sidebar's recent sessions under each project (fctl#383, released in 0.28.0), but left the Agent Floor shots alone, so the page's hero keeps "What should an agent build next?" in its task box.

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

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:

![A changed Rust file's diff over the session page,
dark](https://app.fctl.sh/api/v1/published/Br9zyxFmfvSLTueEs9oDVgq3llX1xyQEDOKqndluhHx/pr-rust-dark.png)

Terraform in the light theme (infra#37):

![A changed Terraform file's diff,
light](https://app.fctl.sh/api/v1/published/Cu0eBwa9DWHamypXeUCiQx9kwBWfEFLUfhCNAXWlSrv/pr-terraform-light.png)

Side by side (`s`):

![The same kind of diff side by side,
dark](https://app.fctl.sh/api/v1/published/8YqxX4az01Lka04OMrWxGu1YbFe9Wfs5lExRK3jeaIY/pr-split-dark.png)

The transcript's edits, and Changes in the rail, before and after:

| Before | After |
|---|---|
| ![Before: an edit in the transcript, unhighlighted and unnumbered,
additions in
yellow](https://app.fctl.sh/api/v1/published/2Ml8DiIjnGy9S0jADqVgZ8YApeuZJkpetUmTBOT9Ipu/b-edit.png)
| ![After: the edit highlighted and numbered, additions in
green](https://app.fctl.sh/api/v1/published/VCBF5cXiBMW4AlvdH8HbUx8OsMuvHi6VG3wikCuFx55/d-edit.png)
|

On a phone, 390 px wide, the diff and its list of files:

| Diff | Files |
|---|---|
| ![A Python diff on a phone, lines
wrapped](https://app.fctl.sh/api/v1/published/f34D2y5AYZkjQcFfnWJ4jLjqzeGXFGTqDQpMEvntqM8/pr-phone-dark.png)
| ![The changed files on a phone, grouped by
directory](https://app.fctl.sh/api/v1/published/IVQs03HWrefhXo1KHE4FXxNVq5N5clIEg2JDLS7yGED/pr-phone-list-dark.png)
|

## 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
kalaspuff marked this pull request as ready for review November 5, 2026 20:30
@kalaspuff
kalaspuff self-requested a review as a code owner November 5, 2026 20:30
@kalaspuff
kalaspuff merged commit 473fa33 into main Nov 5, 2026
5 checks passed
@kalaspuff
kalaspuff deleted the fctl/677-diff-view-shots branch November 5, 2026 20:30
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