microsoft / microsoft/vscode

Start the agent host process earlier (prewarm) so local sessions appear quickly on window startup

Open
#324,330 0 comments 0 reactions 1 assignee Claimed by @roblourens View on GitHub
agent-host bug
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Follow-up to #324329.

The agent host utility process is spawned lazily — only when something first accesses `IAgentHostService`, which today happens at `WorkbenchPhase.AfterRestored`. So on a fresh window start the process (and therefore the live session list and session openability) only begins coming up after restore. By contrast, the extension host is started earlier, at `LifecyclePhase.Ready`.

We should start the agent host sooner:

- **Prewarm the process:** a small contribution at `BlockRestore` (gated on `isAgentHostEnabled`), in both the Agents window and the editor window, that forces `IAgentHostService` construction so the spawn + SDK load + auth overlaps window restore. It's non-blocking (the client constructor returns immediately after scheduling the async connect).
- **Reorder the contribution:** register the local agent host sessions provider before the heavy `AgentHostContribution` so the startup-cached sessions surface as soon as the provider registers rather than being queued behind agent discovery / content-provider / language-model / customization wiring.
- **Optional (measure first):** move the provider's hydration fully pre-restore so the cached list paints before restore.

The session-caching half (immediate-on-reload) is tracked by #324329 / #324328; this issue tracks the process-startup + ordering work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.