Skip to content

fix(cli): always exempt loopback from proxy environment - #57744

Closed
PJ-Zetier wants to merge 1 commit into
anomalyco:devfrom
PJ-Zetier:loopback-no-proxy
Closed

PJ-Zetier wants to merge 1 commit into
anomalyco:devfrom
PJ-Zetier:loopback-no-proxy

Conversation

@PJ-Zetier

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #52054
Related: #51247. This is the v2 port of #52951, which was closed with "please port it over and open it for V2".

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When HTTP(S)_PROXY is set without a NO_PROXY exemption, the CLI's requests to its own local server — including the service probe loop and the TUI event stream — get routed through the proxy. With an unreachable or buffering proxy that shows up as the endless "Restarting service..." loop from #52054. The desktop app already upserts a loopback NO_PROXY at startup; this ports the same helper to the CLI entrypoint (Env.ensureLoopbackNoProxy: upserts both NO_PROXY/no_proxy spellings, appends only missing hosts, preserves existing user values, case-insensitive dedupe) and guards the service-mode env re-injection in server-process.ts so a saved environment can't strip the exemption back out.

How did you verify your code works?

Unit tests for the upsert helper in packages/cli/test/env.test.ts (empty env, existing NO_PROXY values preserved and appended, already-present entries not duplicated); bun run typecheck clean in packages/cli. The helper mirrors the desktop implementation that already ships.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Generated with Claude Code

Port of the v1 loopback exemption (anomalyco#52951, closed only as "port to
v2"). With HTTP(S)_PROXY set and no NO_PROXY, every call to the local
server on 127.0.0.1 routes through the proxy, which on offline or
airgapped hosts stalls or fails instead of connecting. Append the
loopback hosts to NO_PROXY/no_proxy at CLI entry before anything dials
out, mirroring the desktop runtime's exemption, and re-apply it after
service mode re-injects its saved environment so a stored proxy
configuration cannot recapture loopback.

Refs anomalyco#52054
Refs anomalyco#51247

Co-Authored-By: Claude Mythos 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@rekram1-node

Copy link
Copy Markdown
Collaborator

Closing in favor of #60441, which landed the loopback NO_PROXY fix (merging both spellings into one list). You're credited as a co-author there, thanks for the work on this.

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.

client: event stream loops forever and TUI shows "Restarting service…" when HTTP proxy is set without no_proxy

2 participants