Skip to content

fix(desktop): keep macOS local services off system proxies and find user Node installs#26

Merged
Luhaozhu merged 1 commit into
mainfrom
fix/desktop-macos-proxy-and-node-detection
Jul 25, 2026
Merged

fix(desktop): keep macOS local services off system proxies and find user Node installs#26
Luhaozhu merged 1 commit into
mainfrom
fix/desktop-macos-proxy-and-node-detection

Conversation

@Luhaozhu

Copy link
Copy Markdown
Contributor

Problem

On macOS, the desktop client's bundled local server could break in two independent ways:

  1. System proxy intercepts loopback traffic. The local profile is a mesh of 127.0.0.1 services (backend ↔ MCP sidecars ↔ script runner ↔ internal publish callbacks) speaking httpx, which honours http_proxy/https_proxy/all_proxy. With a desktop system proxy enabled (e.g. Clash), those loopback requests were routed through the proxy, which answers 127.0.0.1 targets with 502 Bad Gateway — startup readiness failed (http://127.0.0.1:9113/mcp → 502) and site publishing errored at runtime.
  2. Node detection misses per-user installs. The macOS bootstrap installer runs with the minimal GUI PATH and only probed /opt/homebrew/bin and /usr/local/bin as fallbacks. Node installed under ~/.local/bin or via nvm/fnm/mise/volta was reported missing, silently degrading React site building, Playwright screenshots, and document tools.

Additionally, the script-runner /get_file cap (10MB) was below the site-publish pack limit (40MB), so publishing a larger site (e.g. with images) failed with 413 after a successful in-sandbox tar.

Changes

  • The local profile merges loopback hosts (127.0.0.1, localhost, ::1) into NO_PROXY/no_proxy at startup. Proxy variables themselves are left intact — external model/API calls may legitimately need them.
  • The macOS installer probes common per-user Node locations: ~/.local/bin, Homebrew on both architectures, ~/.volta/bin, and nvm/fnm/mise version trees.
  • /get_file now uses a dedicated 64MB fetch cap so publishes up to the 40MB pack limit succeed.
  • Tests cover the NO_PROXY merge semantics and the installer probe list.

Testing

  • tests/test_local_profile.py passes, including the new proxy-bypass test.
  • cargo test --lib passes in desktop/src-tauri (installer content assertions).
  • Verified end to end on macOS with a system proxy enabled: freshly packaged client auto-installs the local server, sidecar readiness passes, Node is detected from ~/.local/bin, and a site publish round-trips successfully (workspace at ~/.hugagent/workspace, hosted page served back correctly).

…ser Node installs

- Merge loopback hosts into NO_PROXY in the local profile: httpx honours
  http_proxy/all_proxy, and a desktop system proxy (e.g. Clash) answers
  127.0.0.1 targets with 502 Bad Gateway, which broke sidecar readiness at
  startup and every internal loopback call including site publishing.
- Broaden the macOS bootstrap installer's optional-Node probe to per-user
  install locations (~/.local/bin, Homebrew on both architectures, and
  nvm/fnm/mise/volta version trees): the GUI launch PATH misses them, so
  Node was reported missing and React site building silently degraded.
- Raise the script-runner /get_file fetch cap to 64MB so site publishes up
  to the 40MB pack limit no longer fail with 413 after a successful
  in-sandbox tar.
- Cover the NO_PROXY merge and the installer probe list with tests.
@Luhaozhu
Luhaozhu merged commit c68b2c6 into main Jul 25, 2026
3 checks passed
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.

1 participant