Skip to content

agentHost: support copilotd metadata and schema controls - #339034

Merged
roblourens merged 13 commits into
mainfrom
roblou/agents/vscode-copilot-integration-plan
Oct 2, 2026
Merged

roblourens merged 13 commits into
mainfrom
roblou/agents/vscode-copilot-integration-plan

Conversation

@roblourens

@roblourens roblourens commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Enable the Agents Window to consume compatible VS Code Agent Host and copilotd metadata through host-neutral, domain-specific helpers.

  • Separate host implementations into private meta/vscode and meta/copilotd folders, with public dispatch helpers and an ESLint import boundary.
  • Integrate message, attachment, tool output, error, model, usage, and context metadata into the existing features. Preserve VS Code behavior, avoid mixing metadata sources, and emit compatible outgoing representations where an equivalent exists.
  • Recognize host-advertised session/model schema keys for approval, workspace/worktree, base branch, reasoning, context, and Auto routing. Write the advertised keys rather than sending both aliases.
  • Preserve expanded-prompt display metadata across ordinary retries, interrupted turns, steering, and restoration. Keep current occupancy separate from turn tokens and refresh the latest restored response while idle.

Generated contracts and tests

Keep the generated declarations checked in, but do not vendor the schemas or a standalone license file. A small source pin records the upstream commit; explicit regeneration reads that commit from a supplied local checkout without fetching or changing it. The only retained upstream inputs are the conformance test fixtures, located beside the compiled tests and copied by the normal build. Ordinary builds and tests do not require the Copilot host checkout or network access.

Add a basic public-helper compatibility matrix, 24 controlled-peer wire-to-feature tests through the real protocol client and registered production handler, and regression coverage for the actual Chat retry/model paths and steering persistence. The upstream vector runner executes 109 client cases from 17 fixture files.

Validation

  • npm run gulp compile-client — passed, including copying all 17 conformance fixtures intact.
  • env -u COPILOT_HOME ./scripts/test.sh --runGlob '{**/platform/agentHost/test/common/*.test.js,**/platform/agentHost/test/electron-browser/agentHostProtocolClient.test.js,**/platform/agentHost/test/node/{copilotMetadataConformance,chatContributions,sessionDatabase,copilotAgentSession,copilotAgent,mapSessionEvents,copilotSlashCommand,copilotSlashCommandCompletionProvider,proxyChatError,copilotSdkChatError,copilotToolDisplay,copilotNonPtyShellTerminals,copilotShellTools,copilotFailureTelemetry,localAgentHostMetadata}.test.js,**/workbench/contrib/chat/test/browser/agentSessions/*.test.js,**/workbench/contrib/chat/test/common/{chatErrorMessages,chatService/chatService,model/chatModel,attachments/chatDraft}.test.js,**/workbench/contrib/chat/test/browser/agentHostUsageSidecar.test.js,**/sessions/contrib/providers/agentHost/test/browser/**/*.test.js,**/sessions/contrib/providers/remoteAgentHost/test/browser/{remoteAgentHostSessionsProvider,cloudSandboxAgentHostContribution}.test.js}' — 6,181 passed, 17 existing pending.
  • npm run agent-host:check-copilot-meta -- --source "$COPILOT_HOST_CHECKOUT" — passed against the pinned upstream checkout.
  • ESLint across all 154 changed TypeScript files — passed.
  • npm run valid-layers-check — passed.
  • node --test --test-reporter=dot .eslint-plugin-local/tests/code-no-private-agent-host-meta-import.test.ts — passed.
  • git diff --check — passed.

The test process omits the agent session's inherited COPILOT_HOME so mocked home directories remain isolated. Explicit override tests are included. Validation was on macOS; live two-host and Windows/Linux runs were not performed.

Review notes

Latest main (072617082f2) has been merged in b8d230a1138, resolving the conflict-blocked checks. The merged client compiles, and the expanded Agent Host/protocol/metadata/Chat compatibility baseline passes 7,315 tests with 33 pending. GitHub now reports the PR as mergeable and CI has restarted. No authentication, transport, relay, or provisioning redesign is included.

