Merged
Conversation
969ac9a to
9fd208b
Compare
Contributor
There was a problem hiding this comment.
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 withAgentsAppEnabledpolicy 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 newIAgentConnectionsurface (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
This comment was marked as off-topic.
This comment was marked as off-topic.
…, and product names
44fda32 to
0ec1fe0
Compare
…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.
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
@deepak1556Matched files:
|
…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.'
bryanchen-d
approved these changes
Apr 10, 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.
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.