Skip to content

Harden macOS system-proxy service resolution to prevent apiInvoke toggle failures#617

Open
Copilot wants to merge 8 commits intomasterfrom
copilot/fix-system-proxy-error-macos
Open

Harden macOS system-proxy service resolution to prevent apiInvoke toggle failures#617
Copilot wants to merge 8 commits intomasterfrom
copilot/fix-system-proxy-error-macos

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 25, 2026

  • 分析根因:packages/core/package.json 中新增了 request 直接依赖,但 pnpm-lock.yaml 的 importer 节点未同步,导致 CI 的 frozen-lockfile 检查失败
  • 运行 pnpm install --no-frozen-lockfile 更新 pnpm-lock.yaml
  • shell.js:保留 error.code 到 thrown Error,方便上层检测 exit code 14
  • set-system-proxy/index.js:引入 @vscode/sudo-prompt,添加 sudoExecMac 辅助函数,macOS 遇到 exit code 14 时弹出系统授权对话框

Copilot AI linked an issue Apr 25, 2026 that may be closed by this pull request
1 task
Copilot AI changed the title [WIP] Fix system proxy opening issue on macOS Harden macOS system-proxy service resolution to prevent apiInvoke toggle failures Apr 25, 2026
Copilot AI requested a review from cute-omega April 25, 2026 17:56
…p error isolation and logging

Agent-Logs-Url: https://github.com/docmirror/dev-sidecar/sessions/d06b0b68-a98e-430f-91bd-1ba32435448a

Co-authored-by: cute-omega <92797441+cute-omega@users.noreply.github.com>
…sudo on macOS

Agent-Logs-Url: https://github.com/docmirror/dev-sidecar/sessions/1cd7eaff-f2c3-4a0d-bab0-116d3a963e90

Co-authored-by: cute-omega <92797441+cute-omega@users.noreply.github.com>
@cute-omega cute-omega marked this pull request as ready for review April 30, 2026 06:05
Copilot AI review requested due to automatic review settings April 30, 2026 06:05
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 aims to make macOS system-proxy toggling more reliable by improving how the active network service is resolved and by retrying networksetup with an admin prompt when permission errors occur, while also fixing CI frozen-lockfile failures caused by lockfile drift.

Changes:

  • Sync packages/core/package.json and pnpm-lock.yaml by adding request as a direct dependency and updating the lockfile.
  • Enhance shell exec error propagation by preserving error.code on the thrown error for upstream exit-code handling.
  • Refactor macOS proxy setup to robustly detect the active network service and, on exit code 14, retry via @vscode/sudo-prompt; add unit tests for the mac parsing helpers.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Updates lockfile importers/snapshots to match dependency graph after install.
packages/core/package.json Adds missing direct dependency (request) to match runtime usage and lockfile.
packages/core/src/shell/shell.js Preserves exit code by attaching err.code when child_process.exec fails.
packages/core/src/shell/scripts/set-system-proxy/index.js Adds macOS network service resolution helpers and sudo retry flow for permission errors.
packages/core/test/setSystemProxyMacTest.js Adds mocha tests for macOS parsing/picking helper functions.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

pnpm-lock.yaml:1929

  • The lockfile indicates @xmldom/xmldom@0.8.12 is deprecated due to “critical issues”. Since this PR updates the lockfile, it would be good to address this by bumping the dependency chain (or adding a pnpm override/resolution) so installs don’t continue pulling a known-problematic version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/shell/scripts/set-system-proxy/index.js
"lodash": "^4.18.1",
"log4js": "^6.9.1",
"node-powershell": "^4.0.0",
"request": "^2.88.2",
Agent-Logs-Url: https://github.com/docmirror/dev-sidecar/sessions/ef3b9305-d635-41a4-b7de-7d0e186f780d

Co-authored-by: cute-omega <92797441+cute-omega@users.noreply.github.com>
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.

macOS 下无法打开系统代理

3 participants