Env var placeholder expansion in custom provider base_url config
Cluster 14457 · agent · Bug. Data as of
1 open item. Fix merged in #53584 on 27 Jun 2026. Check it covers your case.
The short answer
- Known?
- Yes. 9 related items grouped here, 1 issue already closed.
- Fix event
- A fix was merged to main in PR #53584. Check it covers your case. No release data is tracked. Fix link checked: 27 Jun 2026.
- Tracker
- The maintainers' tracker marks this
partially resolved, deciding PR #53584. That is separate from the fix event.
Next step: read #53584, then check whether your report is the one still open.
Read #53584Pick up a Lab taskMembers share a theme: ${ENV_VAR}-style placeholders in custom provider base_url settings and gateway config appear to be validated before being expanded, or not expanded at all. The items include bug reports and proposed changes that expand placeholders earlier or defer or relax URL validation.
Open issues1
- Issue#21275[Bug]: Gateway environment variable not expanded for custom model providers path
Open PRs0
Fixes on record
-
#53584 fix(config): accept placeholder base_url in custom provider validation (#14457)
files:
hermes_cli/config.py,tests/hermes_cli/test_provider_config_validation.pyShow the diff
-
hermes_cli/config.py@@ -4269,6 +4269,14 @@ def _normalize_custom_provider_entry( raw_url = entry.get(url_key) if isinstance(raw_url, str) and raw_url.strip(): candidate = raw_url.strip() + # Accept URLs containing unresolved placeholder tokens — both + # ``${ENV_VAR}`` env-refs and bare ``{region}``-style templates — + # without URL validation. They are expanded at runtime, so a + # caller reaching this normalizer with raw (un-expanded) config + # would otherwise see the provider silently dropped (#14457). + if re.search(r"\{[^}]+\}", candidate): + base_url = candidate + break parsed = urlparse(candidate) if parsed.scheme and parsed.netloc: base_url = candidate -
tests/hermes_cli/test_provider_config_validation.py@@ -191,3 +191,49 @@ def test_models_empty_list_omitted(self): result = _normalize_custom_provider_entry(entry) assert result is not None assert "models" not in result + + def test_env_var_placeholder_in_base_url_not_rejected(self): + """A base_url that is an un-expanded ${ENV_VAR} placeholder must not be + rejected as an invalid URL — it is expanded at runtime, so a caller + reaching this normalizer with raw config would otherwise see the + provider silently dropped. Regression test for #14457.""" + entry = { + "name": "PROVIDER_A", + "base_url": "${PROVIDER_A_BASE_URL}", + "key_env": "PROVIDER_A_API_KEY", + } + result = _normalize_custom_provider_entry(entry, provider_key="PROVIDER_A") + assert result is not None + assert result["base_url"] == "${PROVIDER_A_BASE_URL}" + + def test_multiple_env_vars_in_base_url(self): + """base_url with multiple ${VAR} placeholders is accepted verbatim.""" + entry = { + "name": "multi-var-provider", + "base_url": "${SCHEME}://${HOST}:${PORT}/v1", + } + result = _normalize_custom_provider_entry(entry) + assert result is not None + assert result["base_url"] == "${SCHEME}://${HOST}:${PORT}/v1" + + def test_bare_brace_region_placeholder_accepted(self): + """A bare {region}-style template token (not an env-ref) is also + accepted without validation, supporting region-substitution URLs.""" + entry = { + "name": "regional", + "base_url": "https://{region}.api.example.com/v1", + } + result = _normalize_custom_provider_entry(entry, provider_key="regional") + assert result is not None + assert result["base_url"] == "https://{region}.api.example.com/v1" + + def test_invalid_url_without_placeholder_still_rejected(self): + """A malformed URL with no scheme/host AND no placeholder token is + still rejected — the placeholder bypass must not weaken validation of + ordinary literal URLs.""" + entry = { + "name": "bad", + "base_url": "not-a-url", + } + result = _normalize_custom_provider_entry(entry, provider_key="bad") + assert result is None
-
6 PRs closed without merging
From the close comments: done elsewhere 2 · duplicate 1 · merged via another change 1 · stale or abandoned 1 · superseded by another PR 1
- #14485 fix(config): expand provider base_url templates before validation · stale or abandoned
-
#14524 fix(config): expand ${ENV_VAR} placeholders in gateway config loading (#14457) · done elsewhere →
1619210,#53584 -
#14628 fix(config): defer URL validation for base_url containing env var placeholder · merged via another change →
1619210,#53584,#15378 -
#15378 fix(cli): accept placeholder URLs in custom provider config without validation (#14457) · superseded by another PR →
1619210,#53584 -
#21304 fix(gateway): expand env vars in _load_gateway_config · done elsewhere →
1619210
Show 1 more
-
#22572 fix(gateway): expand ${VAR} env refs in _load_gateway_config() · duplicate →
#21304
Closed issues · 1
- Closed#14457[Bug]: custom_providers.base_url placeholders can be validated before expansion and get skipped as invalid URLs
How this cluster was grouped
-
Link evidence (
partly structural links): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text. - Members outside that structural core may belong to a different underlying problem.
-
Pairwise link density
0.20: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36.1.00means every pair is linked.