fix(config): validate providers config entries — reject non-URL base, accept camelCase aliases#9359
Closed
luyao618 wants to merge 1 commit into
Closed
Conversation
… accept camelCase aliases _normalize_custom_provider_entry() silently accepted non-URL strings (e.g. "openai-reverse-proxy") as base_url via the "api" field, and ignored camelCase keys (apiKey, baseUrl) without warning. Changes: - Validate that base URL candidates have a scheme and netloc via urlparse; skip non-URL values with a clear warning - Change URL field priority to (base_url, url, api) so explicit base_url takes precedence - Accept common camelCase aliases (apiKey → api_key, baseUrl → base_url, etc.) with a deprecation warning - Warn on unrecognized config keys to surface typos early Fixes NousResearch#9332
1 task
teknium1
pushed a commit
that referenced
this pull request
Apr 20, 2026
… accept camelCase aliases (#9332) Cherry-picked from PR #9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes #9332
teknium1
pushed a commit
that referenced
this pull request
Apr 20, 2026
… accept camelCase aliases (#9332) Cherry-picked from PR #9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes #9332
Contributor
ulasbilgen
pushed a commit
to ulasbilgen/hermes-adhd-agent
that referenced
this pull request
May 1, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
aj-nt
pushed a commit
to aj-nt/hermes-agent
that referenced
this pull request
May 1, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
Luminet2023
pushed a commit
to Luminet2023/hermes-agent
that referenced
this pull request
May 1, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
… accept camelCase aliases (NousResearch#9332) Cherry-picked from PR NousResearch#9359 by @luyao618. - Accept camelCase aliases (apiKey, baseUrl, apiMode, keyEnv, defaultModel, contextLength, rateLimitDelay) with auto-mapping to snake_case + warning - Validate URL field values with urlparse (scheme + netloc check) — reject non-URL strings like 'openai-reverse-proxy' that were silently accepted - Warn on unknown keys in provider config entries - Re-order URL field priority: base_url > url > api (was api > url > base_url) - 12 new tests covering all scenarios Closes NousResearch#9332
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes silent misconfiguration in
providers:config entries that caused crypticAPIConnectionErrorandBearer no-key-requiredfailures.Three issues are addressed:
Non-URL strings silently accepted as base_url: The
apifield was checked first in the URL lookup order("api", "url", "base_url"), and any non-empty string was accepted without URL validation. A value likeopenai-reverse-proxywould be used as the endpoint, causingInvalid URLerrors at runtime.camelCase keys silently ignored: Hand-written configs using
apiKey,baseUrl, etc. were silently dropped because only snake_case (api_key,base_url) was recognized. This left the provider with no credentials.Unknown keys unreported: Typos and unsupported fields in provider entries produced no warning, making config debugging difficult.
Related Issue
Fixes #9332
Type of Change
Changes Made
urlparse()— must have both scheme and netloc. Non-URL strings are skipped with a clear warning naming the field and value.("api", "url", "base_url")to("base_url", "url", "api")so explicitbase_urltakes precedence.apiKey→api_key,baseUrl→base_url,apiMode→api_mode, etc.) are auto-mapped with a deprecation warning.loggingimport and module-level logger tohermes_cli/config.py.How to Test
Create a provider entry with a non-URL
apifield:Before: Silently accepted, fails at runtime with
Invalid URL.After: Entry is rejected at config load with a clear warning.
Create a provider entry with camelCase keys:
Before: Both keys silently ignored, no URL and no key found.
After: Auto-mapped to
base_urlandapi_keywith deprecation warnings.Run the test suite:
Run full suite:
Checklist
Code
pytest tests/ -qand all tests passDocumentation & Housekeeping