Report agent host build info via RootState._meta#320256
Merged
Merged
Conversation
Surface the hosting VS Code CLI's build info (version, commit, date, quality) to clients so they can see which build is hosting an agent. The info is carried on a well-known `hostBuild` key inside the new optional `RootState._meta` property bag. RootState is delivered as a snapshot at connect time, so every client (local and remote) receives it reliably without a protocol-level addition. - Add `_meta?: Record<string, unknown>` to the generated `RootState`. - Add host build info helpers in sessionState.ts (read/with/format + `hostBuildInfoFromProduct`). - Seed `_rootState._meta` in AgentHostStateManager from a new `hostBuildInfo` option, wired from the product service in agentService. - RemoteAgentHostLogForwarder writes a one-time "Agent host version ..." header into the Output channel on attach. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes the hosting VS Code CLI’s build metadata (version/commit/date/quality) to Agent Host Protocol clients by adding an optional RootState._meta property bag and standardizing a well-known hostBuild entry. This makes it possible for remote clients (and log output viewers) to identify exactly which host build they are connected to without adding new protocol messages.
Changes:
- Adds
_meta?: Record<string, unknown>to the protocolRootStateand introduceshostBuildhelpers (IHostBuildInfo, read/write/format/fromProduct) insessionState.ts. - Wires host build info into
AgentHostStateManagervia a newhostBuildInfooption, seeded fromIProductServiceinAgentService. - Adds coverage for helper behavior and root-state seeding, and prints a one-time “Agent host version …” header into the forwarded remote OTLP logs Output channel.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostLogForwarder.ts | Writes a one-time host build-info header into the remote agent host log Output channel. |
| src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts | Adds tests ensuring _meta.hostBuild is seeded (or omitted) as expected. |
| src/vs/platform/agentHost/test/common/state/hostBuildInfoMeta.test.ts | Adds unit tests for the _meta.hostBuild helpers (round-trip, validation, formatting). |
| src/vs/platform/agentHost/node/agentService.ts | Passes host build info (derived from IProductService) into the state manager options. |
| src/vs/platform/agentHost/node/agentHostStateManager.ts | Adds a hostBuildInfo option and seeds RootState._meta using withHostBuildInfo. |
| src/vs/platform/agentHost/common/state/sessionState.ts | Introduces RootMeta/hostBuild conventions and helper utilities for reading/writing/formatting host build info. |
| src/vs/platform/agentHost/common/state/protocol/channels-root/state.ts | Extends the protocol RootState type to include the optional _meta property bag. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Use a type-only import for IProductService in the common state module (it's only referenced as a type), avoiding an unnecessary runtime dependency / potential circular import. - Reword the host build info header doc comment to not imply guaranteed ordering, since the line is appended to the Output channel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dmitrivMS
approved these changes
Jun 6, 2026
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.
What
Surfaces the hosting VS Code CLI's build info (version, commit, date, quality) to agent host clients so they can tell which build is hosting a given agent.
The info is carried on a well-known
hostBuildkey inside a new optionalRootState._metaproperty bag.RootStateis delivered as a snapshot at connect time, so every local and receives it reliably, with no protocol-level message addition required.remote clientWhy
_metaonRootStateRootStateis the agent host's own state and is sent as a snapshot inside the initialize response, reaching all clients deterministically.initialize, so a log emitted during connect never reaches remote clients.Changes
_meta?: Record<string, unknown>to the generatedRootState(matches the merged protocol change).sessionState.ts:IHostBuildInfo,readHostBuildInfo,withHostBuildInfo,formatHostBuildInfo,hostBuildInfoFromProduct.AgentHostStateManagerseeds_rootState._metafrom a newhostBuildInfooption, wired from the product service inagentService.ts.RemoteAgentHostLogForwarderwrites a one-timeAgent host version ...header into the Output channel on attach.Note: only the additive
_metafield is taken from the protocol here. The broader protocol sync (changeset/session restructure that has accumulated on protocolmain) is intentionally left out of this it's an unrelated breaking change that needs its own consumer updates.PR(Written by Copilot)