Skip to main content

generate_dispatch_name

Function generate_dispatch_name 

Source
pub(crate) async fn generate_dispatch_name(
    mstore: &Store,
    subagent_watcher: &Arc<SubagentWatcher>,
    dispatch_id: &str,
    first_member_agent_id: &str,
    class: Class,
) -> Option<Generated>
Expand description

Generate the one Haiku display name for a Workflow-kind dispatch, eagerly, the first time its first member is observed live, or for an unnamed historical dispatch via SubagentWatcher::resolve_unnamed_backlog when the Swarm pane opens (never called for a Solo dispatch — a Solo dispatch’s name IS its one member’s display_name, already covered by generate_subagent_name; never called during cold-backfill replay — see the live gate on process_jsonl_change’s trigger_eager_naming call in crates/srv/src/backend/subagent_watcher/jsonl.rs).

A workflow has no single task prompt the way a solo call does (members can have different prompts) — this reads first_member_agent_id’s own task prompt via the same read_task_prompt() generate_subagent_name uses, on the resolved design basis that the first member’s prompt is a reasonable stand-in for the whole batch (SPEC §3 — not a perfect representation of every member’s task, an accepted v1 trade-off).

Otherwise runs the same generate_name_from_task_prompt pipeline as generate_subagent_name — no cache-hit short-circuit here (unlike that function): this is only ever called once per dispatch, already guarded by naming_triggered at the call site, so a cache check would be dead code, not a real fast path.