Skip to content

Report agent host build info via RootState._meta#320256

Merged
roblourens merged 2 commits into
mainfrom
roblou/host-build-info-meta
Jun 6, 2026
Merged

Report agent host build info via RootState._meta#320256
roblourens merged 2 commits into
mainfrom
roblou/host-build-info-meta

Conversation

@roblourens
Copy link
Copy Markdown
Member

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 hostBuild key inside a new optional RootState._meta property bag. RootState is delivered as a snapshot at connect time, so every local and receives it reliably, with no protocol-level message addition required.remote client

Why _meta on RootState

  • RootState is the agent host's own state and is sent as a snapshot inside the initialize response, reaching all clients deterministically.
  • Connect-time logging was considered and rejected: the OTLP logs channel has no replay buffer and clients subscribe only after initialize, so a log emitted during connect never reaches remote clients.

Changes

  • Add optional _meta?: Record<string, unknown> to the generated RootState (matches the merged protocol change).
  • Add host build info helpers in sessionState.ts: IHostBuildInfo, readHostBuildInfo, withHostBuildInfo, formatHostBuildInfo, hostBuildInfoFromProduct.
  • AgentHostStateManager seeds _rootState._meta from a new hostBuildInfo option, wired from the product service in agentService.ts.
  • RemoteAgentHostLogForwarder writes a one-time Agent host version ... header into the Output channel on attach.

Note: only the additive _meta field is taken from the protocol here. The broader protocol sync (changeset/session restructure that has accumulated on protocol main) is intentionally left out of this it's an unrelated breaking change that needs its own consumer updates.PR

(Written by Copilot)

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>
Copilot AI review requested due to automatic review settings June 6, 2026 20:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 protocol RootState and introduces hostBuild helpers (IHostBuildInfo, read/write/format/fromProduct) in sessionState.ts.
  • Wires host build info into AgentHostStateManager via a new hostBuildInfo option, seeded from IProductService in AgentService.
  • 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

Comment thread src/vs/platform/agentHost/common/state/sessionState.ts Outdated
- 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>
@roblourens roblourens marked this pull request as ready for review June 6, 2026 22:16
@roblourens roblourens enabled auto-merge (squash) June 6, 2026 22:16
@roblourens roblourens merged commit d40db46 into main Jun 6, 2026
25 checks passed
@roblourens roblourens deleted the roblou/host-build-info-meta branch June 6, 2026 22:53
@vs-code-engineering vs-code-engineering Bot added this to the 1.124.0 milestone Jun 6, 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