@@ -569,7 +569,11 @@ def _resolve_agent_name(self, coder_uuid: str | None) -> str | None:
569569 """Resolve an agent display name from a coder_uuid.
570570
571571 Returns the sub-agent's name if the coder_uuid belongs to a known
572- sub-agent, otherwise None (primary agent uses no prefix).
572+ sub-agent. For the primary agent, returns "primary" if sub-agents
573+ exist, otherwise None.
574+
575+ If multiple sub-agents share the same name, disambiguates by
576+ appending the first 3 characters of the UUID in parentheses.
573577 """
574578 if not coder_uuid :
575579 return None
@@ -584,6 +588,15 @@ def _resolve_agent_name(self, coder_uuid: str | None) -> str | None:
584588 return None # Primary agent gets no prefix
585589 for info in agent_service .sub_agents .values ():
586590 if str (info .coder .uuid ) == coder_uuid :
591+ # Check for duplicate names among sub-agents
592+ name_count = sum (
593+ 1 for i in agent_service .sub_agents .values ()
594+ if i .name == info .name
595+ )
596+ if name_count > 1 :
597+ # Disambiguate with first 3 UUID characters
598+ short_uuid = str (info .coder .uuid )[:3 ]
599+ return f"{ info .name } ({ short_uuid } )"
587600 return info .name
588601 except (AttributeError , ImportError , KeyError ):
589602 # Agent service not available or coder not yet initialized
@@ -809,7 +822,7 @@ def on_input_area_submit(self, message: InputArea.Submit):
809822
810823 # Update footer to show processing
811824 footer = self .query_one (MainFooter )
812-
825+
813826 coder = self .worker .coder
814827 # Determine which coder is in the foreground for input routing
815828 foreground_coder = AgentService .get_instance (coder ).foreground_coder
0 commit comments