Most of the structural diff moves existing metadata readers behind the public boundary. Valid copilot.modelText is intentionally honored on either host. Error readers fall back from unusable VS Code data to copilotd; attachment detail remains available alongside unrelated VS Code attachment metadata.

(Written by Copilot)

Normalize VS Code and copilotd metadata behind host-neutral helpers and recognize the advertised session/model configuration keys. Preserve compatible outgoing metadata, retries, steering display records, and context usage across restoration.

Keep generated declarations pinned without vendoring schemas, and add shared compatibility and real-handler wire regression coverage.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 01:17

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.

Copilot review overview

🟡 Changes recommended

Preserved-ID retries can resurrect superseded Agent Host metadata on a later retry.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds host-neutral support for VS Code and copilotd metadata, schema-driven session/model controls, and persistent expanded-prompt metadata.

Changes:

  • Introduces public metadata adapters with private host-specific implementations and an ESLint boundary.
  • Integrates usage, errors, tools, attachments, model configuration, approvals, and context occupancy.
  • Preserves model-bound prompt metadata through retries, steering, serialization, and restoration.
File Description
src/​vs/​workbench/​contrib/​chat/​test/​common/​model/​chatModel.test.ts Tests metadata serialization.
src/​vs/​workbench/​contrib/​chat/​test/​common/​chatService/​chatService.test.ts Tests retry metadata.
src/​vs/​workbench/​contrib/​chat/​test/​common/​chatErrorMessages.test.ts Tests copilotd errors.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widgetHosts/​viewPane/​chatContextUsageWidget.test.ts Tests reported occupancy.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​widget/​input/​modelPicker/​modelPickerConfiguration.test.ts Tests schema aliases.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostLanguageModelProvider.test.ts Tests Auto tiers.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostGenericConfigChips.test.ts Tests dedicated controls.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostClientTools.test.ts Tests tool preferences.
src/​vs/​workbench/​contrib/​chat/​common/​tools/​languageModelToolsService.ts Adds host tool preferences.
src/​vs/​workbench/​contrib/​chat/​common/​model/​chatSessionOperationLog.ts Persists metadata and usage.
src/​vs/​workbench/​contrib/​chat/​common/​chatSessionsService.ts Adds request metadata contracts.
src/​vs/​workbench/​contrib/​chat/​common/​chatService/​chatServiceImpl.ts Propagates retry metadata.
src/​vs/​workbench/​contrib/​chat/​common/​chatService/​chatService.ts Extends usage diagnostics.
src/​vs/​workbench/​contrib/​chat/​common/​chatErrorMessages.ts Renders copilotd errors.
src/​vs/​workbench/​contrib/​chat/​browser/​widgetHosts/​viewPane/​chatContextUsageWidget.ts Displays reported occupancy.
src/​vs/​workbench/​contrib/​chat/​browser/​widget/​input/​modelPicker/​modelPickerModelConfig.ts Selects advertised aliases.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​agentHostUsageSidecar.ts Records call diagnostics.
src/​vs/​workbench/​contrib/​chat/​browser/​chatDebug/​agentHostChatDebugProvider.ts Uses public usage metadata.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostToolUtils.ts Emits tool preferences.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostModePickerPresentation.ts Supports approval bindings.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostLanguageModelProvider.ts Groups native Auto tiers.
src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostGenericConfigChips.ts Avoids duplicate controls.
src/​vs/​sessions/​contrib/​providers/​remoteAgentHost/​test/​browser/​remoteAgentHostSessionsProvider.test.ts Updates config fixture.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostModePicker.test.ts Tests mutability handling.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHostClaudePermissionModePicker.test.ts Updates permission fixture.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​agentHost/​agentHostPermissionPickerDelegate.test.ts Tests copilotd approvals.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​agentHostModePicker.ts Enforces schema writability.
src/​vs/​sessions/​contrib/​providers/​agentHost/​AGENT_HOST_SESSIONS_PROVIDER.md Documents schema bindings.
src/​vs/​platform/​agentHost/​test/​node/​sessionDatabase.test.ts Tests turn identity mapping.
src/​vs/​platform/​agentHost/​test/​node/​fixtures/​copilotdMetadata/​user-message.copilot.visibility-vectors.json Adds visibility vectors.
src/​vs/​platform/​agentHost/​test/​node/​copilotFailureTelemetry.test.ts Uses public error adapter.
src/​vs/​platform/​agentHost/​test/​node/​copilotAgentSession.test.ts Tests steering model text.
src/​vs/​platform/​agentHost/​test/​node/​chatContributions.test.ts Tests model-text lifecycle.
src/​vs/​platform/​agentHost/​test/​common/​sessionTestHelpers.ts Implements metadata lookup.
src/​vs/​platform/​agentHost/​test/​common/​agentModelCallMeta.test.ts Tests call-detail normalization.
src/​vs/​platform/​agentHost/​node/​sessionDatabase.ts Reads metadata by identities.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgentSession.ts Uses expanded steering prompts.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotAgent.ts Updates metadata import.
src/​vs/​platform/​agentHost/​node/​codex/​codexAgent.ts Updates metadata import.
src/​vs/​platform/​agentHost/​node/​claude/​claudeAgent.ts Updates metadata import.
src/​vs/​platform/​agentHost/​node/​chatContributions/​sessionWorkspaceConversion/​sessionWorkspaceConversionService.ts Uses public message helper.
src/​vs/​platform/​agentHost/​node/​chatContributions/​sessionWorkspaceConversion/​sessionWorkspaceConversionContribution.ts Uses public message helper.
src/​vs/​platform/​agentHost/​node/​chatContributions/​modelText/​modelTextContribution.ts Persists expanded prompts.
src/​vs/​platform/​agentHost/​node/​chatContributions/​localCommand/​localCommandContribution.ts Defers metadata commands.
src/​vs/​platform/​agentHost/​node/​chatContributions/​builtInChatContributions.ts Registers model-text contribution.
src/​vs/​platform/​agentHost/​node/​agentSideEffects.ts Uses public usage adapter.
src/​vs/​platform/​agentHost/​node/​agentService.ts Uses public message helper.
src/​vs/​platform/​agentHost/​node/​agentHostTelemetryReporter.ts Uses public error adapter.
src/​vs/​platform/​agentHost/​common/​sessionDataService.ts Extends database contract.
src/​vs/​platform/​agentHost/​common/​meta/​vscode/​* Houses VS Code-specific metadata implementations.
src/​vs/​platform/​agentHost/​common/​meta/​copilotd/​* Houses copilotd readers and compatibility logic.
src/​vs/​platform/​agentHost/​common/​meta/​README.md Documents metadata architecture.
src/​vs/​platform/​agentHost/​common/​meta/​metadata.ts Adds source-selection helper.
src/​vs/​platform/​agentHost/​common/​meta/​attachmentMeta.ts Exposes attachment details.
src/​vs/​platform/​agentHost/​common/​meta/​agentUsageMeta.ts Normalizes usage metadata.
src/​vs/​platform/​agentHost/​common/​meta/​agentModelMeta.ts Normalizes model metadata.
src/​vs/​platform/​agentHost/​common/​meta/​agentModelCallMeta.ts Normalizes call diagnostics.
src/​vs/​platform/​agentHost/​common/​meta/​agentMessageMeta.ts Normalizes message metadata.
src/​vs/​platform/​agentHost/​common/​meta/​errorMeta.ts Normalizes error metadata.
src/​vs/​platform/​agentHost/​common/​meta/​agentPermissionRequestMeta.ts Selects permission convention.
src/​vs/​platform/​agentHost/​common/​meta/​*.ts forwarding modules Preserve public metadata APIs.
src/​vs/​platform/​agentHost/​common/​agentModelConfiguration.ts Uses public model adapter.
package.json Adds generator dependency/scripts.
eslint.config.js Enables metadata-boundary rule.
build/​agentHost/​README.md Documents generation workflow.
build/​agentHost/​copilotd-source.json Pins upstream source.
build/​agentHost/​generateCopilotMetadata.ts Generates pinned declarations.
.vscode/​settings.json Marks generated output read-only.
.github/​instructions/​agentHostTesting.instructions.md Documents import boundary.
.eslint-plugin-local/​README.md Documents lint rule.
.eslint-plugin-local/​code-no-private-agent-host-meta-import.ts Enforces private implementations.
.eslint-plugin-local/​tests/​code-no-private-agent-host-meta-import.test.ts Tests boundary enforcement.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
Preserve upstream session comparison support, keep new metadata implementations behind the host-neutral boundary, and adapt the new mode configuration test to schema discovery.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens and others added 2 commits October 1, 2026 12:06
Recognize known Copilot app tool aliases when host presentation is generic, while preserving explicit metadata and existing tool cards. Keep replacement request metadata across retries.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve upstream background-work and MCP-routing tests alongside schema discovery and tool-presentation compatibility.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as ready for review October 1, 2026 20:56
@roblourens
roblourens enabled auto-merge (squash) October 1, 2026 20:56
@roblourens
roblourens marked this pull request as draft October 1, 2026 20:56
auto-merge was automatically disabled October 1, 2026 20:56

