Try to reduce how often LocalAgentsSessionsController fires updates#305525
Merged
mjbvz merged 2 commits intomicrosoft:mainfrom Mar 27, 2026
Merged
Try to reduce how often LocalAgentsSessionsController fires updates#305525mjbvz merged 2 commits intomicrosoft:mainfrom
mjbvz merged 2 commits intomicrosoft:mainfrom
Conversation
`LocalAgentsSessionsController` is firing updates on every single response change. This PR tries to reduce this by doing a object equality check before firing the update. In a follow up I'll also see if we can debounce listening to so many request updates
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @jriekenMatched files:
|
bpasero
approved these changes
Mar 27, 2026
Member
|
@mjbvz actual test failures |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce churn in the Agent Sessions UI by making LocalAgentsSessionsController emit item deltas only when a session item’s computed shape actually changes, rather than on every response/model change.
Changes:
- Reworked
LocalAgentsSessionsControllerto track per-model changes and only fireaddedOrUpdatedwhen the computed session item differs. - Renamed
IChatService.onDidDisposeSessionevent payload field fromsessionResource→sessionResourcesacross call sites. - Extracted a
chatModelToChatDetailhelper and reused it in live session item computation.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts | Updates dispose-session event payload field name in tests. |
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts | Updates dispose-session cleanup loop to use sessionResources. |
| src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.ts | Updates session-dispose cleanup loops to use sessionResources. |
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Updates mock dispose-session emitter payload to sessionResources. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Updates test iteration to use sessionResources. |
| src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.ts | Updates session-dispose cleanup to use sessionResources. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Refactors live-session detail mapping and introduces exported chatModelToChatDetail. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Renames dispose-session event payload field to sessionResources. |
| src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.ts | Updates session-dispose handling to use sessionResources. |
| src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.ts | Main change: per-model listeners + equality check to reduce update firing. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Updates session-dispose handling to use sessionResources. |
eleanorjboyd
approved these changes
Mar 27, 2026
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.
LocalAgentsSessionsControlleris firing updates on every single response change. This PR tries to reduce this by doing a object equality check before firing the update. In a follow up I'll also see if we can debounce listening to so many request updates