The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(agent): vllm/llama.cpp title pins also wait for the self-hosted turn
kshitijk4poore74f52028248
diff --git a/agent/title_generator.py b/agent/title_generator.pyindex 9385a562817..d080cf3e0d4 100644--- a/agent/title_generator.py+++ b/agent/title_generator.py@@ -195,35 +195,36 @@ def title_upgrade_must_wait_for_turn(main_runtime: Optional[dict]) -> bool:return Falsetry:cfg = _title_config()+ pinned_provider = str(cfg.get("provider") or "").strip().lower()+ if pinned_provider not in ("", "auto") and not _title_pin_may_share_endpoint(pinned_provider, provider):+ return Falseexcept Exception:return True- pinned_provider = str(cfg.get("provider") or "").strip().lower()pinned_base_url = str(cfg.get("base_url") or "").strip().rstrip("/")main_base_url = str((main_runtime or {}).get("base_url") or "").strip().rstrip("/")- if pinned_provider not in ("", "auto") and not _title_pin_may_share_endpoint(pinned_provider, provider):- return Falsereturn not pinned_base_url or pinned_base_url == main_base_urldef _is_self_hosted_provider(provider: str) -> bool:- """``custom``, a named ``custom:<name>`` route, or first-class LM Studio: one local server per route."""- return provider in ("custom", "lmstudio") or provider.startswith("custom:")+ """``custom``, a named ``custom:<name>`` route, LM Studio or ``local`` (vllm/llama.cpp): one local server per route.++ Normalised here so the main route and the title pin resolve aliases (``ollama``, ``lm-studio``…) the same way.+ """+ from hermes_cli.providers import normalize_provider+ provider = normalize_provider(provider)+ return provider in ("custom", "lmstudio", "local") or provider.startswith("custom:")def _title_pin_may_share_endpoint(pinned_provider: str, main_provider: str) -> bool:"""A title pin that can land on the turn's own self-hosted server (only its ``base_url`` can prove otherwise).- Hosted pins (``openrouter``…) multiplex and never share the slot. A pin to ``custom``/``lmstudio``/any+ Hosted pins (``openrouter``…) multiplex and never share the slot. A pin to ``custom``/``lmstudio``/``local``/any``custom:<name>`` is assumed to share until the caller compares ``base_url``, and a bare ``<name>`` /display-name pin is the same endpoint when it aliases the main ``custom:<name>`` route(``hermes_cli.providers.custom_provider_aliases`` — the resolver's own identity set)."""- try:- from hermes_cli.providers import custom_provider_aliases, normalize_provider- except Exception:- return True- pinned = normalize_provider(pinned_provider)- if _is_self_hosted_provider(pinned):+ from hermes_cli.providers import custom_provider_aliases+ if _is_self_hosted_provider(pinned_provider):return Truereturn bool(custom_provider_aliases(pinned_provider) & custom_provider_aliases(main_provider))diff --git a/tests/agent/test_title_generator.py b/tests/agent/test_title_generator.pyindex c61714f7526..a3f4bc187a8 100644--- a/tests/agent/test_title_generator.py+++ b/tests/agent/test_title_generator.py@@ -433,6 +433,7 @@ class TestMaybeAutoTitle:("custom:gptoss-local", {"provider": "openrouter"}, False),("custom:gptoss-local", {"provider": "nous"}, False),("custom", {"provider": "ollama"}, True), # alias of custom+ ("custom", {"provider": "vllm"}, True), # normalises to `local`: the same local server("lmstudio", {"provider": "lm-studio"}, True),("lmstudio", {"provider": "lmstudio", "base_url": "http://10.0.0.2:1234/v1"}, False),("lmstudio", {"provider": "openrouter"}, False),