[1.138] Show effective sandbox policy in Copilot agent sessions - #335920
Open
Dileep Yavanmandha (dileepyavan) wants to merge 1 commit into
Open
[1.138] Show effective sandbox policy in Copilot agent sessions#335920Dileep Yavanmandha (dileepyavan) wants to merge 1 commit into
Dileep Yavanmandha (dileepyavan) wants to merge 1 commit into
Conversation
(cherry picked from commit adc9092)
Copilot started reviewing on behalf of
Dileep Yavanmandha (dileepyavan)
September 12, 2026 01:13
View session
Dileep Yavanmandha (dileepyavan)
enabled auto-merge (squash)
September 12, 2026 01:20
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Output hooks can bypass cache invalidation or lose valid output, and the accessibility guidance omits Space activation.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 2
Open findings (3)
What changed in this PR
Backports sandbox-policy reporting for Copilot Agent Host sessions, exposing the effective policy as a persistent Markdown preview.
Changes:
- Adds
/sandbox-policyinvocation, formatting, persistence, and completion. - Adds preview-aware link rendering, URI rewriting, keyboard support, and styling.
- Adds unit and visual fixture coverage.
| File | Description |
|---|---|
chatWidget.fixture.ts |
Adds sandbox-policy visual fixture. |
chatMarkdownContentPart.test.ts |
Tests preview rendering and activation. |
chatInlineAnchorWidget.test.ts |
Tests metadata filtering and opening. |
stateToProgressAdapter.test.ts |
Tests URI metadata preservation. |
chatAccessibilityHelp.test.ts |
Tests new help guidance. |
chatInlineAnchorWidget.css |
Styles preview links. |
chatMarkdownDecorationsRenderer.ts |
Renders preview anchors in one scan. |
chatInlineAnchorWidget.ts |
Adds preview-aware widgets and keyboard handling. |
stateToProgressAdapter.ts |
Preserves preview metadata during URI rewriting. |
chatAccessibilityHelp.ts |
Documents sandbox-policy interaction. |
copilotSlashCommandCompletionProvider.test.ts |
Tests command discovery and collisions. |
copilotSlashCommand.test.ts |
Tests command hooks and output rendering. |
copilotAgentSession.test.ts |
Tests policy formatting, persistence, and failures. |
copilotSlashCommandProvider.ts |
Adds the host command and handlers. |
copilotSlashCommandCompletionProvider.ts |
Reuses shared SDK command types. |
copilotSlashCommand.ts |
Defines invocation and output hooks. |
copilotSandboxPolicyDisplay.ts |
Builds and persists policy reports. |
copilotAgentSession.ts |
Integrates custom command invocation and output. |
copilotAgent.ts |
Updates provider construction. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| this._logService.error(err, `[Copilot:${this.sessionId}] rpc.commands.invoke(${slashCommand.command}) failed`); | ||
| throw err; | ||
| } | ||
| const output = await runtimeSlashCommand.getOutput?.(slashCommand.rest, result); |
| throw err; | ||
| } | ||
| const output = await runtimeSlashCommand.getOutput?.(slashCommand.rest, result); | ||
| const renderedOutput = output ? renderCopilotSlashCommandOutput(output) : undefined; |
| content.push(localize('workbench.action.openAgentsWindow', 'To open the Agents Window, invoke the Open Agents Window command{0}. In screen reader mode, this keybinding includes Alt to avoid conflicts with screen reader shortcuts.', '<keybinding:workbench.action.openAgentsWindow>')); | ||
| content.push(localize('workbench.action.chat.openAgentHostFolderPicker', 'When starting an agent session in a multi-root workspace, you can choose which root folder it runs in by invoking the Folder command{0}, then selecting a folder from the list.', '<keybinding:workbench.action.chat.openAgentHostFolderPicker>')); | ||
| content.push(localize('chat.agentHostApprovalsPicker', 'When an agent session exposes approval presets, use Tab to reach the Approvals picker and choose how it handles workspace access, commands, and the internet.')); | ||
| content.push(localize('chat.agentHostSandboxPolicy', "In Copilot agent-host sessions, use /sandbox-policy to view the effective sandbox policy. In the response, use Tab to focus Open Sandbox Policy and Enter to open the formatted report.")); |
Contributor
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.


Summary
fixes #330986
20260912-0056-47.9836396.mp4
Backport #335918 to
release/1.138by cherry-picking commitadc9092582503ef136344e5d017aa68b3c10c944with provenance (git cherry-pick -x).Backport commit:
fe1417b0daa. The cherry-pick applied without conflicts or release-specific code changes. The original PR againstmainremains unchanged.Changes
/sandbox-policycompletion for Copilot agent-host sessions, mapping it to the SDK's existing/sandbox policycommand without starting a model turn or changing sandbox enforcement.Compatibility
Existing commands retain their default invocation, rendering, and lifecycle when no custom handler applies. No SDK dependency updates, additional permissions, or sandbox enforcement changes are included.
Release-branch validation
git diff origin/release/1.138...HEAD --checkpassed.release/1.138.The original change additionally passed ESLint, CSS lint, and dark/light visual checks. Coverage includes a 1,001-link response with one anchor scan, optional-hook fallbacks, report snapshots and failures, local/remote links, and keyboard activation.