Skip to content

sessions: add Session Files section to the Changes view#323725

Merged
benibenj merged 5 commits into
mainfrom
agents/session-files-view-section-implementation
Jun 30, 2026
Merged

sessions: add Session Files section to the Changes view#323725
benibenj merged 5 commits into
mainfrom
agents/session-files-view-section-implementation

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

What

Adds a new collapsible/resizable "Session Files" section to the agents Changes view, modeled on the existing CI Checks section (same collapse/resize/SplitView behavior). It sits between the file tree (top) and the Checks section (bottom).

The section lists files that were created, edited, or deleted outside the session workspace folders during the session (e.g. config files in the user's home directory). A header hover explains that these files are not part of the workspace and won't be committed. Files render in a tree with resource labels (file icons, dir path, strikethrough for deletions), just like the other file-based trees.

How

  • Model (session.ts): new SessionFileOperation enum (Created/Modified/Deleted) and ISessionFile interface, plus a new optional externalChanges observable on ISession (empty/omitted for providers that can't supply it).
  • Parsing (agentHostSessionFiles.ts): subscribes to the agent-host chat-state turns, walks responseParts → tool calls → FileEdit results (and pending-confirmation edits), classifies create/edit/delete/rename via normalizeFileEdit, filters to files outside every workspace folder's working directory, and reduces per file (created-then-edited → Created; delete overrides; rename = delete+create). Wired onto AgentHostSessionAdapter.
  • UI: SessionFilesWidget + SessionFilesViewModel + CSS, integrated into changesView.ts as a third SplitView pane (shared _wireSectionPane helper now drives both Session Files and Checks). Click opens created/deleted files normally and edited files as a diff (before vs after).

Performance

Parsing is incremental: completed turns are immutable, so each is parsed once and memoized by turn id; only the in-progress activeTurn is re-parsed per streamed delta (O(active turn) instead of O(all turns)). Equality functions on the per-chat edits and final externalChanges observable suppress redundant downstream work. Computation is gated on the active, non-archived session — archived sessions open no subscriptions and do no parsing.

Tests

  • Component-explorer fixtures for the widget (sessionFilesWidget.fixture.ts).
  • Unit tests (agentHostSessionFiles.test.ts, 5 passing) covering delta-only recomputation, completed-turn retention during streaming, protocol parsing of completed/pending tool calls, and reduce semantics (create-then-edit, delete override, rename, workspace filtering).

Notes for reviewers

  • The user-facing section is named "Session Files"; the ISession property is named externalChanges.
  • Validated with tsgo typecheck (0 errors), ESLint (0 errors/warnings), valid-layers-check, hygiene/precommit, and the unit suite.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Add a collapsible/resizable 'Session Files' section to the agents Changes view, modeled on the CI Checks section, listing files created/edited/deleted outside the session workspace folders during the session (these are not committed).

Data is parsed from the agent-host chat-state turns (response parts -> tool calls -> FileEdit results/pending edits) and exposed via a new optional 'externalChanges' observable on ISession. Parsing is incremental: completed turns are memoized by id and only the active turn is re-parsed per streamed delta, with equality functions to suppress redundant downstream work. Computation is gated on the active, non-archived session.

Click opens created/deleted files normally and edited files as a diff. Adds component-explorer fixtures and unit tests covering delta-only recomputation and reduce semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 30, 2026 14:01
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: c1d3c121 Current: 2787d24a

Added (6)

changes/sessionFilesWidget/WithFiles/Dark

current

changes/sessionFilesWidget/WithFiles/Light

current

changes/sessionFilesWidget/SingleCreatedFile/Dark

current

changes/sessionFilesWidget/SingleCreatedFile/Light

current

changes/sessionFilesWidget/Empty/Dark

current

changes/sessionFilesWidget/Empty/Light

current

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds an “Session Files” section to the Agents window Changes view, surfacing files that were created/modified/deleted outside the session workspace folders by parsing agent-host chat/tool-call file edit results and presenting them in a dedicated, collapsible SplitView pane.

Changes:

  • Extend the sessions model with SessionFileOperation, ISessionFile, and an optional ISession.externalChanges observable for “external” file changes.
  • Parse/memoize file edits from agent-host chat-state turns and reduce them into per-file operations filtered to outside workspace roots.
  • Add a new SessionFilesWidget + view model + CSS, integrate it as a new SplitView section in changesView.ts, and add fixtures/tests.
Show a summary per file
File Description
src/vs/sessions/services/sessions/common/session.ts Adds SessionFileOperation, ISessionFile, and optional ISession.externalChanges API surface.
src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostSessionFiles.test.ts New unit tests covering parsing, incremental recomputation, and reduce semantics.
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts Wires externalChanges onto AgentHostSessionAdapter via createSessionFilesObs.
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionFiles.ts New implementation for parsing tool-call file edits and reducing them into ISessionFile[].
src/vs/sessions/contrib/providers/agentHost/browser/agentHostSessionChangesets.ts Exports createActiveSessionSubscriptionObs for reuse by session-files parsing.
src/vs/sessions/contrib/changes/test/browser/sessionFilesWidget.fixture.ts New component-explorer fixture coverage for the widget.
src/vs/sessions/contrib/changes/browser/sessionFilesWidget.ts New UI widget rendering the Session Files list and handling open/diff behavior.
src/vs/sessions/contrib/changes/browser/sessionFilesViewModel.ts New view model exposing activeSession.externalChanges with stable empty fallback.
src/vs/sessions/contrib/changes/browser/media/sessionFilesWidget.css Styling for the new section to match existing Checks section behavior.
src/vs/sessions/contrib/changes/browser/changesView.ts Integrates the new widget as an additional SplitView pane and factors shared wiring logic.

Review details

  • Files reviewed: 10/10 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment thread src/vs/sessions/contrib/changes/browser/changesView.ts
Comment thread src/vs/sessions/contrib/changes/browser/sessionFilesWidget.ts Outdated
benibenj and others added 3 commits June 30, 2026 16:13
The Session Files widget fixture failed to render because ResourceLabels depends on IWorkspaceContextService, IDecorationsService, ITextFileService and INotebookDocumentService, which the base fixture services don't provide. Register mock instances the same way the multiDiffEditor fixture does.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add a Changes-view accessibility help dialog (SessionsChangesAccessibilityHelp) with a new verbosity setting, documenting the file tree and the Session Files / Checks sections and how to operate them (collapse/expand, open file vs diff).

- Handle touch in the Session Files header via Gesture.addTarget + TouchEventType.Tap so the collapse/expand toggle works on touch platforms.

- Use getComparisonKey(uri) instead of uri.toString() for Map keys and sorting in reduceSessionFiles, for safe cross-platform URI identity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SessionFilesWidget creates a WorkbenchList, which depends on IListService. Register it in the fixture (as the aiCustomizationListWidget fixture does) so the widget can be instantiated under the component explorer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benibenj
benibenj enabled auto-merge (squash) June 30, 2026 14:58
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@sandy081

Matched files:

  • src/vs/sessions/services/sessions/common/session.ts

@lszomoru

Matched files:

  • src/vs/sessions/services/sessions/common/session.ts

@benibenj
benibenj merged commit 6379047 into main Jun 30, 2026
29 checks passed
@benibenj
benibenj deleted the agents/session-files-view-section-implementation branch June 30, 2026 15:31
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.

3 participants