Repository navigation
agentHost: lazily restore peer chats - #329071
Merged
Connor Peet (connor4312) merged 3 commits intoAug 5, 2026
Merged
Conversation
Keep restored peer chats as state-manager-owned entries and materialize their SDK histories only when content is requested. Consolidate per-session resume, sequencing, and teardown coordination so distinct peers can resume concurrently without racing session disposal. Co-authored-by: Copilot <[email protected]>
…lazy-peer-chat-restore # Conflicts: # src/vs/platform/agentHost/node/agentService.ts
Contributor
There was a problem hiding this comment.
Pull request overview
Lazily restores peer-chat histories while preserving catalog metadata and coordinating concurrent SDK session lifecycles.
Changes:
- Adds state-manager-owned lazy peer-chat resolution with coalescing and invalidation.
- Consolidates Copilot session sequencing, leases, resume, release, and disposal.
- Adds restoration tests, benchmarking, and architecture documentation.
Show a summary per file
| File | Description |
|---|---|
MULTI_CHAT_ARCHITECTURE.md |
Documents lazy restoration architecture. |
agentHostStateManager.ts |
Adds lazy chat entries and resolvers. |
agentService.ts |
Registers and resolves restored chats on demand. |
copilotAgent.ts |
Introduces coordinated session lifetimes. |
sessionServerTools.ts |
Makes chat-context retrieval asynchronous. |
agentHostStateManager.test.ts |
Tests resolver state and invalidation. |
agentService.test.ts |
Tests lazy orchestration behavior. |
copilotAgent.test.ts |
Tests resume and teardown concurrency. |
mapSessionEvents.perf.test.ts |
Adds opt-in restoration benchmark. |
sessionServerTools.test.ts |
Updates asynchronous context mocks. |
Review details
Suppressed comments (1)
src/vs/platform/agentHost/node/agentService.ts:2044
- A failed provider deletion now leaves every restored peer resolver permanently invalid even though the session remains in the catalog.
provider.disposeSessioncan reject (the Copilot path explicitly supports retrying after an SDK delete error), but this invalidation is not rolled back; subsequentresolveChatStatecalls returnundefined, so an unresolved peer cannot be opened before the user retries deletion. Invalidate only once teardown is committed, or add a rollback path that re-enables the entries when any later teardown step fails.
// The host owns branch completions for every agent (they share the same
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Balanced
Propagate known peer-session resume failures so lazy chat hydration remains retryable instead of committing an empty history. Co-authored-by: Copilot <[email protected]>
Eleanor Boyd (eleanorjboyd)
approved these changes
Aug 5, 2026
Connor Peet (connor4312)
deleted the
connor4312/agenthost-lazy-peer-chat-restore
branch
August 5, 2026 00:30
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
CopilotSessionLifetimeevents.jsonlrestoration benchmark and update the multi-chat architecture documentationThis avoids eagerly resuming every peer SDK session when opening a parent session, which could turn ten roughly three-second restores into a roughly thirty-second load.
Validation
npm run transpile-clientgit diff --checknpm run typecheck-clienthas no errors in changed files; existing unrelated errors remain innative/electron-main/auth.tsand component fixture utilities