Skip to content

feat: Introduce ChangesetFileMonitorCoordinator for session-specific file monitoring#318284

Open
DonJayamanne wants to merge 4 commits into
mainfrom
don/changeset-file-monitor
Open

feat: Introduce ChangesetFileMonitorCoordinator for session-specific file monitoring#318284
DonJayamanne wants to merge 4 commits into
mainfrom
don/changeset-file-monitor

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

@DonJayamanne DonJayamanne commented May 26, 2026

Fixes #317922

  • Added ChangesetFileMonitorCoordinator to manage file monitoring for changesets.
  • Integrated ChangesetFileMonitorCoordinator into ChangesetSessionCoordinator.
  • Updated ChangesetSessionCoordinator to handle session restoration, materialization, and disposal with file monitoring.
  • Implemented IAgentHostFileMonitorService to provide file monitoring capabilities.
  • Created AgentHostFileMonitorService to manage file watching with debounce and exclusion options.
  • Added tests for ChangesetSessionCoordinator and AgentHostFileMonitorService to ensure correct functionality.

…file monitoring

- Added ChangesetFileMonitorCoordinator to manage file monitoring for changesets.
- Integrated ChangesetFileMonitorCoordinator into ChangesetSessionCoordinator.
- Updated ChangesetSessionCoordinator to handle session restoration, materialization, and disposal with file monitoring.
- Implemented IAgentHostFileMonitorService to provide file monitoring capabilities.
- Created AgentHostFileMonitorService to manage file watching with debounce and exclusion options.
- Added tests for ChangesetSessionCoordinator and AgentHostFileMonitorService to ensure correct functionality.
Copilot AI review requested due to automatic review settings May 26, 2026 03:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces session-aware, repository-root file monitoring in the agent host to keep changeset/catalogue state fresh while clients are subscribed, and to suspend watchers while sessions are actively running turns.

Changes:

  • Added IAgentHostFileMonitorService + AgentHostFileMonitorService to share recursive folder watchers with debouncing and exclude globs.
  • Added ChangesetFileMonitorCoordinator and integrated it into ChangesetSessionCoordinator to manage watch interest, root sharing, and refresh fan-out.
  • Wired “active turn” transitions out of AgentHostStateManager into the changeset coordinator, plus added unit tests for the new behavior.
Show a summary per file
File Description
src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts Adds coverage that the new active-turn event only fires on reducer-derived active-state transitions.
src/vs/platform/agentHost/test/node/agentHostFileMonitorService.test.ts Adds unit tests for watcher sharing/refcounting, excludes, debouncing, and disposal behavior.
src/vs/platform/agentHost/test/node/agentHostChangesetCoordinator.test.ts Adds tests validating root watcher sharing, unsubscribe disposal, materialization behavior, and turn-active suspension/resume.
src/vs/platform/agentHost/node/agentService.ts Registers the file monitor service, constructs the updated changeset coordinator, and forwards active-turn events into it.
src/vs/platform/agentHost/node/agentHostStateManager.ts Emits onDidChangeSessionActiveTurn when reducer-derived active-turn state toggles (and on removal cleanup).
src/vs/platform/agentHost/node/agentHostServerMain.ts Creates/registers the file monitor service in DI and passes it into AgentService.
src/vs/platform/agentHost/node/agentHostMain.ts Same as server main: wires AgentHostFileMonitorService into DI and AgentService.
src/vs/platform/agentHost/node/agentHostFileMonitorService.ts New shared file monitoring service (watch dedupe + debounce + excludes).
src/vs/platform/agentHost/node/agentHostChangesetFileMonitorCoordinator.ts New coordinator that maps subscriptions/sessions to repo roots and triggers changeset refreshes on root changes.
src/vs/platform/agentHost/node/agentHostChangesetCoordinator.ts Integrates the changeset file monitor coordinator and hooks subscription lifecycle + active-turn updates.

Copilot's findings

  • Files reviewed: 10/10 changed files
  • Comments generated: 1

Comment thread src/vs/platform/agentHost/node/agentHostFileMonitorService.ts Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@DonJayamanne DonJayamanne marked this pull request as ready for review May 26, 2026 04:32
private readonly _changesets: IAgentHostChangesetService,
private readonly _configurationService: IAgentConfigurationService,
fileMonitorService: IAgentHostFileMonitorService,
gitService: IAgentHostGitService,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not injected?

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.

File monitoring for dynamic updates of changesets

5 participants