Repository navigation
Prevent Agent Host session loss after resume failures - #328540
Closed
roblourens wants to merge 3 commits into
Closed
roblourens wants to merge 3 commits into
roblourens wants to merge 3 commits into
Conversation
Limit empty-session recreation to the SDK's explicit no-events error and constrain destructive GC to abandoned provisional sessions with liveness and persistence safeguards. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Narrows Copilot resume fallback handling and hardens Agent Host provisional-session garbage collection.
Changes:
- Restricts empty-session recreation to the SDK’s explicit no-events error.
- Adds provisional-session GC eligibility and subscription-liveness checks.
- Expands regression coverage for resume failures, GC races, and peer-chat activity.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/agentHost/node/agentService.ts |
Refines provisional GC, persistence checks, liveness, and idle release. |
src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts |
Narrows resume fallback matching. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Adds lifecycle and GC regression tests. |
src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts |
Tests propagation of non-empty resume failures. |
src/vs/platform/agentHost/test/node/mockAgent.ts |
Adds configurable provisional-session behavior. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
Contributor
Keep the compatibility fallback for SDK no-events and session-not-found errors while continuing to propagate network and unknown internal failures. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
Use AHP session lifecycle as the provisional source of truth and carry cancellation through the existing pending-GC disposable instead of maintaining parallel lifecycle maps. (Written by Copilot) Co-authored-by: Copilot <[email protected]>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #328590.
Prevent a transient Copilot SDK resume failure from turning an existing Agent Host session into an empty session that is later garbage-collected.
createSession({ sessionId })for the SDK's explicitsession.getMessages returned no eventsandSession not founderrorsCreatingand which have no persisted databaseBackground
Two different empty-session concepts had become coupled:
The fallback still treated almost every JSON-RPC
-32603as the Start Over case. A transient network failure could therefore produce a zero-turn restored state. Empty-session GC then mistook that durable session for an abandoned draft and called the destructive disposal path. The SDK's exactSession not founderror remains a supported recovery case because customization refresh intentionally replaces a just-created SDK session and resumes it under the same ID.The non-destructive idle release added in #324854 made this latent problem easier to hit because reopening an idle session now correctly exercises SDK resume instead of retaining the live SDK object indefinitely.
Validation
npm run compileCopilotSessionLauncher resume fallback,empty-session GC, andsubscriber refcount evictionunit suitesnpm run precommit(Written by Copilot)