Skip to content

Bug: AUTO_EDIT mode still sends changes to IDE #2673

@huww98

Description

@huww98

Bug: AUTO_EDIT mode still sends changes to IDE

What happened?

When using AUTO_EDIT mode (auto-accept edits) with IDE companion enabled, the edit and write_file tools still send changes to the IDE (via ideClient.openDiff()), causing VS Code diff views to open unnecessarily — even though the changes should be auto-approved without any IDE interaction.

This is a regression introduced by PR #2283 (permission system refactor). The previous fix in PR #2221 that prevented openDiff from being called in AUTO_EDIT/YOLO mode was inadvertently broken during the refactor.

What did you expect to happen?

In AUTO_EDIT or YOLO mode:

  1. edit and write_file tools should NOT call ideClient.openDiff()
  2. Changes should be applied directly without opening any diff view in VS Code
  3. The IDE should not receive any diff requests for auto-approved operations

Client information

Client Information

Run qwen to enter the interactive CLI, then run the /about command.

$ qwen /about
  > /about

  ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
  │                                                                                                  │
  │ 状态                                                                                             │
  │                                                                                                  │
  │ Qwen Code                         0.13.0 (aebe889b3)                                             │
  │ 运行环境                          Node.js v25.8.1 / npm 11.11.0                                  │
  │ IDE 客户端                        IDE                                                            │
  │ 操作系统                          darwin arm64 (25.4.0)                                          │
  │                                                                                                  │
  │ 认证                              API Key - openai                                               │
  │ 基础 URL                          https://dashscope.alibaba-inc.com/compatible-mode/v1           │
  │ 模型                              aliyun-glm-5                                                   │
  │ 会话 ID                           0df72d1c-a3d0-4b3e-88b6-6744e8914199                           │
  │ 沙箱                              no sandbox                                                     │
  │ 代理                              no proxy                                                       │
  │ 内存使用                          293.2 MB                                                       │
  │                                                                                                  │
  ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Login information

N/A - affects all authentication methods

Anything else we need to know?

Root Cause Analysis

The permission system refactor (PR #2283) renamed shouldConfirmExecute to getConfirmationDetails and moved the AUTO_EDIT/YOLO check from the tool layer to the scheduler layer. However, the scheduler's check happens after getConfirmationDetails is called, but openDiff is invoked inside getConfirmationDetails.

Before PR #2283 (PR #2221 fix was working):

// edit.ts - shouldConfirmExecute()
async shouldConfirmExecute() {
  if (mode === ApprovalMode.AUTO_EDIT || mode === ApprovalMode.YOLO) {
    return false;  // ✅ Early return, openDiff never called
  }
  // ... openDiff called here ...
}

After PR #2283 (broken):

// coreToolScheduler.ts
const confirmationDetails = await invocation.getConfirmationDetails(signal);  // ❌ openDiff called here!
// ... then check AUTO_EDIT (too late) ...
if (approvalMode === ApprovalMode.AUTO_EDIT && confirmationDetails.type === 'edit') {
  // auto-approve
}

Affected Files

  • packages/core/src/tools/edit.ts
  • packages/core/src/tools/write-file.ts

Related PRs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions