Skip to content

Fix Agents app group policy#308603

Merged
joshspicer merged 7 commits intomainfrom
copilot/inquisitive-rat
Apr 10, 2026
Merged

Fix Agents app group policy#308603
joshspicer merged 7 commits intomainfrom
copilot/inquisitive-rat

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Apr 8, 2026

This pull request introduces a new feature to block access to the Agents app when it is disabled by organization policy, ensuring that enterprise policy enforcement is respected even when running as an embedded app. It also adds a UI overlay to inform users when access is blocked, updates policy configuration handling to support parent app policies, and includes related UI assets and tests.

Copilot AI review requested due to automatic review settings April 8, 2026 20:22
@joshspicer joshspicer force-pushed the copilot/inquisitive-rat branch from 969ac9a to 9fd208b Compare April 8, 2026 20:25
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 introduces an organization-controlled enablement switch for the Agents app (via chat.agentsApp.enabled + policy integration) and shows a full-window “blocked” overlay in the sessions/Agents window when disabled. In addition, it includes a broad refactor/extension of the Agent Host Protocol client plumbing (subscription-based state), plus new agent-host-backed terminal support and related protocol/tooling updates.

Changes:

  • Add chat.agentsApp.enabled (hidden) setting with AgentsAppEnabled policy wiring and token-based gating, and add a sessions-window overlay contribution that blocks usage when disabled.
  • Replace/extend AHP client state handling with refcounted subscriptions (AgentSubscriptionManager) and new IAgentConnection surface (rootState, getSubscription, dispatch).
  • Add agent-host terminal lifecycle + UI integration (node-pty server-side terminal manager, workbench terminal profiles/PTY, and chat tool result terminal content support).
Show a summary per file
File Description
src/vs/workbench/test/browser/workbenchTestServices.ts Updates terminal profile service test stub for new internal profile registration API.
src/vs/workbench/contrib/terminal/test/browser/agentHostPty.test.ts Adds unit tests for the new Agent Host-backed PTY implementation.
src/vs/workbench/contrib/terminal/common/terminal.ts Extends ITerminalProfileService with registerInternalContributedProfile.
src/vs/workbench/contrib/terminal/browser/terminalProfileService.ts Implements internal in-memory contributed terminal profiles and merges them into available profiles.
src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts Registers the new AgentHostTerminalContribution workbench contribution.
src/vs/workbench/contrib/terminal/browser/agentHostTerminalContribution.ts Adds terminal profile providers for connected agent hosts, including quick-pick selection behavior.
src/vs/workbench/contrib/terminal/browser/agentHostPty.ts Implements ITerminalChildProcess backed by an AHP terminal subscription + action dispatch.
src/vs/workbench/contrib/chat/test/browser/agentSessions/stateToProgressAdapter.test.ts Updates tests to validate terminal tool behavior via terminal content blocks.
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts Updates agent host chat tests to use subscription APIs and updated tool-specific data behavior.
src/vs/workbench/contrib/chat/common/constants.ts Adds ChatConfiguration.AgentsAppEnabled.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers chat.agentsApp.enabled setting and binds it to AgentsAppEnabled policy + token gating.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter.ts Switches terminal detection to terminal content blocks and adjusts tool-specific data mapping.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/loggingAgentConnection.ts Updates logging wrapper to the new subscription + terminal lifecycle APIs and dispatch.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Migrates from SessionClientState to refcounted session subscriptions and IAgentConnection.dispatch.
src/vs/sessions/sessions.common.main.ts Wires the new policy-blocked contribution into the sessions window.
src/vs/sessions/contrib/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts Updates mock connection types for new action dispatch signatures.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts Switches session update dispatching to IAgentConnection.dispatch.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostCustomizationHarness.ts Updates customization provider wiring to listen via connection action events instead of SessionClientState.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHost.contribution.ts Migrates remote agent host contribution to root-state subscription API and updated logging connection setup.
src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.ts Adds new full-window overlay component shown when Agents app is disabled.
src/vs/sessions/contrib/policyBlocked/browser/policyBlocked.contribution.ts Adds workbench contribution that shows/hides the blocked overlay based on configuration changes.
src/vs/sessions/contrib/policyBlocked/browser/media/sessionsPolicyBlocked.css Styles the blocked overlay and hides titlebar actions while blocked.
src/vs/sessions/contrib/localAgentHost/test/browser/localAgentHostSessionsProvider.test.ts Updates mock host to accept new dispatch signature.
src/vs/sessions/contrib/localAgentHost/browser/localAgentHostSessionsProvider.ts Switches local session update dispatching to dispatch.
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts Renames state manager usage and stubs new terminal lifecycle APIs.
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts Updates tests for renamed state manager class.
src/vs/platform/agentHost/test/node/agentHostStateManager.test.ts Renames and updates tests for the new AgentHostStateManager.
src/vs/platform/agentHost/test/common/agentSubscription.test.ts Adds comprehensive tests for subscription types and the subscription manager.
src/vs/platform/agentHost/protocol.md Updates documentation to reference AgentHostStateManager.
src/vs/platform/agentHost/node/protocolServerHandler.ts Routes terminal lifecycle commands to the agent service and scopes terminal actions to terminal subscriptions.
src/vs/platform/agentHost/node/agentSideEffects.ts Updates state manager type references to AgentHostStateManager.
src/vs/platform/agentHost/node/agentService.ts Introduces terminal lifecycle endpoints and integrates a terminal manager; updates dispatch handling for terminal actions.
src/vs/platform/agentHost/node/agentHostTerminalManager.ts Adds node-pty-backed terminal process management and action-to-PTY wiring.
src/vs/platform/agentHost/node/agentHostStateManager.ts Renames and broadens client action dispatch to include terminal actions; continues to emit envelopes with server sequence.
src/vs/platform/agentHost/node/agentHostServerMain.ts Updates comments to reflect renamed state manager.
src/vs/platform/agentHost/node/agentHostMain.ts Updates comments to reflect renamed state manager.
src/vs/platform/agentHost/electron-browser/remoteAgentHostProtocolClient.ts Adds subscription manager integration, root subscription at initialize, and unified dispatch API.
src/vs/platform/agentHost/electron-browser/agentHostService.ts Adds subscription manager integration for IPC agent host client and root state subscription on connect.
src/vs/platform/agentHost/common/state/sessionState.ts Introduces StateComponents enum and ComponentToState mapping for typed subscriptions.
src/vs/platform/agentHost/common/state/sessionClientState.ts Removes the legacy SessionClientState implementation in favor of subscriptions.
src/vs/platform/agentHost/common/state/sessionActions.ts Adds ITerminalAction unions and isTerminalAction helper.
src/vs/platform/agentHost/common/state/protocol/version/registry.ts Registers the introduction version for session/diffsChanged.
src/vs/platform/agentHost/common/state/protocol/state.ts Adds ToolResultContentType.Subagent and the corresponding tool result content type.
src/vs/platform/agentHost/common/state/protocol/reducers.ts Adds reducer support for session/diffsChanged.
src/vs/platform/agentHost/common/state/protocol/actions.ts Adds session/diffsChanged action type and interface.
src/vs/platform/agentHost/common/state/protocol/action-origin.generated.ts Regenerates action unions for the new diffs action and terminal unions.
src/vs/platform/agentHost/common/state/protocol/.ahp-version Bumps the synced agent-host protocol version hash.
src/vs/platform/agentHost/common/state/agentSubscription.ts Adds subscription primitives and refcounted AgentSubscriptionManager for root/session/terminal state.
src/vs/platform/agentHost/common/agentService.ts Updates IAgentService and redefines IAgentConnection to the new subscription/dispatch surface; adds terminal lifecycle APIs.
build/lib/i18n.resources.json Adds sessions policyBlocked contribution folder to i18n resources.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.ts:27

  • This overlay is intended to be an impassable full-window block, but it uses role="alert" without aria-modal or focus management. Screen readers may continue to expose underlying UI, and focus can remain behind the overlay. Aligning semantics with the existing sessions walkthrough overlay (dialog + aria-modal + focus trapping) would make the “blocked” state reliably modal.
		this.overlay = append(container, $('.sessions-policy-blocked-overlay'));
		this.overlay.setAttribute('role', 'alert');
		this.overlay.setAttribute('aria-label', localize('policyBlocked.aria', "Agents app disabled by organization policy"));
		this._register(toDisposable(() => this.overlay.remove()));
  • Files reviewed: 7/7 changed files
  • Comments generated: 2

Comment thread src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/chat.contribution.ts Outdated
@github-actions

This comment was marked as off-topic.

@joshspicer joshspicer force-pushed the copilot/inquisitive-rat branch from 44fda32 to 0ec1fe0 Compare April 9, 2026 19:55
…ity propagation

- Register chat.agentsApp.enabled configuration with policy support
- Add agents_app_enabled to IPolicyData for account-level policy
- Save parent VS Code policy identity (win32RegValueName/darwinBundleIdentifier)
  in bootstrap-meta before product.sub.json merge so the agents sub-app reads
  policies from the parent VS Code's registry/plist domain
- Use parentPolicyConfig in main.ts when creating NativePolicyService
- Improve policy-blocked overlay: agents icon, button width fix, keyboard fix,
  hardcoded 'Agents' name, Open VS Code scheme fix
…sAppEnabled

Piggyback on chat.agent.enabled (ChatAgentMode) policy to show the
policy-blocked splash screen in the agents app, rather than introducing
a separate AgentsAppEnabled policy.
@joshspicer joshspicer marked this pull request as ready for review April 9, 2026 23:35
@vs-code-engineering
Copy link
Copy Markdown
Contributor

vs-code-engineering bot commented Apr 9, 2026

📬 CODENOTIFY

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

@bpasero

Matched files:

  • src/bootstrap-meta.ts
  • src/vs/code/electron-main/main.ts

@deepak1556

Matched files:

  • src/vs/code/electron-main/main.ts

@joshspicer joshspicer marked this pull request as draft April 9, 2026 23:35
…y text

- Replace codicon with sessions logo SVG (theme-aware light/dark)
- Save parent urlProtocol in parentPolicyConfig for correct Open VS Code link
- Update overlay title to 'Agents Disabled by Policy'
- Update description to 'Your organization has disabled Agents via policy.'
@joshspicer joshspicer changed the title Add group policy to enable/disable the Agents app Fix Agents app group policy Apr 9, 2026
@joshspicer joshspicer marked this pull request as ready for review April 9, 2026 23:58
@joshspicer joshspicer merged commit b38be3c into main Apr 10, 2026
26 checks passed
@joshspicer joshspicer deleted the copilot/inquisitive-rat branch April 10, 2026 00:24
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 10, 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