Skip to content

fix(session): scope changed file summary to session edits - #40821

Open
clx828 wants to merge 2 commits into
anomalyco:devfrom
clx828:session-scoped-diffs
Open

fix(session): scope changed file summary to session edits#40821
clx828 wants to merge 2 commits into
anomalyco:devfrom
clx828:session-scoped-diffs

Conversation

@clx828

@clx828 clx828 commented Aug 6, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #40736

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The per-session "files changed" summary was computed as a full worktree snapshot diff between step start and step end, so concurrent edits from another session in the same project leaked into the summary. This PR restricts the summary to files the session's own tools actually touched:

  • V1 summary now collects files from write/edit/apply_patch tool metadata and passes them to diffFull as a path filter; the patch part recorded for revert uses the same scoped file list.
  • V2 runner collects touched files from tool settlement structured outputs and limits Snapshot.files to those paths.
  • Snapshot files/diffFull gained an optional path restriction.

How did you verify your code works?

  • Added unit tests for metadata file extraction, diffFull path restriction, and core Snapshot.files path restriction; all pass.
  • bun typecheck passes in core, server, and opencode.
  • Manually reproduced the two-session scenario in the desktop app; each session's summary now lists only its own files.

Screenshots / recordings

Before: session 1's summary includes session 2's files. After: session 1's summary only includes session 1's files.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@clx828

clx828 commented Aug 6, 2026

Copy link
Copy Markdown
Author

Before:
Two sessions were running in the same project. When one session finished, its "files changed" list included files modified by the other session (e.g. the frontend session also listed backend files that only the other session touched).
Image
After:
Each session's "files changed" list now contains only the files that session actually modified. Even with another session editing files in the same worktree, the two lists stay separate and correct.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session.diff and message summary.diffs include file changes from concurrently running sessions in the same worktree

1 participant