Skip to content

Show automatic unsandbox retries in the chat terminal UI#308655

Merged
dileepyavan merged 11 commits intomicrosoft:mainfrom
dileepyavan:DileepY/readOnly
Apr 12, 2026
Merged

Show automatic unsandbox retries in the chat terminal UI#308655
dileepyavan merged 11 commits intomicrosoft:mainfrom
dileepyavan:DileepY/readOnly

Conversation

@dileepyavan
Copy link
Copy Markdown
Member

Summary

  • add automatic retry detection for sandbox-blocked foreground terminal executions
  • show the unsandboxed retry as a terminal tool invocation in chat after the user clicks Allow Once
  • refactor command rewriting into a reusable helper and add retry coverage tests

Details

When a sandboxed runInTerminal execution fails with output that looks blocked by the sandbox, the tool now:

  • prompts the user with the existing Allow Once flow
  • if accepted, emits a new terminal invocation part in chat for the unsandboxed retry
  • runs the retry outside the sandbox and updates that chat terminal part when the retry completes
  • prepends a note to the final tool result explaining that the command was retried outside the sandbox

This keeps the retry visible in chat in the same style as normal terminal tool executions instead of only switching execution behavior behind the scenes.

Testing

  • node ./node_modules/eslint/bin/eslint.js src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
  • ./scripts/test.sh --run src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts

Fixes #308506

Copilot AI review requested due to automatic review settings April 9, 2026 01:49
@dileepyavan dileepyavan enabled auto-merge (squash) April 9, 2026 01:49
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 adds client-side detection of “sandbox blocked” failures for runInTerminal and, after user consent, surfaces the unsandboxed retry as a separate terminal tool invocation in chat so the retry is visible in the transcript.

Changes:

  • Detect sandbox-blocked failures from command output and offer an Allow Once unsandboxed retry without a model roundtrip.
  • Emit an additional chat tool invocation part representing the unsandboxed retry, and prepend a note to the final tool result.
  • Refactor command rewriting into a reusable helper and add predicate-level retry detection tests.
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts Adds auto unsandbox retry detection/confirmation + external tool invocation update emission; refactors command rewriting.
src/vs/workbench/contrib/terminalContrib/chatAgentTools/test/electron-browser/runInTerminalTool.test.ts Adds unit tests for shouldAutomaticallyRetryUnsandboxed.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

dileepyavan and others added 4 commits April 8, 2026 22:52
benvillalobos
benvillalobos previously approved these changes Apr 10, 2026
# Conflicts:
#	src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts
@dileepyavan dileepyavan merged commit d37d08c into microsoft:main Apr 12, 2026
25 of 26 checks passed
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 12, 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.

Failed sandbox commands that try to write to read-only mapped files should retry automatically if the reason is clearly the sandbox

4 participants