10

When using GitHub Copilot in VS Code through the Chat tab, it frequently suggests running terminal commands and asks for iteration permissions. Each time it wants to execute a command or continue working on a problem, there are confirmation dialogs requiring manual approval.

Example:

  1. Terminal command execution: Dialog shown when Copilot suggests running node server.js:

enter image description here

  1. Iteration continuation: Dialog shown after Copilot works on a problem for a while:

enter image description here

Expected behavior

GitHub Copilot should:

  1. Automatically execute suggested terminal commands without requiring manual approval
  2. Automatically continue iterations when working on complex problems


Safety note: I recognize these prompts are intentional security safeguards. I’m specifically asking whether there’s a supported way to disable or auto-approve them, being aware of the risks.

6
  • 5
    That’s there for your own safety. Commented Jul 30 at 21:59
  • 4
    What if it hallucinates and formats your partition Commented Jul 30 at 22:20
  • 3
    Once you give the option to run arbitrary commands in a trusted environment without your approval or revision, it would no longer be a trusted environment. Commented Jul 30 at 22:28
  • 2
    I think there are a lot of cases where the AI hallucinates and makes us run commands which might not be required, it is better to have the final authority in some cases. Commented Jul 31 at 13:05
  • 5
    The debate over whether user safety is more important than user freedom is not the focus of this question. The aim is to achieve a specific behavior/functionality; all other considerations are irrelevant. I have already revised the question to clarify this issue. Any further input that is not related to achieving the desired outcome will be flagged. Commented Jul 31 at 13:17

3 Answers 3

17

You can search chat.tools.autoApprove, or use my JSON snippet.

settings.json

    "chat.agent.maxRequests": 300,
    "chat.tools.terminal.enableAutoApprove": true,
    "chat.tools.terminal.autoApprove": {
        "rm": false,
        "rmdir": false,
        "del": false,
        "kill": false,
        "curl": false,
        "wget": false,
        "eval": false,
        "chmod": false,
        "chown": false,
        "/^Remove-Item\\b/i": false
    },

Note: that chat.agent.maxRequests to maximum will help you keep the chat running.

Sign up to request clarification or add additional context in comments.

1 Comment

tried using chat.tools.terminal.autoApprove but did not work, should it be chat.tools.global.autoApprove?
15

VS Code version 1.104 introduced "Global auto approve":


To enable it:

Ctrl+Shift+P -or- +shift+P

>Preferences: Open User Settings (JSON)

Add the following key to your JSON file:

"chat.tools.global.autoApprove": true

Alternatively:

Ctrl+Shift+P -or- +shift+P

>Preferences: Open User Settings

Search for YOLO and enable it:

Image showing the YOLO mode in the user configs

1 Comment

Hahaha "never recommended", "critical security" - clicks check box
3

The first one can be fixed by adding this to your settings:

"chat.tools.autoApprove": true

The second option deals with the number of requests the agent performs before continuing. The default is 25. If you change it to a higher number, it will continue for a longer period of time.

"chat.agent.maxRequests": 250

See reference below:

https://code.visualstudio.com/docs/copilot/chat/chat-agent-mode

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.