Skip to content

fix(runtime): surface malformed proxy env and base URL before client init#10545

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-99aaa1e9
Apr 15, 2026
Merged

fix(runtime): surface malformed proxy env and base URL before client init#10545
teknium1 merged 1 commit into
mainfrom
hermes/hermes-99aaa1e9

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvaged from PR #6403 by @MestreY0d4-Uninter. Contributor's authorship preserved.

When proxy env vars (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY) contain malformed URLs — e.g. http://127.0.0.1:6153export from a broken shell config — the OpenAI/httpx client throws a cryptic Invalid port: '6153export' error that doesn't identify the offending variable.

Changes:

  • _validate_proxy_env_urls() — checks all 6 proxy env var names, fails fast with a clear error naming the broken variable
  • _validate_base_url() — catches malformed custom endpoint URLs before they reach httpx
  • Both defined once in auxiliary_client.py (no duplication), called from resolve_provider_client() and _create_openai_client()
  • Author credit: .mailmap + release.py entries for MestreY0d4-Uninter

Compared to original PR #6403:

  • No code duplication (original had identical function in both run_agent.py and auxiliary_client.py)
  • No gratuitous signature refactor on resolve_provider_client()
  • No docstring regression
  • Rebased on current main

Test plan:

  • 14 new tests in tests/agent/test_proxy_and_url_validation.py — all pass
  • E2E verified: malformed proxy → clear RuntimeError, valid proxy → no error, ACP/empty/None → no error
  • Full tests/agent/ suite: 1142 passed, 6 pre-existing failures (unrelated)

Closes #6360

…init

When proxy env vars (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY) contain
malformed URLs — e.g. 'http://127.0.0.1:6153export' from a broken
shell config — the OpenAI/httpx client throws a cryptic 'Invalid port'
error that doesn't identify the offending variable.

Add _validate_proxy_env_urls() and _validate_base_url() in
auxiliary_client.py, called from resolve_provider_client() and
_create_openai_client() to fail fast with a clear, actionable error
message naming the broken env var or URL.

Closes #6360
Co-authored-by: MestreY0d4-Uninter <MestreY0d4-Uninter@users.noreply.github.com>
@teknium1 teknium1 force-pushed the hermes/hermes-99aaa1e9 branch from 0b0c0df to a4dcf27 Compare April 15, 2026 23:10
@teknium1 teknium1 merged commit f472480 into main Apr 15, 2026
@teknium1 teknium1 deleted the hermes/hermes-99aaa1e9 branch April 15, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants