You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix proxy support in VS Code IDE companion by reading VS Code proxy settings and passing them to the CLI via --proxy argument. This resolves connection issues when users are behind a corporate proxy.
Dive Deeper
Users behind corporate proxies were unable to use the VS Code extension because the proxy settings from VS Code were not being passed to the Qwen CLI process. This fix:
Reads the http.proxy setting from VS Code configuration
Falls back to https.proxy if http.proxy is not set
Passes the proxy URL to the CLI via --proxy argument when a proxy is configured
Includes comprehensive unit tests covering:
Proxy passed when http.proxy is set
Proxy passed when only https.proxy is set (fallback)
Preference for http.proxy over https.proxy
No proxy argument when no proxy is configured
No proxy argument when proxy is empty string
Reviewer Test Plan
Pull this branch and build the VS Code extension
Configure a proxy in VS Code settings (http.proxy)
Start the extension and verify the CLI receives the proxy argument (check console logs)
Run tests: npm run test in packages/vscode-ide-companion
This PR addresses a critical connectivity issue for users behind corporate proxies by reading VS Code's proxy configuration and passing it to the CLI via the --proxy argument. The implementation is clean, well-tested, and follows existing code patterns. The test coverage is comprehensive and covers all edge cases.
🔍 General Feedback
Positive aspects:
Clear problem statement and solution in the PR description
Comprehensive test coverage with 5 test cases covering all scenarios
Minimal code change that follows the existing architecture
Good use of logging for debugging proxy configuration
Proper fallback from http.proxy to https.proxy
Code quality:
Follows existing TypeScript patterns in the codebase
Maintains consistency with the existing code style
Test file follows the established vitest mocking patterns
🎯 Specific Feedback
🔵 Low
File: qwenConnectionHandler.ts:78-85 - Consider extracting the proxy configuration logic into a separate private method for better testability and separation of concerns. This would make the connect method more focused and allow easier mocking in tests if needed.
File: qwenConnectionHandler.ts:82 - The condition if (proxyUrl) will pass through even if proxyUrl is an empty string (falsy check). While the test covers this case, consider being more explicit:
if(proxyUrl&&proxyUrl.trim()!=='')
This ensures whitespace-only strings are also treated as no proxy configured.
File: qwenConnectionHandler.test.ts:44-56 - Consider adding a test case for when proxy URL is whitespace-only string to verify the behavior matches expectations.
File: qwenConnectionHandler.ts:81 - The typing httpConfig.get<string>('proxy') could potentially return undefined which is handled by the || operator, but TypeScript might infer this better with explicit typing:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Fix proxy support in VS Code IDE companion by reading VS Code proxy settings and passing them to the CLI via
--proxyargument. This resolves connection issues when users are behind a corporate proxy.Dive Deeper
Users behind corporate proxies were unable to use the VS Code extension because the proxy settings from VS Code were not being passed to the Qwen CLI process. This fix:
http.proxysetting from VS Code configurationhttps.proxyifhttp.proxyis not set--proxyargument when a proxy is configuredhttp.proxyis sethttps.proxyis set (fallback)http.proxyoverhttps.proxyReviewer Test Plan
http.proxy)npm run testinpackages/vscode-ide-companionTesting Matrix
Linked issues / bugs
Resolves #2492