Skip to content

The agent that grows with you

fix(title): keep the derived title while skipping the model upgrade (#85194)

Gustavo Payano06387ae8d3d3
diff --git a/agent/title_generator.py b/agent/title_generator.py
index fdb0556e815..21c28f168c5 100644
--- a/agent/title_generator.py
+++ b/agent/title_generator.py
@@ -152,6 +152,16 @@ def _auto_title_enabled() -> bool:
return True
+def _model_title_upgrade_enabled() -> bool:
+ """Distinct from ``enabled``: keep the instant derived title, skip the background model call (#85194)."""
+ try:
+ from utils import is_truthy_value
+ return is_truthy_value(_title_config().get("model_upgrade_enabled"), default=True)
+ except Exception:
+ logger.debug("Failed to read title_generation.model_upgrade_enabled", exc_info=True)
+ return True
+
+
def strip_control_wrappers(text: str) -> str:
"""Remove leading control wrappers (nested too) so a slash-command turn reduces to the prose the user typed."""
current = (text or "").strip()
@@ -295,6 +305,9 @@ def generate_title(
if not _auto_title_enabled():
logger.debug("Auto-title skipped: auxiliary.title_generation.enabled=false")
return None
+ if not _model_title_upgrade_enabled():
+ logger.debug("Model title upgrade skipped: auxiliary.title_generation.model_upgrade_enabled=false")
+ return None
try:
if runtime_validator is not None and not runtime_validator():
logger.debug("Title generation skipped: runtime validator returned False")
@@ -539,6 +552,9 @@ def maybe_auto_title(
logger.debug("Auto-title skipped: auxiliary.title_generation.enabled=false")
return
apply_instant_title(session_db, session_id, user_message, title_callback)
+ if not _model_title_upgrade_enabled():
+ logger.debug("Instant title persisted; model upgrade disabled by auxiliary.title_generation.model_upgrade_enabled=false")
+ return
# The thread must resolve auxiliary.title_generation (config, provider key, language) for the
# profile whose turn this is: a bare Thread starts with an empty context and lands on the launch
# profile under multiplex, titling X's session with the default profile's model and billing its key.
diff --git a/cli-config.yaml.example b/cli-config.yaml.example
index 91e2a2c47d6..76e42166631 100644
--- a/cli-config.yaml.example
+++ b/cli-config.yaml.example
@@ -862,6 +862,7 @@ prompt_caching:
# # Automatic session title generation after the first exchange
# title_generation:
# enabled: true # set false to disable auto-title generation
+# model_upgrade_enabled: true # set false to keep the instant derived title and skip the model call
# provider: "auto"
# model: ""
# timeout: 30
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.py
index b4b09338b62..d6763c583d4 100644
--- a/hermes_cli/config_defaults.py
+++ b/hermes_cli/config_defaults.py
@@ -714,6 +714,7 @@ DEFAULT_CONFIG = {
# prefer_fast_model opts in to the provider fast tier; auto otherwise = main model.
"title_generation": {
"enabled": True,
+ "model_upgrade_enabled": True, # False = keep the instant derived title, never call a model
# Note: session_search no longer uses an auxiliary LLM (PR #27590 — single-shape tool returns DB
# content directly). The old ``auxiliary.session_search.*`` block was removed here. Existing
# values in user config.yaml files are harmless leftovers and ignored.
diff --git a/tests/agent/test_title_generator.py b/tests/agent/test_title_generator.py
index e32fbf59fd3..a107a970941 100644
--- a/tests/agent/test_title_generator.py
+++ b/tests/agent/test_title_generator.py
@@ -432,6 +432,39 @@ class TestMaybeAutoTitle:
assert db.get_session_title("sess-1") == "fix the flaky auth test in login"
assert db.get_session_title_source("sess-1") == "derived"
+ def test_model_upgrade_disabled_keeps_derived_title_and_spawns_no_thread(self, tmp_path):
+ db = SessionDB(tmp_path / "state.db")
+ db.create_session(session_id="sess-1", source="cli")
+ config = {
+ "auxiliary": {"title_generation": {
+ "enabled": True, "model_upgrade_enabled": False,
+ }}
+ }
+ with patch("hermes_cli.config.load_config_readonly", return_value=config), \
+ patch("agent.memory_provider.spawn_context_thread") as thread, \
+ patch("agent.title_generator.call_llm") as call_llm:
+ maybe_auto_title(db, "sess-1", "repair startup memory routing", [])
+ assert db.get_session_title("sess-1") == "repair startup memory routing"
+ assert db.get_session_title_source("sess-1") == "derived"
+ thread.assert_not_called()
+ call_llm.assert_not_called()
+
+ def test_enabled_false_still_disables_derived_and_model_titles(self, tmp_path):
+ db = SessionDB(tmp_path / "state.db")
+ db.create_session(session_id="sess-1", source="cli")
+ config = {
+ "auxiliary": {"title_generation": {
+ "enabled": False, "model_upgrade_enabled": True,
+ }}
+ }
+ with patch("hermes_cli.config.load_config_readonly", return_value=config), \
+ patch("agent.memory_provider.spawn_context_thread") as thread, \
+ patch("agent.title_generator.call_llm") as call_llm:
+ maybe_auto_title(db, "sess-1", "repair startup memory routing", [])
+ assert db.get_session_title("sess-1") is None
+ thread.assert_not_called()
+ call_llm.assert_not_called()
+
def test_skips_machine_authored_opening_messages(self, tmp_path):
"""A compaction handoff is not a user request and must not title."""
db = SessionDB(tmp_path / "state.db")
diff --git a/website/docs/user-guide/configuration.md b/website/docs/user-guide/configuration.md
index 1a25dc3129b..1d8b5b3a48e 100644
--- a/website/docs/user-guide/configuration.md
+++ b/website/docs/user-guide/configuration.md
@@ -1361,6 +1361,11 @@ If you do not want Hermes to auto-generate titles after the first exchange, set
`auxiliary.title_generation.enabled: false`. Manual titles still work through
`/title` and `hermes sessions rename`.
+To keep the instant derived title (the first line of your opening message) but never
+spend a model call upgrading it, set `auxiliary.title_generation.model_upgrade_enabled: false`.
+No background `auto-title` thread starts and no title-model request is sent; `enabled: false`
+still disables both stages.
+
### Stream-only endpoints
Some OpenAI-compatible endpoints reject non-streaming chat requests outright (e.g. Tencent Copilot returns HTTP 400 `"Non-stream chat request is currently not supported"`). Interactive chat already streams, but auxiliary tasks (title generation, compression, vision) use non-streaming calls and would fail on every attempt. Hermes always treats `copilot.tencent.com` as stream-only; for any other such endpoint, list a URL substring under `auxiliary.stream_only_base_urls`:
@@ -1484,6 +1489,7 @@ auxiliary:
# set e.g. "English" or "Japanese" to pin titles to one language.
title_generation:
enabled: true # set false to disable auto-title generation
+ model_upgrade_enabled: true # set false to keep the instant derived title, never call a model
provider: "auto"
model: ""
base_url: ""