You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(review): diff staleness detection — 'out of date · Refresh' notice
Files changing mid-review (an agent editing/committing while the user
reviews) silently left a stale snapshot on screen. Now the client polls a
cheap server-side fingerprint check every 5s and shows a non-blocking
amber notice in the toolbar; the user refreshes when ready (never
automatic — annotations are line-anchored).
Architecture (write-once, both servers inherit):
- packages/shared: getGitDiffFingerprint (per git mode: commit-anchored →
rev-parse only; working-tree → hash of the same diff the patch is built
from + untracked contents, capped), getJjDiffFingerprint (jj snapshots
the working copy per command, so commit ids are content-complete),
WorkspaceReviewSession.getFingerprint (combines all children),
VcsProvider.getDiffFingerprint + VcsApi dispatch. P4: no fingerprint →
always fresh (no banner) in v1. All git probes use --no-optional-locks
so background polling never races concurrent git add/commit.
- Bun + Pi servers: fingerprint captured beside every patch snapshot
(startup + all switch endpoints); GET /api/diff/fresh recomputes and
compares. PR layer scope is platform-side → never stale locally; PR
full-stack fingerprints the local checkout's HEAD.
- UI: useDiffFreshness hook (5s poll, paused while hidden, off in demo),
amber toolbar pill with Refresh (existing switch path with preserveFile
— reviewer stays on their file; PR full-stack re-runs scope switch) and
Dismiss (stays dismissed until a DIFFERENT change lands — endpoint
returns the probe fingerprint to tell those apart).
Tested against a real throwaway git repo (8 cases incl. the already-
modified-file-modified-again case that git status alone cannot detect).
0 commit comments