feat: Introduce ChangesetFileMonitorCoordinator for session-specific file monitoring#318284
Open
DonJayamanne wants to merge 4 commits into
Open
feat: Introduce ChangesetFileMonitorCoordinator for session-specific file monitoring#318284DonJayamanne wants to merge 4 commits into
DonJayamanne wants to merge 4 commits into
Conversation
…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.
…ycle and monitoring behavior
Contributor
There was a problem hiding this comment.
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+AgentHostFileMonitorServiceto share recursive folder watchers with debouncing and exclude globs. - Added
ChangesetFileMonitorCoordinatorand integrated it intoChangesetSessionCoordinatorto manage watch interest, root sharing, and refresh fan-out. - Wired “active turn” transitions out of
AgentHostStateManagerinto 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
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
dbaeumer
approved these changes
May 26, 2026
roblourens
approved these changes
May 26, 2026
| private readonly _changesets: IAgentHostChangesetService, | ||
| private readonly _configurationService: IAgentConfigurationService, | ||
| fileMonitorService: IAgentHostFileMonitorService, | ||
| gitService: IAgentHostGitService, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #317922