fix(netx-tools): ignore system proxy for netx API calls

Set trust_env=False for netx tool HTTP clients so local netx endpoints are called directly instead of via host proxy settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-09 16:10:40 +08:00
parent 04050747ae
commit 6307ade480

View file

@ -69,7 +69,8 @@ def _http_json(method: str, path: str, *, params: dict[str, Any] | None = None)
base = _netx_base_url()
url = f"{base}{path}"
try:
with httpx.Client(timeout=45.0) as client:
# Do not inherit system proxy settings for local netx calls.
with httpx.Client(timeout=45.0, trust_env=False) as client:
resp = client.request(method, url, params=params or None, headers=_netx_headers())
text = resp.text
if not resp.is_success:
@ -492,7 +493,8 @@ def netx_sql_query_tool() -> ToolSpec:
base = _netx_base_url()
url = f"{base}/v1/sql/query"
try:
with httpx.Client(timeout=60.0) as client:
# Do not inherit system proxy settings for local netx calls.
with httpx.Client(timeout=60.0, trust_env=False) as client:
resp = client.post(url, json={"sql": sql, "batch_id": batch_id, "limit": limit}, headers=_netx_headers())
text = resp.text
if not resp.is_success:
@ -751,7 +753,8 @@ def netx_sql_query_ume_tool() -> ToolSpec:
base = _netx_base_url()
url = f"{base}/v1/sql/ume_query"
try:
with httpx.Client(timeout=60.0) as client:
# Do not inherit system proxy settings for local netx calls.
with httpx.Client(timeout=60.0, trust_env=False) as client:
resp = client.post(
url,
json={"sql": sql, "limit": limit, "statement_timeout_ms": statement_timeout_ms},