/s/:id/diff currently reports the workspace's uncommitted state. If you had
edits in flight before the session started, they appear as though the agent made
them. The UI says so in words, because a wrong attribution is trusted, but words
are a stopgap.
What it needs
A baseline commit recorded when the session opens, then git diff <baseline>
instead of git diff HEAD. That also covers the case the current version misses
entirely: an agent that commits its work disappears from git diff HEAD.
The baseline cannot be captured in the reducer — that has to stay pure and
replayable, and reading git is neither. It follows the same shape as
thread.session.set: the runtime captures it and records it through an internal
command.
Sketch:
thread.baseline.setinternal command +session.baselineevent carrying the SHA (and a flag for "not a repository").SessionState.baseline, projected.- The runtime resolves
git rev-parse HEADwhen it first creates a driver instance for a session, and records it. workspaceDiff(path, baseline)diffs against it, falling back toHEADwhen there is none — sessions recorded before this change must keep working.
This is the natural first half of the branch-per-session work in M6, and doing them together is probably cheaper than doing either alone.