Skip to content

agentHost: retain recently used sessions - #332449

Merged
roblourens merged 3 commits into
mainfrom
roblou/agents/idle-session-eviction-policy-proposal
Aug 25, 2026
Merged

agentHost: retain recently used sessions#332449
roblourens merged 3 commits into
mainfrom
roblou/agents/idle-session-eviction-policy-proposal

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

  • replace the 30-second idle release timeout with a soft MRU limit of 10 resident root sessions
  • count active and observed sessions toward the limit while allowing pinned sessions to overflow it temporarily
  • release archived and least-recently-used eligible sessions non-destructively, preserving lossless restore
  • centralize logical subscriber liveness in an Agent Host subscription service
  • isolate MRU and provider-release coordination in AgentSessionResidency

Validation

  • npm run typecheck-client
  • npm run valid-layers-check
  • AgentSessionResidency unit tests: 8 passing
  • AgentService unit tests: 362 passing, 16 pending
  • Agent Host service bootstrap tests: 8 passing
  • targeted session lifecycle integration test: 1 passing
  • pre-commit hygiene hook

(Written by Copilot)

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>
Copilot AI balanced review requested due to automatic review settings August 24, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

roblourens and others added 2 commits August 24, 2026 17:02
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
roblourens marked this pull request as ready for review August 25, 2026 01:57
@roblourens
roblourens enabled auto-merge (squash) August 25, 2026 01:57
@roblourens
roblourens merged commit 8554e27 into main Aug 25, 2026
27 checks passed
@roblourens
roblourens deleted the roblou/agents/idle-session-eviction-policy-proposal branch August 25, 2026 03:07
@vs-code-engineering vs-code-engineering Bot added this to the 1.136.0 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants