The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(title): demote only the exact greeting placeholder, not prefixed topical titles
teknium196b6c534c3fc
diff --git a/agent/title_generator.py b/agent/title_generator.pyindex 40db0e82447..50dc7198f8e 100644--- a/agent/title_generator.py+++ b/agent/title_generator.py@@ -325,7 +325,7 @@ def _notify_title(title_callback: Optional[TitleCallback], title: str, source: sdef _is_provisional_greeting_title(title: str) -> bool:"""The prompt's greeting placeholder (also "Friendly greeting in chat" and quoted/bracketed variants)."""normalized = re.sub(r"^[\W_]+|[\W_]+$", "", title.strip(), flags=re.UNICODE).lower()- return normalized.startswith(_PROVISIONAL_GREETING_TITLE)+ return normalized in (_PROVISIONAL_GREETING_TITLE, _PROVISIONAL_GREETING_TITLE + " in chat")def _is_prompt_example_echo(title: str) -> bool:diff --git a/tests/agent/test_title_generator.py b/tests/agent/test_title_generator.pyindex 33105564e61..0e536874c16 100644--- a/tests/agent/test_title_generator.py+++ b/tests/agent/test_title_generator.py@@ -609,6 +609,17 @@ class TestMaybeAutoTitle:assert db.get_session_title("sess-1") == "Existing name"mock_auto.assert_not_called()+ @pytest.mark.parametrize("title, provisional", [+ ("Friendly greeting", True),+ ("'Friendly greeting in chat'", True),+ ("Friendly greeting card design", False),+ ("Friendly greetings and pleasantries", False),+ ])+ def test_only_the_exact_greeting_placeholder_is_provisional(self, title, provisional):+ """A topical title that merely starts with the phrase keeps its ``llm`` rank."""+ from agent.title_generator import _is_provisional_greeting_title+ assert _is_provisional_greeting_title(title) is provisional+def test_upgrades_a_provisional_greeting_on_a_substantive_second_turn(self, tmp_path):"""A bare "hi" opener leaves only placeholders (instant slice / the model's greeting title);the next real request must still be allowed to name the session."""@@ -642,10 +653,17 @@ class TestMaybeAutoTitle:db = SessionDB(tmp_path / "state.db")db.create_session(session_id="sess-1", source="cli")db.set_auto_title("sess-1", "hi", source="derived")- history = [{"role": "user", "content": f"turn {n}"} for n in range(4)]- with patch("agent.title_generator.auto_title_session") as mock_auto:+ history = [{"role": "user", "content": f"turn {n}"} for n in range(3)]+ with patch("agent.title_generator.auto_title_session") as mock_auto, \+ patch("agent.title_generator._auto_title_enabled", return_value=True), \+ patch("agent.title_generator._model_title_upgrade_enabled", return_value=True):maybe_auto_title(db, "sess-1", "and now the real question", history)- mock_auto.assert_not_called()+ wait_for_title_upgrades(10)+ assert mock_auto.call_count == 1 # turn 3: the placeholder still gets a model shot+ history.append({"role": "user", "content": "turn 3"})+ maybe_auto_title(db, "sess-1", "and now the real question", history)+ wait_for_title_upgrades(10)+ assert mock_auto.call_count == 1 # turn 4: capped, no calldef test_instant_title_declines_a_name_collision(self, tmp_path):"""A colliding derived title is skipped, not scanned into 'hi #2'.