Repository navigation
agentHost: retain client tools across nested session unsubscribe - #340894
Merged
Sandeep Somavarapu (sandy081) merged 3 commits intoOct 12, 2026
Merged
Sandeep Somavarapu (sandy081) merged 3 commits into
Sandeep Somavarapu (sandy081) merged 3 commits into
Conversation
Keep a client's session-wide tool contribution while any active parent or sibling nested-session subscription remains. Reconcile explicit unsubscribe with reconnect behavior without introducing exact-chat tool routing. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Malformed ahp-chat subscriptions can throw during reconciliation and prevent cleanup.
1 open finding
What changed in this PR
Fixes Agent Host client-tool lifecycle reconciliation across parent and nested session subscriptions.
Changes:
- Retains active clients while any session-related subscription remains.
- Adds unsubscribe cleanup and retention regression tests.
| File | Description |
|---|---|
protocolServerHandler.ts |
Reconciles client ownership at session scope. |
protocolServerHandler.test.ts |
Tests parent, sibling, and final-unsubscribe behavior. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Avoid aborting active-client reconciliation when a retained state subscription uses a malformed ahp-chat URI. Co-authored-by: Copilot <[email protected]>
roblourens
previously approved these changes
Oct 11, 2026
Model full client departure by releasing both the nested chat and parent session subscriptions. Keep the resulting failed tool completion observable through a separate subscribed client.\n\nCo-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
dismissed
roblourens’s stale review
via
October 12, 2026 07:34
c6edb2b
Henning Dieterichs (hediet)
approved these changes
Oct 12, 2026
Sandeep Somavarapu (sandy081)
deleted the
sandy081/agents/i-pulled-latest-changes-and-check-it-again
branch
October 12, 2026 08:11
This was referenced Oct 30, 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.

Summary
Fixes active-client lifecycle reconciliation when one nested session unsubscribes. The client now keeps its session-wide tool contribution while any active parent-session or sibling nested-session subscription remains across its live connections.
Explicit unsubscribe now follows the same session-level participation rule as reconnect. The active client and its orphaned calls are released only after the client has left the entire parent session. Existing nested-session tool routing, confirmation, and execution behavior remains unchanged.
Adds regressions for retention through parent, sibling, and nested-session subscriptions, plus cleanup after the last nested-session subscription is removed.
Validation
npm run compile— passednpm run hygiene— passednpm run build-fast -- --client-only— passed./scripts/test.sh --run src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts --reporter dot— 253 passing, 1 pendingnpm run typecheck-client— passednpm run eslint -- src/vs/platform/agentHost/node/protocolServerHandler.ts src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts— passed