Repository navigation
Show progress while downloading agent SDK binaries - #322919
Merged
Giuseppe Cianci (Giuspepe) merged 6 commits intoJun 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds end-to-end download progress reporting for on-demand agent SDK binary downloads (Claude/Codex), forwarding progress from the agent host through the Agent Host Protocol (root/downloadProgress) and surfacing it in the Sessions (Agents) window as an IProgressService notification.
Changes:
- Emit throttled byte/total download progress from
AgentSdkDownloaderand forward it viaAgentHostStateManager.emitDownloadProgress()onto the AHP root notification channel. - Render
root/downloadProgressnotifications in the Sessions providers as notification progress toasts keyed bydownloadId. - Avoid cold-download side effects from non-user-initiated Codex/Claude operations (e.g. prewarm / listSessions) by gating them on “SDK already local” checks; add/extend unit tests for protocol forwarding and downloader progress.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts | Stubs IProgressService for provider tests after adding progress dependency. |
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts | Plumbs IProgressService into the remote sessions provider base constructor. |
| src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts | Stubs IProgressService for provider tests after adding progress dependency. |
| src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts | Plumbs IProgressService into the local sessions provider base constructor. |
| src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts | Tracks active downloads and renders root/downloadProgress as notification progress toasts. |
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Adds coverage verifying root/downloadProgress frames are forwarded to connected clients. |
| src/vs/platform/agentHost/test/node/claudeSubagentResolver.test.ts | Updates fake Claude SDK service to satisfy new canLoadWithoutDownload() API. |
| src/vs/platform/agentHost/test/node/claudeAgent.test.ts | Updates fakes/stubs for new downloader + Claude SDK service APIs. |
| src/vs/platform/agentHost/test/node/claudeAgent.integrationTest.ts | Updates integration fake to satisfy new canLoadWithoutDownload() API. |
| src/vs/platform/agentHost/test/node/agentSdkDownloader.test.ts | Adds tests validating monotonic progress frames and terminal completion semantics. |
| src/vs/platform/agentHost/node/codex/codexAgent.ts | Prevents prewarm/listing from triggering cold SDK downloads; adds displayName. |
| src/vs/platform/agentHost/node/claude/claudeAgentSdkService.ts | Adds displayName and canLoadWithoutDownload() to gate session listing. |
| src/vs/platform/agentHost/node/claude/claudeAgent.ts | Gates listSessions() to avoid cold downloads at startup. |
| src/vs/platform/agentHost/node/agentSdkDownloader.ts | Implements progress eventing + “resolvable without download” checks; adds display name to packages. |
| src/vs/platform/agentHost/node/agentHostStateManager.ts | Adds emitDownloadProgress() on the root notification channel. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Wires SDK download progress events into root/downloadProgress notifications. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Wires SDK download progress events into root/downloadProgress notifications. |
| src/vs/platform/agentHost/common/state/sessionActions.ts | Exposes DownloadPhase / DownloadProgressParams and adds NotificationType.DownloadProgress. |
| src/vs/platform/agentHost/common/state/protocol/version/registry.ts | Declares root/downloadProgress as introduced in protocol 0.5.0. |
| src/vs/platform/agentHost/common/state/protocol/common/messages.ts | Adds root/downloadProgress to the server notification map. |
| src/vs/platform/agentHost/common/state/protocol/channels-root/notifications.ts | Defines the root/downloadProgress wire contract (phase/bytes/ids). |
| src/vs/platform/agentHost/common/state/protocol/.ahp-version | Updates vendored protocol revision pointer. |
| src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.ts | Allows root/downloadProgress notifications through the client switch. |
Copilot's findings
- Files reviewed: 23/23 changed files
- Comments generated: 2
VS Code ships the Claude and Codex agents but not their native SDK
binaries; those are downloaded on demand from the CDN the first time a
session of that provider materializes, then cached on disk. The tarballs
are 70-95 MB, so on a cold cache the first session start blocked for
several seconds with no user feedback. Surface a progress indicator
instead.
Wire format: a generic, operation-agnostic `root/progress` notification
(mirrors the AHP spec), correlated to its originating request by a
`progressToken` the client supplies on `createSession` rather than naming
a domain object. Completion is signalled by `progress === total`; the
host emits a terminal frame with `total === progress`.
Downloader: `_fetch` accumulates received bytes and reads `Content-Length`,
firing a throttled host-level `onDidDownloadProgress` event keyed by
package id. Adds `isSdkResolvableWithoutDownload` / `canLoadWithoutDownload`
so eager/background callers (e.g. `listSessions` at startup) never kick off
a cold download.
Server (agent host): `createSession` records `{provider -> {session ->
token}}`; when a session materializes on first message and triggers the
cold download, the host-level event is fanned out as one `root/progress`
notification per waiting token (package id === provider id), building the
localized `message` ("Downloading {0} agent…"). Tokens are cleared on
materialize / dispose. Codex prewarm is gated so it can't trigger a cold
download.
Client (renderer): the new-session composer supplies a `progressToken` on
its eager `createSession`; `_handleProgress` correlates incoming frames by
token, shows a determinate (or byte-count) notification, and dismisses it
once `progress >= total`.
Vendors the protocol copy at AHP d35ed4a.
Co-authored-by: Copilot <[email protected]>
Giuseppe Cianci (Giuspepe)
force-pushed
the
agents/sdk-download-progress-ahp
branch
from
June 26, 2026 17:09
9c5d8a0 to
cc96f8f
Compare
…rogress-ahp # Conflicts: # src/vs/platform/agentHost/common/state/protocol/.ahp-version # src/vs/platform/agentHost/node/agentHostStateManager.ts # src/vs/platform/agentHost/node/agentService.ts # src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts
The SDK download is provider-global — one physical fetch shared by every session of a provider — but each new-session composer minted its own `progressToken` and the host fanned one frame out per token. So clicking New Session repeatedly stacked duplicate download toasts, and switching provider left the old toast hung (its provisional session was discarded, so no terminal frame ever arrived for that token). Fix the modelling at the source: the host now emits a SINGLE `progress` stream per download, keyed by the download's own stable identity (the package id), rather than fanning per session token. The per-`createSession` `progressToken` is kept purely as an opt-in signal — the host tracks which sessions are interested and emits while at least one is, but the token it echoes is the download's, shared across the provider. The client keys indicators by `progressToken` (now stable per download) and dismisses on the host's terminal frame, so there is exactly one indicator with a deterministic lifecycle — no message-keying or idle-timeout heuristics. Co-authored-by: Copilot <[email protected]>
Giuseppe Cianci (Giuspepe)
force-pushed
the
agents/sdk-download-progress-ahp
branch
from
June 29, 2026 13:59
354fadf to
5fa5adc
Compare
Giuseppe Cianci (Giuspepe)
marked this pull request as ready for review
June 29, 2026 14:55
Dirk Bäumer (dbaeumer)
approved these changes
Jun 29, 2026
3 tasks done
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.
Screen.Recording.2026-06-25.at.15.19.44.mov
Why
VS Code ships the Claude and Codex agents but not their native binaries — those download on demand from the CDN (70–95 MB compressed) the first time a session of that type starts, then cache. On a cold cache the first turn blocks for several seconds with no feedback (it looks hung). This surfaces a progress indicator in the Agents window instead.
What you see
A toast in the Agents window — "Downloading Claude…" / "Downloading Codex…" — filling 0→100% (determinate when the CDN sends
Content-Length, indeterminate otherwise), clearing on completion.How it works
The download runs in the agent host (utility process locally, or the remote server over WSL/SSH); the UI is in the renderer. Progress crosses the agent-host protocol via the new
root/downloadProgressnotification:agentSdkDownloader._fetchcounts received bytes vsContent-Length, throttles, and firesonDidDownloadProgress.kind: 'agent-sdk',resourceId,phase) through the state manager — the same fan-out path as session notifications, so it reaches both local (IPC) and remote (WebSocket) clients.IProgressServicetoast keyed bydownloadId.Also gates Codex's eager prewarm-on-create so it no longer triggers a cold download with no user action — the download now happens on first message.
Depends on
Vendors the protocol types from microsoft/agent-host-protocol#263, which defines
root/downloadProgress. That PR should merge first — it's the source of truth for the wire contract; the vendored copy here (src/vs/platform/agentHost/common/state/protocol/) mirrors it.