Skip to content

A Brief Discussion on Copilot CLI's Autopilot and YOLO Mode Mechanisms and Quota Pitfalls

TLDR

  • YOLO mode automatically approves all high-risk actions (read/write, delete, terminal execution); please use it with caution.
  • Autopilot mode automatically replies to confirmation requests on behalf of the user. If the task completion logic fails, it may lead to an infinite loop and consume a large amount of quota.
  • When running Autopilot, it is recommended to use the --max-autopilot-continues parameter to limit the number of autonomous executions and prevent accidental quota exhaustion.
  • If you only need to ask questions rather than execute tasks, it is recommended to use Standard mode to avoid unnecessary quota deductions caused by Autopilot.
  • The --max-autopilot-continues mechanism in Copilot CLI differs from chat.agent.maxRequests in VS Code; the former deducts quota for every autonomous continuation.

Explanation of Automated Execution Features

When an AI Agent performs a task, it pauses by default when it encounters an action that requires confirmation. To automate the process, you must configure specific modes.

WARNING

Automated execution carries risks. Before running, ensure your code is under version control and carefully evaluate if there are external integrations or database connections.

YOLO Mode

When will you encounter this issue: When the user wants the AI to execute all commands automatically and does not want to manually click confirmation windows every time rm -rf is executed or a file is written.

  • How to enable:
    • Startup parameter: gh copilot --allow-all or --yolo.
    • Interactive interface command: /yolo or /allow-all.
  • Mechanism: Once enabled, the system will automatically approve all high-risk actions without popping up confirmation windows.

Differences in Execution Modes

When will you encounter this issue: When the user needs to switch between "manual control" and "autonomous execution" based on task complexity.

You can switch between three modes using Shift + Tab:

  • Standard: The default mode, where the user provides instructions step-by-step, and the pace is controlled by the user.
  • Plan: The AI confirms the requirements and creates an implementation plan first, executing it only after confirmation; suitable for complex tasks.
  • Autopilot: The AI enters an autonomous loop, without waiting for input at each step, until the task is completed or a limit is reached.

Comparison between Autopilot and VS Code Agent Settings

Feature--max-autopilot-continueschat.agent.maxRequests
ToolCopilot CLIVS Code
Limit TargetNumber of autonomous continuations in AutopilotNumber of AI model call turns for the Agent
Billing TimingEach autonomous continuation step deducts a premium requestOnly user-initiated prompts are billed
After reaching the limitExecution stops immediatelyAsks whether to continue

Autopilot Quota Pitfalls

When will you encounter this issue: When the model cannot correctly determine that a task is completed, or when Autopilot is accidentally enabled during a Q&A session, causing the AI to enter an "auto-confirmation" infinite loop.

Cause Analysis and Incident Records

The mechanism of Autopilot is that when confirmation is required, it automatically replies on behalf of the user if the user does not respond. If the model proactively asks whether to perform subsequent actions after a task is completed, Autopilot will directly trigger the next step, causing the quota to be deducted repeatedly.

  • Incident Scenario: Using a low-tier model for simple Q&A; due to insufficient reasoning, the model attempts to confirm from different angles after replying, causing Continuing autonomously to be triggered repeatedly.
  • Risk Assessment: If using high-billing models like Claude Opus, and Autopilot cannot terminate normally, it will cause significant quota loss.

Related reference information:

  1. Limit the maximum: Always use the --max-autopilot-continues parameter to prevent infinite loops.
  2. Differentiate usage: Only enable Autopilot when complex tasks need to be executed; if it is just for Q&A, please keep it in Standard mode.
  3. Careful evaluation: When the quota is sufficient, you may consider enabling YOLO + Autopilot for autonomous optimization, but in most scenarios, enabling only YOLO is sufficient.

Changelog

    • Initial version of the document created.