Skip to content

fix(warp): attach CONNECT proxy to main server and reuse running instance - #251

Open
garrettg123 wants to merge 1 commit into
teamchong:mainfrom
garrettg123:fix-warp-connect-reuse
Open

fix(warp): attach CONNECT proxy to main server and reuse running instance#251
garrettg123 wants to merge 1 commit into
teamchong:mainfrom
garrettg123:fix-warp-connect-reuse

Conversation

@garrettg123

Copy link
Copy Markdown

Summary

This PR enables the CONNECT forward proxy and absolute-form HTTP handlers directly on pxpipe-proxy's main server (default port 47821) and updates pxpipe warp to reuse an already-running pxpipe instance on 127.0.0.1:<port> when available.

Problem

  1. When running tools with persistent background daemons (such as Claude Code's background supervisor daemon and agents), running pxpipe warp spawns a temporary CONNECT proxy on an ephemeral port (port 0).
  2. The background daemon inherits HTTP_PROXY=http://127.0.0.1:<ephemeral_port>.
  3. When the foreground warp process exits, the ephemeral port stops listening. The long-running daemon and its spawned background workers remain pointing at the dead port, leading to ECONNREFUSED / "Connection refused — a firewall or proxy may be blocking it" on subsequent prompts.
  4. Multiple concurrent agent sessions each allocated separate ephemeral ports, causing port contention and broken daemon routing.

Fix

  • Attach handlers.handleConnect (server.on('connect', ...)) and handlers.handleAbsoluteForm to the main createServer in src/node.ts.
  • In createWarpRuntime (src/warp/index.ts), probe 127.0.0.1:${port} before starting an ephemeral listener; if the proxy is already running on that port, reuse it directly.
  • Added automated integration test (tests/warp-connect.test.ts) validating HTTPS CONNECT proxy tunneling and local route diversion.

Copilot AI lite review requested due to automatic review settings August 25, 2026 07:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants