Repository navigation
fix(sessions): hide pre-session edits to branch-added files in uncommitted diffs - #164671
Conversation
…itted diffs The session baseline fingerprints each file with its status relative to the branch merge base, but the uncommitted diff reports status relative to HEAD. A file added on the branch and edited before the session started was fingerprinted as added and compared as modified, so it never matched and showed up as a session change. Fingerprint uncommitted files from the same base-relative inventory the baseline used.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 6:46 AM ET / 10:46 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR makes the session Review panel exclude unchanged pre-session edits to branch-added files from Uncommitted while preserving later edits. Merge readiness✅ Ready for maintainer review Current main still contains the reported defect. The inspected before/after evidence supports this repair, the earlier timing request is addressed, and no blocking introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe session diff subsystem compares Git checkout changes with a saved session-start baseline. Its filtered results reach the Control UI Review panel through the Gateway. flowchart TD
A[Git checkout] --> B[Requested diff scope]
A --> C[Merge-base file inventory]
D[Session-start fingerprints] --> E[Compare visible baseline paths]
C --> E
B --> E
E --> F[Gateway diff response]
F --> G[Review panel]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +19, Tests +24. Total +43 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use the existing baseline inventory consistently for session attribution while retaining requested-scope patches and the stored fingerprint contract. Do we have a high-confidence way to reproduce the issue? Yes: commit a file on a feature branch, modify it before baseline capture, then request Uncommitted without another edit. Current-main descriptor construction explains the false inclusion, and contributor before/after screenshots corroborate it; this reviewer did not execute the scenario. Is this the best way to solve the issue? Yes: sharing the existing capture inventory corrects the comparison without changing displayed patches, persistence, or other scopes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6aefbb11f30a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…itted diffs (openclaw#164671) On a feature branch, the session Review diff in the `uncommitted` scope listed files the agent never touched. If the branch added a file in a commit and the user edited it before the session started, it showed as a session change. The session baseline was fingerprinted relative to the merge base, while the uncommitted comparison was made relative to HEAD. The comparison now uses matching references. The persisted baseline shape and fingerprint bytes are unchanged. The `all` scope, files the agent does edit, and non-branch workspaces are unchanged. Proof: in a real built Gateway Review panel with a scripted write-tool turn, base listed `added.txt` and `agent.txt`, and this change lists only `agent.txt`. Before and after screenshots are in the PR. The regression test fails on base and passes here. A live gpt-5-mini smoke call passed. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes the session Review panel listing pre-session edits to branch-added files in Uncommitted, even when the agent never touched those files.
User Impact
Uncommitted now hides unchanged pre-session edits consistently with All Changes. Files edited after the session starts remain visible in both scopes. No migration or user action is required.
Why This Change Was Made
The saved baseline describes files relative to the branch merge base, while Uncommitted displays changes relative to HEAD. Comparing those different descriptors incorrectly treats an unchanged branch-added file as a session edit. The comparison now uses the same merge-base-relative inventory as baseline capture, restricted to baseline paths present in the requested view.
The stored version-1 baseline shape, fingerprint bytes, capture safety limits, and persistence writer are unchanged. All Changes retains its existing comparison. Integration with #164645 restores a shared candidates-only collector without changing capture output.
Original fix and regression by @yetval. No overlap with Pash/Sarah changes.
Evidence
An isolated built Gateway and Chromium rendered the real Control UI Review panel. On main
6c7d1e41bfa26fc3029b02be299e824a0425e374, a feature branch committedadded.txt, then modified it before session creation. A scripted model turn used the real write tool to change onlyagent.txt. Uncommitted incorrectly showed both files. Candidate1238277a700b7c6cc8211d799bfbee3b7ecb8a1dshows onlyagent.txt.Before — untouched pre-session file appears:
After — only the agent-edited file remains:
pnpm test src/sessions/session-diff-baseline-files.test.ts --maxWorkers=1: baseline fails the new regression (feature.txtappears instead of an empty list); candidate passes all 4 tests. Candidate wall time: 16.88 seconds including cold worker compilation; regression body: 126 ms. Hosted CI timing is reported by the selected job.gpt-5-minirequest through a passive proxy, reasoninglow,max_output_tokens: 4096, HTTP 200 and CLI exit 0. The fresh profile returned an onboarding response. An earlier proxy setup attempt was interrupted by an unhandled non-POST request; the fixture was corrected and its failure evidence retained.Scope limitation retained from the original report: a working file already reverted to merge-base content before capture is absent from the baseline inventory. That separate capture gap is not changed here.