Fix GitHub Copilot Not Working With Clash: Timeout Solutions
Understand Which Connection GitHub Copilot Is Using
When GitHub Copilot stops authenticating, shows a timeout, or keeps loading without returning a suggestion, the problem is not always the selected Clash node. Copilot usually involves several separate connections: the editor extension may contact GitHub for account authentication, request extension metadata, reach Copilot API endpoints, and maintain a longer-lived connection for suggestions or status updates. These requests may be made by Visual Studio Code, an extension host process, or another IDE process rather than by the browser that you normally use to test the internet.
A browser page loading successfully therefore proves only that the browser’s current network path works. It does not prove that Visual Studio Code or another editor is using the same proxy, DNS resolver, or Clash process. The editor may read the operating system proxy, use its own proxy setting, inherit environment variables, or bypass the system proxy entirely. If another VPN, proxy extension, security product, or remote development session is active, the request may not enter Clash at all.
Start by reproducing the error while watching Clash’s connection list. Open the editor, trigger a Copilot sign-in or suggestion request, and look for new connections at the same time. Record the destination domain, connection status, matched rule, selected proxy group, and whether the request is repeatedly retried. If no related connection appears, focus on the editor’s proxy path rather than changing rules inside Clash. If the connections appear but repeatedly fail through one group, continue with node, DNS, and protocol checks.
Also distinguish between an authentication failure and an API timeout. A browser-based login page may open while the extension cannot exchange its token with the required service. Conversely, sign-in may complete successfully while suggestions fail because the API request is routed through a different rule or a node that cannot maintain the required connection. Write down the exact editor notification and check the extension’s output or developer log before making several changes at once.
Check the Editor and Clash Proxy Settings
The first configuration check is the local listener. Confirm the active HTTP, SOCKS, or mixed port in Clash Verge, Clash Verge Rev, Mihomo Party, or the client you are using. Do not assume that the port is 7890; imported configurations and client preferences may use another value. A typical configuration might contain the following fields:
mixed-port: 7890
allow-lan: false
mode: rule
log-level: info
A mixed port normally accepts both HTTP proxy requests and SOCKS5 connections, but the application still needs to know which protocol it should use. If the editor has a proxy setting that expects an HTTP proxy, enter the local address and HTTP-compatible port. If it expects a SOCKS proxy, select SOCKS5 and use the SOCKS port or a mixed port supported by the client. Do not enter the external controller port, such as 9090, as a proxy port. The controller API manages Clash and does not forward application traffic.
In Visual Studio Code, review the application’s proxy-related settings and inspect whether a setting such as http.proxy contains an old address. A stale value can override the system proxy or point to a client that is no longer running. If the setting is not needed, remove the obsolete address and restart the editor. For other IDEs, look for HTTP proxy, SOCKS proxy, or network settings under the application preferences. Remote development extensions may use the network of the remote host instead of the computer where the GUI client is open.
On Windows, also check inherited environment variables in the terminal or launcher:
set HTTP_PROXY
set HTTPS_PROXY
set ALL_PROXY
On macOS and Linux, use:
echo $HTTP_PROXY
echo $HTTPS_PROXY
echo $ALL_PROXY
These variables can send command-line tools or extension processes to an old port. They can also create confusing results when the system proxy points to Clash but HTTPS_PROXY points to a different local service. Temporarily remove or correct stale variables, fully close the editor, and launch it again. Closing only the editor window may leave the extension host process running with the previous environment.
Verify That the Local Port Is Listening
A configuration line does not guarantee that the Clash core successfully opened the port. Check the client runtime log for a startup error, port conflict, or failed configuration load. You can test the local listener with a harmless request:
curl -I -x http://127.0.0.1:7890 https://github.com
Replace 7890 with the actual port. A connection refusal normally indicates that no process is listening, the address is incorrect, or a firewall is blocking the local connection. A timeout after the local connection succeeds points further downstream to DNS, rules, the selected node, or the remote service. This distinction prevents a local port problem from being mistaken for a GitHub availability problem.
Inspect Rules and Proxy Group Selection
Once Copilot traffic is visible in Clash, inspect the matched rule rather than looking only at the global mode. In Rule mode, Clash evaluates rules from top to bottom and sends the connection to the first matching policy. A broad DIRECT rule near the beginning can bypass the proxy even when the global proxy group appears to be selected. A broad reject rule can produce an immediate failure, while an unsuitable proxy group can create repeated timeouts.
For troubleshooting, identify every domain shown in the connection log and note whether each one uses the same policy. Authentication, API calls, telemetry, and extension downloads may not use identical hostnames. The required domain set can also change as the editor or extension updates. Do not copy a domain from an unverified list and assume that it represents every current Copilot endpoint. Use the actual connection log as the primary evidence, then create the narrowest rule needed for the observed traffic.
A temporary diagnostic rule can help determine whether routing is the cause. Place a specific domain rule above broad regional, direct, or catch-all rules, then reload the configuration:
rules:
- DOMAIN-SUFFIX,github.com,Copilot
- DOMAIN-SUFFIX,githubusercontent.com,Copilot
- MATCH,DIRECT
This is only an example of rule structure, not a complete Copilot domain list. Replace the policy name with an existing proxy group in your configuration, and do not add domains that you have not observed or verified. If the group name does not exist exactly as written, the configuration may fail to load or the rule may not behave as expected. YAML names are case-sensitive in practical configuration management, and indentation must use spaces rather than tabs.
For a clean test, temporarily choose a stable proxy group manually instead of relying on URL testing or automatic selection. A group may report a low latency result while still failing to handle long HTTPS requests, authentication redirects, or persistent connections. Test one node for several minutes, trigger sign-in, and then request multiple suggestions. If one node works and another does not, the rule is probably reaching Clash correctly and the issue is more likely node quality, remote routing, or protocol compatibility.
Test DNS Resolution Without Guessing
DNS problems can look like proxy failures. If the editor resolves a hostname through a local resolver that returns an unusable address, Clash may attempt a direct connection that never completes. A conflicting DNS mode can also make the connection log show a destination that does not match the expected route. This is especially common when the operating system, browser, TUN stack, and Clash DNS module are using different resolution paths.
First compare a normal DNS lookup with a request sent through the local proxy. On Windows, use nslookup; on macOS and Linux, use dig or nslookup. The goal is not to find one “best” address but to determine whether the hostname resolves consistently and whether the result changes when Clash DNS is enabled. If a hostname resolves in the browser but fails in the editor, check whether the editor is using a different process environment or remote host.
Review the active DNS section rather than editing a downloaded subscription file that may be overwritten later. A simplified Mihomo-style example might look like this:
dns:
enable: true
enhanced-mode: fake-ip
nameserver:
- https://223.5.5.5/dns-query
- tls://1.1.1.1:853
fallback:
- https://8.8.8.8/dns-query
The exact DNS choices depend on your network, client, kernel version, and configuration source. The important checks are whether the DNS module is enabled, whether the selected enhanced mode is supported by the running kernel, and whether the relevant domains are excluded or forced to a suitable resolution path. Do not copy a DNS block blindly into a client that uses a different core or override mechanism.
After changing DNS, clear stale state in a controlled way. Reload the configuration, restart the Clash core, and restart the editor. If the client provides a DNS cache or fake-IP reset action, use it before repeating the test. Changing several DNS fields and switching TUN at the same time makes it difficult to know which change fixed or caused the result.
Compare Domain and IP Behavior
Do not replace a hostname with an IP address as a permanent solution. HTTPS certificates, virtual hosting, and service routing generally require the original hostname. An IP-based test can help distinguish DNS failure from transport failure, but it does not reproduce the complete Copilot request. If the IP connects while the hostname fails, investigate DNS and rule matching; if both fail through the same node, investigate the node or upstream route.
Use TUN Mode Only When the Application Needs It
TUN mode creates a virtual network interface and can capture traffic from applications that ignore the operating system proxy. It is useful when the editor or extension host does not honor HTTP proxy settings, but enabling it is not automatically better. TUN introduces additional variables, including administrator permissions, virtual interface routing, DNS hijacking, IPv6 behavior, and conflicts with other VPN software.
Before enabling TUN, test the explicit local proxy path. If the editor can connect when its proxy setting points directly to Clash, TUN may be unnecessary. If the editor ignores that setting and no connection appears in Clash, TUN is a reasonable diagnostic step. Enable it from the client interface, grant the requested permission, and confirm that the virtual interface is active. Then trigger a new Copilot request and check whether the connection appears in the Clash log.
On Windows, inspect whether another VPN, corporate security agent, or virtual adapter has a higher route priority. On macOS, check for Network Extension or VPN conflicts. On Linux, verify that the client has permission to create the TUN interface and that policy routing or firewall rules are not blocking it. A TUN connection that works for a browser but breaks local development tools may indicate a route conflict rather than a Copilot-specific error.
Keep one traffic path active while testing. Running an explicit editor proxy, system proxy, TUN mode, and another VPN together can produce loops or inconsistent routing. A common loop occurs when TUN captures Clash’s own upstream connection and sends it back into the same proxy process. If the connection log shows repeated local destinations, rapidly increasing retries, or a core that becomes unresponsive after TUN is enabled, disable TUN and review the client’s bypass and process settings.
Identify Unreliable Nodes and Timeout Patterns
A node can pass a short latency test and still be unsuitable for Copilot. Latency checks often send a small request to one test URL, while an editor session may require authentication redirects, several HTTPS requests, larger responses, and connections that remain open for longer. Congestion, packet loss, restrictive upstream firewalls, or unstable protocol handling may therefore appear only during real usage.
Compare at least two nodes from the same proxy group and keep the test conditions consistent. Use the same editor, same rule, and same local port, then perform the same sign-in or suggestion action. Record whether the request fails during DNS resolution, TLS negotiation, authentication, response download, or an idle period. A node that connects immediately but fails after several seconds may have packet loss or an unstable long-lived connection rather than a simple routing error.
- Choose a node with stable results across several tests instead of selecting only the lowest displayed latency.
- Avoid judging reliability from one successful browser page or one completed sign-in.
- Check whether the node changes automatically during the Copilot request because the proxy group uses an URL test or fallback policy.
- Temporarily disable aggressive automatic switching so that the connection log remains tied to one known node.
- Compare failures at different times to identify congestion or provider-side rate limiting.
If every node fails in the same way, return to the local path, rules, and DNS checks. If only one group fails, inspect its provider entries, node names, and group type. If one region works consistently while another times out, the problem may be the upstream route rather than the Clash client. Changing the kernel or reinstalling the GUI cannot repair a node that cannot reach the required service.
After finding a working combination, restore normal group behavior carefully. Remove temporary broad rules, keep the stable group selected for a while, and reload the configuration. Then test both authentication and suggestions again. A successful login alone is not enough because an expired token, a blocked API route, or a broken extension host can still prevent code completion.
Reset the Editor State and Verify the Final Fix
When the network path has been corrected, restart the components in a predictable order: reload or restart the Clash core, confirm the local listener, close every editor window, terminate any remaining editor or extension host process, and launch the editor again. This clears processes that may have retained an old proxy environment or a failed connection pool. Do not repeatedly sign out while the proxy path is still broken, because unnecessary authentication attempts can create additional account or token confusion.
Open the editor’s output, logs, or developer tools and record the result of a fresh sign-in. Confirm that the relevant requests appear in Clash, match the intended rule, and use the intended proxy group. Then open a small test file and request several suggestions. Test after a short idle period as well, because a node that handles one request may fail when the connection is reused.
Once the issue is resolved, remove temporary diagnostic settings and document the working values: the Clash client and core, local proxy port, editor proxy mode, TUN state, DNS mode, rule policy, and stable proxy group. This record is useful when a subscription update replaces a rule, a client changes its default port, or the editor is upgraded. If the configuration is subscription-generated, place persistent changes in the client’s supported override or merge section instead of editing a file that will be overwritten.
A practical final checklist is:
- The editor process uses the intended Clash listener, with no stale proxy environment variables.
- Copilot-related connections appear in the active Clash connection log.
- The first matching rule sends the observed traffic to the intended proxy group.
- DNS resolves through the selected Clash path without conflicting fake-IP or TUN settings.
- TUN is enabled only when the editor cannot use an explicit proxy, and no VPN loop exists.
- The selected node remains usable for authentication, suggestions, and longer sessions.
If you need a clean client installation or want to compare maintained options, visit the download page. For a broader setup sequence covering configuration import, system proxy, and TUN permissions, use the setup guide.