Pull request was converted to draft

roblourens and others added 2 commits October 1, 2026 13:57
Replace generic enum bindings with concrete schema-property selectors and explicit approval/isolation conversions. Remove model-text and command-marker support, their generated contracts, contribution and custom persistence for a separate change.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bring the branch up to current main while preserving the deferred prompt scope and concrete session config properties.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as ready for review October 1, 2026 21:07
@roblourens
roblourens enabled auto-merge (squash) October 1, 2026 21:07
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Ulugbek Abdullaev (@ulugbekna)

Matched files:

  • src/vs/platform/agentHost/common/meta/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/meta/vscode/agentHostAutomationsMeta.ts

Ben Villalobos (@benvillalobos)

Matched files:

  • src/vs/platform/agentHost/common/meta/agentHostAutomationsMeta.ts
  • src/vs/platform/agentHost/common/meta/vscode/agentHostAutomationsMeta.ts

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/claudeAgent.ts

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 4ffbb26a Current: 52308071

Changed (3)

sessions/accountMenu/WeeklyAndFiveHourLimits/Light
Before After
before after
sessions/accountMenu/WeeklyLimitOnly/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/DiscoverPluginsLoadingMore/Light
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

roblourens and others added 2 commits October 1, 2026 14:19
Move inline tool-input extraction to the dependency-light input module and retain the sessionState re-export. Keep Copilot tool presentation from importing the state facade that already depends on metadata readers.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve upstream permission decision provenance together with the host-neutral metadata readers, schema properties and attachment/output helpers.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as draft October 1, 2026 21:41
auto-merge was automatically disabled October 1, 2026 21:41

