agentHost: retain recently used sessions - #332449
Merged
roblourens merged 3 commits intoAug 25, 2026
Merged
Conversation
Replace the short idle-session timeout with a soft MRU residency limit. Keep active and observed sessions pinned, release archived or least-recently-used eligible sessions non-destructively, and centralize logical subscription liveness in one service.\n\n(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces timeout-based idle eviction with MRU-based Agent Host session residency while preserving durable restoration.
Changes:
- Adds centralized subscription tracking and MRU residency coordination.
- Releases archived or excess eligible sessions with retry handling.
- Updates lifecycle, provider, and integration coverage for the new policy.
Show a summary per file
| File | Description |
|---|---|
common/agentHostSubscriptionService.ts |
Defines subscription tracking and session resolution. |
common/agentService.ts |
Adds residency limit and retry environment variables. |
node/agentHostSubscriptionService.ts |
Implements centralized subscriber tracking. |
node/agentSessionResidency.ts |
Implements MRU eviction and provider release coordination. |
node/agentService.ts |
Integrates residency with session lifecycle operations. |
node/agentServiceComposition.ts |
Passes service options into AgentService. |
node/agentHostServices.ts |
Registers the subscription service. |
node/agentHostStateManager.ts |
Updates residency-related documentation. |
test/node/agentSessionResidency.test.ts |
Tests MRU, pinning, retries, and races. |
test/node/agentService.test.ts |
Updates and expands lifecycle coverage. |
test/node/agentServiceTestUtils.ts |
Exposes residency test options. |
test/node/agentHostStateManager.test.ts |
Updates eviction terminology. |
test/node/protocolServerHandler.test.ts |
Updates residency terminology. |
test/node/protocol/sessionLifecycle.integrationTest.ts |
Validates zero-capacity release and restore. |
test/node/providerIntegration/copilotMockLlm.integrationTest.ts |
Validates provider release with retry timing. |
test/node/e2e/harness/agentHostE2ETestHarness.ts |
Configures zero-capacity E2E servers. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 16/16 changed files
- Comments generated: 0
- Review effort level: Balanced
Resolve Agent Host bootstrap and archive-race conflicts against the latest main branch.\n\n(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bring the draft PR up to the latest base after review.\n\n(Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
August 25, 2026 01:57
roblourens
enabled auto-merge (squash)
August 25, 2026 01:57
joshspicer
approved these changes
Aug 25, 2026
roblourens
deleted the
roblou/agents/idle-session-eviction-policy-proposal
branch
August 25, 2026 03:07
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
AgentSessionResidencyValidation
npm run typecheck-clientnpm run valid-layers-check(Written by Copilot)