fix(agent): honor custom CA certs for custom_providers HTTPS endpoints - #56393
fix(agent): honor custom CA certs for custom_providers HTTPS endpoints#56393HexLab98 wants to merge 2 commits into
Conversation
Introduce a shared helper that maps HERMES_CA_BUNDLE, SSL_CERT_FILE, and per-provider ssl_ca_cert settings to httpx verify contexts.
Wire ssl_ca_cert and ssl_verify through custom_providers config and env vars into the keepalive httpx client, fixing APIConnectionError against mkcert/self-signed Ollama proxies behind HTTPS.
29499ab to
a580514
Compare
tonydwb
left a comment
There was a problem hiding this comment.
LGTM — clean implementation of per-provider TLS settings for custom providers. The ssl_verify.py module is well-structured with clear priority ordering, and the test coverage (ssl_verify, custom_provider_tls, keepalive_client) is thorough. Minor note: the bare except: pass in agent_init.py and switch_model catches all exceptions including potential import errors, but this is acceptable for a non-critical init path.
Related: this is part of the SSL/custom-CA cluster — it implements feature issue #48440 (per-provider |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: LGTM
Adds custom CA certificate support for custom_providers HTTPS endpoints. New agent/ssl_verify.py module resolves httpx verify from config, env vars, and per-provider settings.
Looks Good
- Clean priority chain: ssl_verify:false > ca_bundle > env vars > True
- Per-provider ssl_ca_cert and ssl_verify config fields properly normalized
- Keepalive httpx client correctly receives verify parameter
- Comprehensive tests: 3 test files covering verify resolution, custom provider TLS, and client creation
- Exception handling in agent_init is appropriate (best-effort TLS)
Reviewed by Hermes Agent
|
Your two commits were cherry-picked with authorship preserved (rebase-merge), so they land on We extended it on top in a follow-up:
This closes the SSL/custom-CA cluster (implements #48440 and #28260). |
Summary
resolve_httpx_verify()so the primary OpenAI/httpx client honorsHERMES_CA_BUNDLE,SSL_CERT_FILE, and per-providerssl_ca_certsettings.ssl_ca_cert/ssl_verifyfields tocustom_providers/providersconfig and wire them into agent client creation.Fixes the
APIConnectionError: Connection errorreported when pointing Hermes at HTTPS Ollama/LiteLLM endpoints signed by a private CA (mkcert, corporate proxy, etc.).Test plan
scripts/run_tests.sh tests/agent/test_ssl_verify.py tests/hermes_cli/test_custom_provider_tls.py tests/run_agent/test_create_openai_client_ssl_verify.pyssl_ca_cert: /path/to/rootCA.pemincustom_providers