fix(delegate): title subagent sessions after their goal without a model call

This commit is contained in:
Hermes Agent
2026-09-24 23:48:13 -05:00
committed by brooklyn!
parent 2e43498413
commit b90b7ae7ed
3 changed files with 44 additions and 5 deletions

View File

@@ -606,6 +606,18 @@ def _persist_session_title(session_db, session_id, title, *, source, dedupe=True
return _set(deduped)
def apply_subagent_title(session_db, session_id: str, goal: str) -> Optional[str]:
"""Title a delegate run ``Subagent: <goal's first line>`` at ``derived`` authority. No model call:
runs fan out in bulk, and the prefix alone is what tells them apart from conversations wherever
``sessions.show_subagents`` lists them (#97202). Collisions get ``#N``. Never raises."""
try:
derived = derive_title(goal) if is_titleable_user_message(goal) else None
return _persist_session_title(session_db, session_id, f"Subagent: {derived}", source="derived") if derived else None
except Exception:
logger.debug("Subagent title failed for %s", session_id, exc_info=True)
return None
def apply_instant_title(
session_db, session_id: str, user_message: str, title_callback: Optional[TitleCallback] = None,
title_preview: str | None = None,