fix pinned sessions dropping from list when chat models unload (#325448)#325536
Open
lucastaylr wants to merge 4 commits into
Open
fix pinned sessions dropping from list when chat models unload (#325448)#325536lucastaylr wants to merge 4 commits into
lucastaylr wants to merge 4 commits into
Conversation
…soft#325448) onDidDisposeSession means the in-memory model was released, not that the session was deleted. Refresh the local session list from live + history instead of removing the item.
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
Refreshes local sessions from live and historical data when models unload, preventing pinned sessions from disappearing.
Changes:
- Rebuilds session items after disposal events.
- Adds tests for unloaded and deleted sessions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
localAgentSessionsController.ts |
Refreshes sessions after model disposal. |
localAgentSessionsController.test.ts |
Tests unload and deletion behavior. |
Make refresh generation-aware so an older in-flight refresh cannot overwrite a newer live+history result after dispose, and cover the out-of-order completion case in tests.
Coalesce overlapping refreshes and verify models remain active after asynchronous detail conversion, preventing stale work from removing sessions restored from history.
Comment on lines
73
to
74
| const newResources = new ResourceSet(newItems.map(i => i.resource)); | ||
| const addedOrUpdated: LocalChatSessionItem[] = []; |
doRefresh() only reported brand-new resources in addedOrUpdated, so content changes discovered during a rebuild (such as the live-to-history transition on model unload) updated the item map without notifying consumers. Diff existing items with isEqual and include changed ones in the delta.
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 #325448:
onDidDisposeSessionwas treated as removing the session from the Agent Sessions list when a chat model unloaded from memory. Refresh the local session list from live + history instead, so unloaded sessions stay visible until they are actually deleted.Added Unit Tests: