Add managed bypass policy#3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a managed-mode bypassPolicy callback that can intentionally route specific destinations directly (instead of through the configured managed proxy), and wires it into proxy decision-making across the runtime. This is intended to support cases like Gateway loopback bypass without mutating NO_PROXY.
Changes:
- Introduces
bypassPolicytypes (ProxylineBypassPolicy,ProxylineBypassRequest) and exposes them in the public API. - Applies bypass decisions in managed resolver logic and updates the managed undici dispatcher implementation accordingly.
- Adds unit + proxy-lab e2e coverage for direct bypass behavior.
Reviewed changes
Copilot reviewed 5 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/index.test.ts | Adds a unit test asserting explain() returns a direct decision when bypass policy matches. |
| test/e2e.test.ts | Adds an e2e test asserting node + undici traffic goes direct (no lab proxy events) when bypass policy matches. |
| src/types.ts | Adds bypass policy option + request/policy types. |
| src/runtime.ts | Implements bypass checks in the managed resolver; introduces a managed undici dispatcher to support bypass in undici. |
| src/index.ts | Re-exports bypass policy types from the public entrypoint. |
| dist/types.d.ts | Updates generated type declarations for new bypass policy types. |
| dist/types.d.ts.map | Updates generated sourcemap for types. |
| dist/runtime.js | Updates built runtime JS with bypass policy + managed undici dispatcher changes. |
| dist/runtime.d.ts.map | Updates generated runtime d.ts sourcemap. |
| dist/index.d.ts | Updates generated index d.ts exports. |
| dist/index.d.ts.map | Updates generated index d.ts sourcemap. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+355
to
+356
| const proxyUrl = url === undefined ? "" : this.#resolver.getProxyForUrl(url); | ||
| const dispatcher = proxyUrl === "" ? this.#directDispatcher : this.#proxyDispatcher(proxyUrl); |
Comment on lines
305
to
+310
| getProxyForUrl: (url) => { | ||
| const protocol = new URL(url).protocol; | ||
| return isProxyableUrlProtocol(protocol) ? proxyUrl.href : ""; | ||
| return isProxyableUrlProtocol(protocol) && | ||
| !shouldBypassManagedProxy(bypassPolicy, url, "unknown") | ||
| ? proxyUrl.href | ||
| : ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bypassPolicycallback for intentional direct routesdist/;prepackstill builds it for the npm tarballVerification
npx -y node@24 /opt/homebrew/bin/pnpm checknpx -y node@24 /opt/homebrew/bin/pnpm package:dry-rungit diff --checkNotes
OpenClaw needs this before it can depend on
@openclaw/proxyline@0.1.1for the Gateway loopback bypass without mutatingNO_PROXY.dist/is now intentionally ignored and untracked. The package dry-run still lists the generateddist/*.js,dist/*.d.ts, anddist/*.d.ts.mapfiles inopenclaw-proxyline-0.1.1.tgzvia the existingprepackbuild.