Skip to content

fix(sessions): hide pre-session edits to branch-added files in uncommitted diffs - #164671

Merged
obviyus merged 3 commits into
openclaw:mainfrom
yetval:fix/session-diff-uncommitted-baseline
Oct 4, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
yetval:fix/session-diff-uncommitted-baseline

Conversation

@yetval

@yetval yetval commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

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 committed added.txt, then modified it before session creation. A scripted model turn used the real write tool to change only agent.txt. Uncommitted incorrectly showed both files. Candidate 1238277a700b7c6cc8211d799bfbee3b7ecb8a1d shows only agent.txt.

Before — untouched pre-session file appears:

Before: Uncommitted includes added.txt although the agent wrote only agent.txt

After — only the agent-edited file remains:

After: Uncommitted includes only agent.txt

  • pnpm test src/sessions/session-diff-baseline-files.test.ts --maxWorkers=1: baseline fails the new regression (feature.txt appears 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.
  • Controls pass on base and candidate: All Changes is unchanged; a file edited after session start appears in both scopes; an ordinary main-branch workspace is unchanged. Stored fingerprint and safety-cap tests also pass.
  • Live smoke on the exact candidate: one completed gpt-5-mini request through a passive proxy, reasoning low, 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.
  • Both runtime/UI builds completed. The existing UI startup-size advisory was observed on both aligned builds (base 373488 B, candidate 373478 B; threshold 373454 B); no UI source changed.

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.

…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.
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 6:46 AM ET / 10:46 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 1238277a700b7c6cc8211d799bfbee3b7ecb8a1d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with convincing real UI evidence, a meaningful regression, and no blocking correctness finding.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.
Evidence reviewed 8 items Introduced change: Inspected the pinned introduced delta. Uncommitted comparison now shares the merge-base-relative candidate inventory with capture and restricts fingerprinting to visible baseline paths; other scopes retain their comparison path.
Still necessary on current main: Read current-main runtime source. Capture fingerprints merge-base-relative status, but Uncommitted supplies HEAD-relative status directly to baseline comparison. A branch-added file therefore changes descriptor from added to modified without a session edit.
Inspected real behavior proof: Opened both prepared screenshots linked in the captured PR body: https://github.com/user-attachments/assets/c557b288-aa4e-417f-87fb-07aba5151b05 and https://github.com/user-attachments/assets/b3761bc6-3066-4ba8-be7e-d1456f0b1fde. The baseline Review panel displays added.txt and agent.txt; the candidate displays only agent.txt. The body identifies an isolated built Gateway, Chromium, a real write-tool turn, and the exact candidate SHA.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +19, Tests +24. Total +43 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 30 11 +19
Tests 1 25 1 +24
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 55 12 +43

Review metrics

Metric Value Why it matters
Production versus test growth production +19 net lines; tests +24 net lines Production growth is justified by sharing the capture inventory with scope-correct comparison; the test protects the concrete before/after regression.

Technical review

Best 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.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.

Label justifications:

  • P2: This repairs misleading session Review results with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected screenshots and the captured exact-head setup description connect the changed baseline comparison to the real Gateway-backed Review panel: the pre-session branch addition disappears while the write-tool edit remains. Capture serialization and fingerprint bytes are unchanged, preserving existing-state compatibility.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-04T01:36:46.301Z sha dbe9ae6 :: needs changes before merge. :: none

@obviyus

obviyus commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 4, 2026
@obviyus
obviyus merged commit e28f1c0 into openclaw:main Oct 4, 2026
121 of 126 checks passed
@obviyus

obviyus commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Landed as e28f1c0. Thanks @yetval!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 5, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants