Avoid stale active client updates after session disposal - #332458
Open
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Open
Avoid stale active client updates after session disposal#332458Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
August 25, 2026 00:19
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents stale active-client updates after an Agent Host session is deleted.
Changes:
- Tracks previously observed backend sessions during reconciliation.
- Stops publishing when an observed session state disappears.
- Adds regression coverage for deletion followed by customization refresh.
Show a summary per file
| File | Description |
|---|---|
agentHostSessionHandler.ts |
Guards reconciliation for removed backend sessions. |
agentHostChatContribution.test.ts |
Tests stale publication prevention. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
Connor Peet (connor4312)
requested changes
Aug 25, 2026
| this._state.set(true, undefined); | ||
| this._publishDelayer.trigger(async () => { | ||
| try { | ||
| if (this._cancellation.token.isCancellationRequested) { |
Member
There was a problem hiding this comment.
If the session is disposed, the ActiveClientEntry should also be disposed which should be triggering cancellation here
If the hypothesis on the root cause is correct, that is the underlying bug we should fix instead imo
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.
Regression from #330378.
Regression details
A scan of recent Insiders logs found 41 instances of this Agent Host error signature across three sessions:
AHP traffic for the latest non-shutdown occurrence showed the deterministic sequence:
session/activeClientSet.disposeSession.ActiveClientEntryremained attached to its customization scope.session/activeClientSetfor the deleted backend session.The reconciler retained
_claimRequestedafter its first successful publication, so missing backend state was indistinguishable from the pre-hydration state where an initial claim is valid.Fix
Track the backend session whose state has already been observed. If that same session state later disappears, stop reconciliation instead of publishing a new active-client claim. Initial claims before hydration and rebinding to a different backend session remain supported.
Tests
does not republish activeClientSet after backend session state is removed, which models the claim echo, backend state removal, and later customization refresh.npm run transpile-clientgit diff --checkA fresh Insiders runtime log reproduction was not performed; the focused test covers the observed AHP sequence.