Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2573,8 +2573,12 @@ async def __call__(self, event: Event) -> None:
# don't configure title_llm_profile.
conversation = self.service._conversation
title_llm = self._load_title_llm()
if title_llm is None:
title_llm = conversation.agent.llm if conversation else None
if title_llm is None and conversation is not None:
# An ACP agent's llm is inert: the conversation runs in the ACP
# subprocess under its own credentials, so agent.llm carries a
# model name with no usable key and calling it raises.
if conversation.agent.agent_kind != "acp":
title_llm = conversation.agent.llm

# Surface an LLM failure during auto-titling to the UI (issue #16686);
# generation itself stays non-fatal and falls back to truncation.
Expand Down
19 changes: 19 additions & 0 deletions tests/agent_server/test_conversation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,25 @@ async def test_autotitle_sets_title_on_first_user_message(self):
assert service.stored.title == "✨ Generated Title"
service.save_meta.assert_called_once()

@pytest.mark.asyncio
async def test_autotitle_skips_inert_acp_agent_llm(self):
"""An ACP agent's llm is inert and has no usable credentials."""
service = self._make_service()
service._conversation.agent.agent_kind = "acp"
captured: dict[str, object] = {}

def _capture(message, llm, max_length, on_error=None):
captured["llm"] = llm
return "Fix the login bug"

with patch(self._GENERATE_TITLE_PATH, side_effect=_capture):
subscriber = AutoTitleSubscriber(service=service)
await subscriber(self._user_message_event())
await self._drain_title_task(lambda: service.stored.title is not None)

assert captured["llm"] is None
assert service.stored.title == "Fix the login bug"

@pytest.mark.asyncio
async def test_autotitle_skips_non_user_events(self):
"""Non-user events do not trigger title generation.
Expand Down