Pull request was converted to draft

Keep fixture providers aligned with schema-aware pickers and register their quick input dependency, fixing screenshot render failures without changing production behavior.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as ready for review October 1, 2026 22:27
Preserve the public metadata façade and apply upstream sandbox-policy removal semantics in the private VS Code implementation.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens enabled auto-merge (squash) October 1, 2026 23:38
@roblourens
roblourens marked this pull request as draft October 1, 2026 23:39
auto-merge was automatically disabled October 1, 2026 23:39

Pull request was converted to draft

Preserve the public system-notification façade and register upstream BYOK tool-limit warnings in the private VS Code metadata implementation.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens and others added 2 commits October 1, 2026 17:19
Keep the new VS Code runtime-model-configuration parser behind the private metadata boundary while preserving its public API and upstream subagent/picker behavior.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve incoming MCP source attribution while retaining the public usage metadata reader in signal routing.

(Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens
roblourens marked this pull request as ready for review October 2, 2026 00:42
@roblourens
roblourens enabled auto-merge (squash) October 2, 2026 00:42
@roblourens
roblourens merged commit 675354c into main Oct 2, 2026
36 checks passed
@roblourens
roblourens deleted the roblou/agents/vscode-copilot-integration-plan branch October 2, 2026 01:04
@vs-code-engineering vs-code-engineering Bot added this to the 1.141.0 milestone Oct 2, 2026
roblourens added a commit that referenced this pull request Oct 2, 2026
Stop enforcing readOnly when validating and forwarding session config so settings-derived worktree options survive discovery, creation, and refresh. Keep picker editability and the remaining schema checks unchanged. Add regression coverage for worktree options and update workbench payload expectations.

Regression from #339034. (Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

4 participants