Theme
Lesson 20 — Revisions and diffs
Outcome
Capture exact candidate revision identity after agent work and show a diff relative to the intended base.
Why this comes now
Review and verification are meaningless if Forge cannot answer “which exact code did we evaluate?”
Understand
A provider Turn completing does not automatically mean the Review candidate is settled. Forge may still need to inspect Git status, compute the revision/worktree state, and record the candidate. Git identity is the anchor for later validity.
Do not auto-commit user-visible history purely for Forge. If working-tree diffs are the candidate representation early on, define the identity carefully (base revision + worktree state fingerprint or a hidden checkpoint). Simpler first implementation may require/produce commits if your chosen provider workflow already does; document the exact rule.
Build the real project
- Define CandidateRevision representation.
- Add post-turn Operation that captures/settles candidate code state.
- Implement Git diff query against base/candidate.
- Store enough identity for stale checks.
- Expose diff file list and hunks through paged/on-demand RPC.
- Add first diff viewer to Task workspace.
Completion gate
Change code after capturing candidate A and prove Forge detects that the current code no longer matches A. Diff tests cover rename/add/delete/basic binary handling policy.
Pitfalls to avoid
Do not call Turn complete and instantly set Task Review before candidate capture settles. Do not create misleading autosave commits without an explicit policy.
References
git diff, T3 checkpoint/revision separation: https://github.com/pingdotgg/t3code/blob/main/docs/internals/overview.md
Checkpoint
Document the exact candidate-revision identity rule chosen for the first implementation.