AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Configuring Supermaven Behind Corporate Proxies: Preventing WebSocket Timeouts and sm-agent Connection Failures

平沼慧一 · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Software engineers working in regulated sectors—such as banking, fintech, healthcare, and enterprise software—frequently hit an invisible wall when adopting modern AI code assistants. After installing Supermaven in Neovim (supermaven-nvim) or VS Code, code completions either fail completely or intermittently vanish.

Inspecting the extension logs reveals the signature culprit:

INFO [sm_agent] Starting sm-agent
INFO [sm_agent::edge_connection] Starting new edge connection
ERROR [sm_agent::edge_connection] connection init timed out (5s)
INFO [sm_agent::edge_connection] websocket closed - shutting down Edge Connection

This guide details why Supermaven’s daemon (sm-agent) fails in restricted enterprise networks and provides concrete, battle-tested solutions to eliminate WebSocket timeouts, navigate corporate forward proxies, and properly establish custom SSL/TLS root certificate trust chains.


The Architecture: Why Supermaven Fails Behind Corporate Firewalls

Unlike lightweight plugins that poll REST APIs over standard HTTPS, Supermaven is engineered around extreme low-latency completion streaming:

  1. Separation of Editor and Agent: The editor plugin (supermaven-nvim or the VS Code extension) acts purely as an interface. The heavy lifting—local context ingestion, buffer monitoring, and network streaming—is handled by a compiled background binary called sm-agent.
  2. Persistent WebSocket Long-Connections: sm-agent establishes a real-time, bidirectional WebSocket connection (wss://, targeting endpoints like stream.supermaven.com and supermaven.com over port 443).
  3. The Aggressive 5-Second Handshake Timeout: sm-agent hardcodes an aggressive 5-second initialization window (connection init timed out (5s)). In consumer broadband environments, a TLS and WebSocket upgrade handshake takes 50–150 ms. In enterprise environments, that handshake must traverse multi-tiered proxy balancers, perform NTLM/Kerberos authentication, and undergo man-in-the-middle (MITM) deep packet inspection. This easily exceeds 5 seconds, causing sm-agent to abort the connection.
  4. Environment Isolation in GUI Launchers: When editors are launched via OS application menus or desktop shortcuts, child processes spawned by the editor frequently fail to inherit terminal-defined proxy environment variables (HTTP_PROXY, HTTPS_PROXY).
  5. MITM SSL Decryption & Custom CA Roots: Enterprise security appliances (e.g., Zscaler, Netskope, Palo Alto Networks, Blue Coat) intercept outbound TLS traffic and re-sign sessions using an internal enterprise certificate authority. If sm-agent cannot validate this corporate root certificate, the TLS handshake stalls or rejects immediately.

365Finds Institutional Judgments & Recommendations

At 365Finds, we evaluate developer infrastructure from both practical developer productivity and strict enterprise security governance:


Step 1: Standardizing Proxy Environment Variables

The first step is ensuring all standard proxy variables are declared consistently across lowercase and uppercase formats in your shell profile (~/.bashrc, ~/.zshrc, or /etc/environment).

Add the following configuration:

# Corporate Proxy Configuration
export HTTP_PROXY="http://proxy.corp.internal:8080"
export HTTPS_PROXY="http://proxy.corp.internal:8080"
export http_proxy="http://proxy.corp.internal:8080"
export https_proxy="http://proxy.corp.internal:8080"

# SOCKS / Generic Tunneling (if supported)
export ALL_PROXY="socks5://proxy.corp.internal:1080"
export all_proxy="socks5://proxy.corp.internal:1080"

# Bypass local and internal domain resolution
export NO_PROXY="localhost,127.0.0.1,.corp.internal,10.0.0.0/8,192.168.0.0/16"
export no_proxy="localhost,127.0.0.1,.corp.internal,10.0.0.0/8,192.168.0.0/16"

Apply changes:

source ~/.zshrc   # or source ~/.bashrc

[!IMPORTANT] If your proxy requires basic authentication, avoid writing plaintext credentials into dotfiles. Use URL encoding if special characters exist in passwords (http://user:p%40ssword@proxy:8080), or use a local authentication sidecar as shown in Step 3.


Step 2: Injecting Corporate Root CA Certificates

If your organization inspects encrypted traffic, sm-agent will fail the TLS handshake unless the enterprise CA root certificate is present in the runtime's trust store.

1. Export the Enterprise Root Certificate

Obtain your corporate root certificate from your IT helpdesk or export it from your system keychain in PEM format (e.g., corp-root-ca.crt or corp-ca-bundle.pem).

2. Update the Operating System Certificate Store

On Ubuntu / Debian:

sudo cp corp-root-ca.crt /usr/local/share/ca-certificates/corp-root-ca.crt
sudo update-ca-certificates

On RHEL / CentOS / Rocky Linux / Fedora:

sudo cp corp-root-ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust

On macOS:

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-root-ca.crt

3. Direct Runtime TLS Libraries to the CA Bundle

Compiled Rust binaries and Node-based extension hosts reference specific environment variables for certificate discovery. Add these to your shell profile:

# OpenSSL / Rust TLS standard pointers
export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt"
export SSL_CERT_DIR="/etc/ssl/certs"

# Node.js / VS Code extension runtime
export NODE_EXTRA_CA_CERTS="/path/to/corp-ca-bundle.pem"

Step 3: Bridging NTLM / Kerberos with a Local Proxy Sidecar

In banking and defense environments, corporate proxies often demand NTLM or Active Directory Kerberos handshakes that standalone CLI binaries cannot negotiate.

The standard engineering solution is deploying a lightweight local forwarding sidecar—such as Cntlm or Px—on 127.0.0.1. The local daemon handles upstream enterprise authentication, providing a clean local forward proxy without upstream authentication headaches.

Example Cntlm Configuration (/etc/cntlm.conf):

Username    developer_id
Domain      CORP_DOMAIN
Proxy       proxy.corp.internal:8080
Listen      127.0.0.1:3128
NoProxy     localhost, 127.0.0.*, *.corp.internal

Generate your NTLM hash:

cntlm -H

Add the generated PassNTLMv2 hash to /etc/cntlm.conf and start the service:

sudo systemctl enable --now cntlm

Then point your environment variables to the local sidecar:

export HTTP_PROXY="http://127.0.0.1:3128"
export HTTPS_PROXY="http://127.0.0.1:3128"
export http_proxy="http://127.0.0.1:3128"
export https_proxy="http://127.0.0.1:3128"

Step 4: Forcing Traffic Through Layer-3 TUN or ProxyChains

When corporate proxies refuse or mishandle HTTP Upgrade: websocket headers over standard forward proxy ports, application-level variables are insufficient.

Approach A: Network-Level TUN Mode (Recommended by 365Finds)

Using modern client-side routing tools (such as Clash, sing-box, or enterprise-approved VPN clients configured with a virtual TUN interface) transparently captures all layer-3 IP packets emitted by sm-agent.

Approach B: Wrapping via ProxyChains (proxychains-ng)

For Neovim users who cannot modify network adapters, proxychains-ng hooks dynamic socket calls (connect, poll) using LD_PRELOAD:

  1. Configure /etc/proxychains.conf:
strict_chain
proxy_dns
[ProxyList]
http 127.0.0.1 3128
  1. Launch Neovim wrapped with proxychains:
proxychains4 -q nvim

This forces all outbound TCP connections initiated by Neovim and its spawned child processes (sm-agent) through the local proxy adapter.


Step 5: Enterprise Firewall Whitelisting Specifications

If you have direct access to your network engineering or infosec team, requesting an explicit egress whitelist is the cleanest permanent fix. Provide the following specification:

FieldConfiguration Specification
Target Domains*.supermaven.com, supermaven.com, stream.supermaven.com
Destination PortTCP 443 (Outbound)
Protocol / MethodHTTPS and Secure WebSockets (wss://) via HTTP GET with Upgrade: websocket
Expected Server ResponseHTTP 101 Switching Protocols
Inspection PolicyBypass Deep Packet Inspection (DPI) / SSL Re-encryption or apply unified Enterprise Root CA
Connection TimeoutMaintain TCP Keepalive; idle timeout threshold >= 300 seconds

Step 6: Verification and Diagnostics

Once configured, verify connectivity before opening your editor.

1. Locate the sm-agent Binary

Supermaven downloads sm-agent to your user directory:

Verify executable permissions:

chmod +x ~/.supermaven/binary/*/*/sm-agent

2. Test WebSocket Egress via CLI

Test whether your proxy permits WebSocket upgrades to Supermaven’s edge cluster using curl:

curl -i -N \
  -H "Connection: Upgrade" \
  -H "Upgrade: websocket" \
  -H "Host: supermaven.com" \
  -H "Origin: https://supermaven.com" \
  -x "http://127.0.0.1:3128" \
  https://supermaven.com/

A successful handshake will return an HTTP/1.1 101 Switching Protocols or an authorized upgrade response rather than a 403 Forbidden, 502 Bad Gateway, or 504 Gateway Timeout.

3. Verify in Neovim (supermaven-nvim)

In your Neovim configuration, enable debug logging:

require("supermaven-nvim").setup({
  log_level = "debug",
})

Launch Neovim from the terminal:

nvim .

Inspect plugin output using :messages or :SupermavenStatus. A properly connected agent will output:

INFO [sm_agent] Starting sm-agent
INFO [sm_agent::edge_connection] Starting new edge connection
INFO [sm_agent::edge_connection] UserStatus: Free Tier (or Pro Tier)

The absence of connection init timed out (5s) confirms that the WebSocket handshake completed within the timeout threshold and real-time completions are active.


Strategy Comparison

StrategySetup OverheadEnterprise Security Compliance5s Timeout ResilienceRecommended Scenario
Shell Environment Variables (HTTP_PROXY)MinimalHigh (uses standard routes)Moderate (vulnerable to handshake latency)Standard corporate proxies with standard SSL trust
Local Sidecar (Cntlm / Px)ModerateHigh (eliminates cleartext credentials)HighEnvironments requiring corporate NTLM / Kerberos auth
Layer-3 TUN RoutingModerateModerate (requires local network tool permissions)Very HighWhen proxies reject or strip WebSocket upgrade headers
SecOps Firewall WhitelistingHigh (ticket/approval required)Highest (fully sanctioned by IT)MaximumLong-term institutional and team-wide deployments

References