Skip to content

Improve performance of session listing in agent service - #331760

Merged
Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/vscode-insiders-agent-logs-review
Aug 20, 2026
Merged

Improve performance of session listing in agent service#331760
Benjamin Christopher Simmonds (benibenj) merged 1 commit into
mainfrom
benibenj/agents/vscode-insiders-agent-logs-review

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

This pull request addresses a significant performance issue identified in the agent host logs, specifically related to the listSessions function in the agentService.

Changes made:

  • Optimization: The _computeSessions method was modified to skip the computation of external sessions when the mode is set to hide them. This change reduces the number of SQLite database opens and improves the startup time significantly.
  • Testing: A new test was added to ensure that the optimization correctly skips the catalog work for external sessions, confirming its effectiveness.
  • Code Quality: The changes maintain or improve code quality by preserving existing invariants and ensuring accurate diagnostic logging.

Verification:

  • All relevant unit tests passed successfully, confirming that the changes do not introduce any regressions.
  • Type checks were performed and passed without issues.

This targeted optimization should enhance the performance of the agent host without requiring extensive refactoring.

Copilot AI balanced review requested due to automatic review settings August 20, 2026 08:05

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

Optimizes Agent Host session listing by avoiding unnecessary metadata and database reads for hidden external sessions.

Changes:

  • Prefilters external sessions when external visibility is disabled.
  • Preserves overlay filtering and diagnostic counts.
  • Adds regression coverage for skipped database work.
Show a summary per file
File Description
agentService.ts Adds external-session prefiltering and logging updates.
agentService.test.ts Verifies hidden sessions avoid database reads.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +2127 to +2137
/**
* Whether {@link _shouldIncludeSession} is guaranteed to reject every
* external session under `mode`, letting {@link _computeSessions} drop them
* on the registry's `external` flag alone.
*
* `None` is the only mode that rejects external sessions outright. The
* adoptable-legacy exemption is the single way one could still be visible,
* and while migration is off that marker forces exclusion as well — which
* matters because the marker is only discoverable from the provider
* metadata read this skip avoids.
*/
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit be1bc52 into main Aug 20, 2026
45 of 46 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the benibenj/agents/vscode-insiders-agent-logs-review branch August 20, 2026 10:00
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 20, 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