Skip to content

fix(models): preserve Ollama model:tag colons in parse_model_input - #170

Open
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56089
Open

fix(models): preserve Ollama model:tag colons in parse_model_input#170
hashbender wants to merge 1 commit into
mainfrom
mirror/pr-56089

Conversation

@hashbender

Copy link
Copy Markdown
Owner

Problem

When ACP clients (like AionUI) send custom:glm-5.2:cloud to set_session_model, parse_model_input splits 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 (cloud instead of glm-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 — provider custom:ollama, model qwen3 (intended triple syntax)
  • custom:glm-5.2:cloud — provider custom, model glm-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 in config.yaml (via get_compatible_custom_providers()). The triple split only happens when the middle part is a registered custom provider name. Otherwise, the full string after custom: is treated as the model id.

# Before (truncates Ollama tags):
if custom_name and actual_model:
    return (f"custom:{custom_name}", actual_model)

# After (only splits for registered custom providers):
if custom_name and actual_model and _is_registered_custom_provider(custom_name):
    return (f"custom:{custom_name}", actual_model)

Testing

  • Updated test_custom_triple_syntax and test_custom_triple_spaces to mock _is_registered_custom_provider (since local-server/my-server are not registered providers in the test env)
  • Added test_custom_triple_unregistered_falls_back — verifies custom:glm-5.2:cloud with a mocked False returns the full model id
  • Added test_custom_ollama_tag_not_truncated — regression test without mocks, verifies real-world Ollama model names pass through intact

Verified manually:

parse_model_input("custom:glm-5.2:cloud", "custom")    → ("custom", "glm-5.2:cloud") ✅
parse_model_input("custom:ollama:qwen3", "custom")      → ("custom:ollama", "qwen3")  ✅
parse_model_input("custom:nomic-embed-text:latest", ..) → ("custom", "nomic-embed-text:latest") ✅
parse_model_input("custom:gpt-4o", "custom")            → ("custom", "gpt-4o")         ✅

Scope


Mirror-of: NousResearch#56089
NousResearch#56089

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant