[GH-ISSUE #7652] [Issue]: LLM requests ignore HTTP_PROXY / HTTPS_PROXY when using custom Undici dispatcher #4235

Closed
opened 2026-10-21 06:13:07 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @OkkamaSoul on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7652

Originally assigned to: @SpicyMarinara on GitHub.

Summary

HTTP proxy support for LLM API requests appears to have broken after recent updates to the staging branch. The same configuration worked correctly before these updates, with no changes to the proxy setup.

LLM API requests fail with fetch failed when Marinara Engine is configured to use an HTTP proxy via HTTP_PROXY, HTTPS_PROXY, and NODE_USE_ENV_PROXY=1.

Model listing works correctly, but message generation fails. The issue appears to be caused by safeFetch() using a custom Undici Agent that bypasses Node.js environment proxy settings.

The same API and proxy configuration works in Hermes. Enabling TUN mode in v2rayN immediately resolves the issue.

Expected behavior

Marinara Engine should respect the HTTP_PROXY and HTTPS_PROXY environment variables when NODE_USE_ENV_PROXY=1 is enabled, including for LLM API requests handled by safeFetch().

Both model listing and message generation should work through the configured proxy without requiring system-wide TUN mode.

Actual behavior

  • Model listing from https://api.rout.my/v1/models succeeds.
  • Sending a test message fails with fetch failed after approximately 10 seconds.
  • The issue affects both the OpenAI provider (/v1/responses) and Custom OAI-Compatible provider (/v1/chat/completions).
  • Changing models does not resolve the issue.
  • The same API key, endpoint, and HTTP proxy work correctly in Hermes.
  • Switching to Amnezia VPN or enabling TUN mode in v2rayN resolves the issue.
  • This suggests that LLM requests are bypassing the configured HTTP proxy and attempting direct connections.

Suspected cause: The custom Undici Agent created in safeFetch() may override Node.js built-in environment proxy handling when passed explicitly as a dispatcher.

Steps to reproduce

  1. Configure v2rayN with a local HTTP proxy at 127.0.0.1:10808, with TUN mode disabled.

  2. Launch Marinara Engine using the following batch file:

    set "NODE_USE_ENV_PROXY=1"
    set "HTTP_PROXY=http://127.0.0.1:10808"
    set "HTTPS_PROXY=http://127.0.0.1:10808"
    set "NO_PROXY=localhost,127.0.0.1,192"

Logs, screenshots, or video

OpenAI provider — Responses API:

[connections/test-message] provider=openai model=openai/gpt-6-sol url=https://api.rout.my/v1/responses

[connections/test-message] provider=openai model=openai/gpt-6-sol url=https://api.rout.my/v1/responses failed: fetch failed

Custom provider — Chat Completions API:

[connections/test-message] provider=custom model=z-ai/glm-5.1 url=https://api.rout.my/v1/chat/completions

[connections/test-message] provider=custom model=z-ai/glm-5.1 url=https://api.rout.my/v1/chat/completions failed: fetch failed
Originally created by @OkkamaSoul on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7652 Originally assigned to: @SpicyMarinara on GitHub. ## Summary HTTP proxy support for LLM API requests appears to have broken after recent updates to the staging branch. The same configuration worked correctly before these updates, with no changes to the proxy setup. LLM API requests fail with `fetch failed` when Marinara Engine is configured to use an HTTP proxy via `HTTP_PROXY`, `HTTPS_PROXY`, and `NODE_USE_ENV_PROXY=1`. Model listing works correctly, but message generation fails. The issue appears to be caused by `safeFetch()` using a custom Undici `Agent` that bypasses Node.js environment proxy settings. The same API and proxy configuration works in Hermes. Enabling TUN mode in v2rayN immediately resolves the issue. ## Expected behavior Marinara Engine should respect the `HTTP_PROXY` and `HTTPS_PROXY` environment variables when `NODE_USE_ENV_PROXY=1` is enabled, including for LLM API requests handled by `safeFetch()`. Both model listing and message generation should work through the configured proxy without requiring system-wide TUN mode. ## Actual behavior - Model listing from `https://api.rout.my/v1/models` succeeds. - Sending a test message fails with `fetch failed` after approximately 10 seconds. - The issue affects both the OpenAI provider (`/v1/responses`) and Custom OAI-Compatible provider (`/v1/chat/completions`). - Changing models does not resolve the issue. - The same API key, endpoint, and HTTP proxy work correctly in Hermes. - Switching to Amnezia VPN or enabling TUN mode in v2rayN resolves the issue. - This suggests that LLM requests are bypassing the configured HTTP proxy and attempting direct connections. **Suspected cause:** The custom Undici `Agent` created in `safeFetch()` may override Node.js built-in environment proxy handling when passed explicitly as a `dispatcher`. ## Steps to reproduce 1. Configure v2rayN with a local HTTP proxy at `127.0.0.1:10808`, with TUN mode disabled. 2. Launch Marinara Engine using the following batch file: set "NODE_USE_ENV_PROXY=1" set "HTTP_PROXY=http://127.0.0.1:10808" set "HTTPS_PROXY=http://127.0.0.1:10808" set "NO_PROXY=localhost,127.0.0.1,192" ## Logs, screenshots, or video **OpenAI provider — Responses API:** ```text [connections/test-message] provider=openai model=openai/gpt-6-sol url=https://api.rout.my/v1/responses [connections/test-message] provider=openai model=openai/gpt-6-sol url=https://api.rout.my/v1/responses failed: fetch failed ``` **Custom provider — Chat Completions API:** ```text [connections/test-message] provider=custom model=z-ai/glm-5.1 url=https://api.rout.my/v1/chat/completions [connections/test-message] provider=custom model=z-ai/glm-5.1 url=https://api.rout.my/v1/chat/completions failed: fetch failed ```
bsakaguchi 2026-10-21 06:13:07 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Oct 16, 2026):

Working on this in #7729.

<!-- gh-comment-id:6212331716 --> @SpicyMarinara commented on GitHub (Oct 16, 2026): Working on this in #7729.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4235
No description provided.