Skip to content

Commit d25f7bb

Browse files
committed
refactor: remove fragile proxy detection in favor of documentation
- Remove automatic proxy detection logic from extension startup - Remove proxy-detection.ts utility file - Simplify error messages to suggest enabling http.electronFetch when connection issues occur - Update documentation to focus on the solution rather than detection As suggested by @bstrdsmkr, the proxy detection approach was fragile. VSCode extensions cannot directly use Electron fetch - they can only suggest users enable the http.electronFetch setting which tells VSCode itself to use Electron fetch internally.
1 parent 4ac1b92 commit d25f7bb

File tree

4 files changed

+13
-152
lines changed

4 files changed

+13
-152
lines changed

docs/PROXY_CONFIGURATION.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ VSCode has two different implementations for making HTTP requests:
5858

5959
When `http.electronFetch` is `false` (default), extensions using the native fetch API may fail to route requests through your proxy correctly.
6060

61-
## Automatic Detection
62-
63-
Roo Code now automatically detects this configuration issue and will:
64-
65-
1. Show a warning notification when proxy settings are detected but `http.electronFetch` is disabled
66-
2. Provide helpful error messages when connection errors occur
67-
3. Suggest the appropriate fix based on your configuration
68-
6961
## Supported Proxy Types
7062

7163
With `http.electronFetch` enabled, the following proxy configurations are supported:

src/api/providers/utils/proxy-detection.ts

Lines changed: 0 additions & 138 deletions
This file was deleted.

src/core/task/Task.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import delay from "delay"
99
import pWaitFor from "p-wait-for"
1010
import { serializeError } from "serialize-error"
1111

12-
import { detectProxyConfigurationIssue, formatProxyErrorMessage } from "../../api/providers/utils/proxy-detection"
1312
import {
1413
type TaskLike,
1514
type TaskEvents,
@@ -2222,7 +2221,19 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
22222221

22232222
return
22242223
} else {
2225-
const { response } = await this.ask("api_req_failed", formatProxyErrorMessage(error))
2224+
let errorMsg = error.message || "API request failed"
2225+
2226+
// Add helpful message about proxy configuration if relevant
2227+
if (
2228+
errorMsg.includes("ECONNREFUSED") ||
2229+
errorMsg.includes("ETIMEDOUT") ||
2230+
errorMsg.includes("ENOTFOUND")
2231+
) {
2232+
errorMsg +=
2233+
"\n\nIf you're behind a proxy, try enabling the 'http.electronFetch' setting in VSCode:\n1. Open Settings (Cmd/Ctrl + ,)\n2. Search for 'http.electronFetch'\n3. Enable the setting\n4. Restart VSCode"
2234+
}
2235+
2236+
const { response } = await this.ask("api_req_failed", errorMsg)
22262237

22272238
if (response !== "yesButtonClicked") {
22282239
// This will never happen since if noButtonClicked, we will

src/extension.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { ContextProxy } from "./core/config/ContextProxy"
2424
import { ClineProvider } from "./core/webview/ClineProvider"
2525
import { DIFF_VIEW_URI_SCHEME } from "./integrations/editor/DiffViewProvider"
2626
import { TerminalRegistry } from "./integrations/terminal/TerminalRegistry"
27-
import { showProxyConfigurationWarning } from "./api/providers/utils/proxy-detection"
2827
import { McpServerManager } from "./services/mcp/McpServerManager"
2928
import { CodeIndexManager } from "./services/code-index/manager"
3029
import { MdmService } from "./services/mdm/MdmService"
@@ -82,9 +81,6 @@ export async function activate(context: vscode.ExtensionContext) {
8281
// Initialize i18n for internationalization support.
8382
initializeI18n(context.globalState.get("language") ?? formatLanguage(vscode.env.language))
8483

85-
// Check for proxy configuration issues and show warning if needed
86-
await showProxyConfigurationWarning()
87-
8884
// Initialize terminal shell execution handlers.
8985
TerminalRegistry.initialize()
9086

0 commit comments

Comments
 (0)