fix(models): preserve Ollama model:tag colons in parse_model_input - #56089
fix(models): preserve Ollama model:tag colons in parse_model_input#56089starm2010 wants to merge 2 commits into
Conversation
|
Thanks for the focused parser fix. The reported truncation is present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
|
Thanks for the review — great catch. The unit tests indeed mocked I've added 3 integration tests (
All 19 tests pass (16 original unit + 3 new integration). |
When ACP clients (like AionUI) send custom:glm-5.2:cloud to set_session_model, parse_model_input would split at the second colon treating the middle part as a named custom provider name. For Ollama models that use colons in their tags (e.g. glm-5.2:cloud, nomic-embed-text:latest), this truncated the model id to just the tag suffix (e.g. 'cloud' instead of 'glm-5.2:cloud'), causing HTTP 404 errors from the inference endpoint. The fix adds _is_registered_custom_provider() to check whether the middle part actually matches a configured custom provider in config.yaml before splitting. If it doesn't match, the full string after 'custom:' is treated as the model id. This only affects the triple-syntax path (custom:name:model). The existing single-colon path (custom:model) is unchanged.
…onfig Addresses sweeper review on PR NousResearch#56089: the unit tests mock _is_registered_custom_provider, so they don't prove the configuration integration works. These integration tests use a real HERMES_HOME with config.yaml containing named custom providers (both legacy custom_providers list and v12+ keyed providers dict) and verify: 1. custom:<name>:<model> selects the named custom provider when it exists in config.yaml's custom_providers list 2. custom:glm-5.2:cloud (unregistered middle part) keeps the full model id including the colon, not truncating to just 'cloud' 3. The v12+ keyed 'providers' schema is also discoverable by _is_registered_custom_provider via get_compatible_custom_providers No mocks on _is_registered_custom_provider — the full get_compatible_custom_providers -> load_config -> config.yaml path is exercised end-to-end.
4b5d655 to
0901f3b
Compare
|
Friendly ping — the integration tests requested in the sweeper review ( |
Problem
When ACP clients (like AionUI) send
custom:glm-5.2:cloudtoset_session_model,parse_model_inputsplits at the second colon, treating the middle part (glm-5.2) as a named custom provider name. For Ollama models that use colons in their tags (e.g.glm-5.2:cloud,nomic-embed-text:latest,kimi-k2:1t-cloud), this truncates the model id to just the tag suffix (cloudinstead ofglm-5.2:cloud), causing HTTP 404 errors from the inference endpoint.The existing triple-syntax guard (
custom:name:model→("custom:name", "model")) had no way to distinguish between:custom:ollama:qwen3— providercustom:ollama, modelqwen3(intended triple syntax)custom:glm-5.2:cloud— providercustom, modelglm-5.2:cloud(Ollama tag, NOT triple syntax)Solution
Add
_is_registered_custom_provider()that checks whether the middle part matches a configured custom provider inconfig.yaml(viaget_compatible_custom_providers()). The triple split only happens when the middle part is a registered custom provider name. Otherwise, the full string aftercustom:is treated as the model id.Testing
test_custom_triple_syntaxandtest_custom_triple_spacesto mock_is_registered_custom_provider(sincelocal-server/my-serverare not registered providers in the test env)test_custom_triple_unregistered_falls_back— verifiescustom:glm-5.2:cloudwith a mockedFalsereturns the full model idtest_custom_ollama_tag_not_truncated— regression test without mocks, verifies real-world Ollama model names pass through intactVerified manually:
Scope
custom:name:model). Single-colon path (custom:model) is unchanged._is_registered_custom_providerusesget_compatible_custom_providerswhich already exists inhermes_cli/config.py./(slash) syntax in ACP model names. This PR is complementary (different delimiter, same root concern).