Skip to content

The agent that grows with you

fix(agent): defer title upgrades for named custom providers

KoNit-K194d41d91a95
diff --git a/agent/title_generator.py b/agent/title_generator.py
index 9e5073cbb8b..a0cfa9a96b0 100644
--- a/agent/title_generator.py
+++ b/agent/title_generator.py
@@ -180,7 +180,8 @@ def _model_title_upgrade_enabled() -> bool:
def title_upgrade_must_wait_for_turn(main_runtime: Optional[dict]) -> bool:
"""True when the model title call would hit the SAME self-hosted endpoint as the turn's own request.
- A ``custom`` main route (llama.cpp, Ollama, vLLM, LM Studio…) whose ``auxiliary.title_generation``
+ A ``custom`` (including ``custom:<name>``) main route (llama.cpp, Ollama, vLLM, LM Studio…)
+ whose ``auxiliary.title_generation``
is not pinned elsewhere shares one local server between the streaming main request and the
concurrent ``response_format: json_schema`` title request. Single-slot servers then serve the
title grammar/completion into the main turn: the user's reply arrives as ``{"title": ...}``, is
@@ -189,7 +190,7 @@ def title_upgrade_must_wait_for_turn(main_runtime: Optional[dict]) -> bool:
Hosted providers multiplex requests independently and keep the turn-start timing.
"""
provider = str((main_runtime or {}).get("provider") or "").strip().lower()
- if provider != "custom":
+ if provider != "custom" and not provider.startswith("custom:"):
return False
try:
cfg = _title_config()
diff --git a/tests/agent/test_title_generator.py b/tests/agent/test_title_generator.py
index 7063f749f25..b0e26d6b096 100644
--- a/tests/agent/test_title_generator.py
+++ b/tests/agent/test_title_generator.py
@@ -391,6 +391,7 @@ class TestMaybeAutoTitle:
"main_runtime, title_cfg, deferred",
[
({"provider": "custom", "base_url": "http://127.0.0.1:8080/v1"}, {}, True),
+ ({"provider": "custom:gptoss-local", "base_url": "http://127.0.0.1:8080/v1"}, {}, True),
({"provider": "custom", "base_url": "http://127.0.0.1:8080/v1"}, {"base_url": "http://127.0.0.1:8080/v1/"}, True),
({"provider": "custom", "base_url": "http://127.0.0.1:8080/v1"}, {"provider": "openrouter"}, False),
({"provider": "custom", "base_url": "http://127.0.0.1:8080/v1"}, {"base_url": "http://10.0.0.2:8080/v1"}, False),