fix: Consistent agent display names across UI #1064
Open
Akhileswara-Microsoft wants to merge 3 commits into
Open
fix: Consistent agent display names across UI #1064Akhileswara-Microsoft wants to merge 3 commits into
Akhileswara-Microsoft wants to merge 3 commits into
Conversation
Add format_agent_display_name() utility that converts raw agent IDs (e.g. 'HRHelperAgent', 'hr_helper_agent') to human-readable names (e.g. 'HR Helper Agent'). Applied to all WebSocket agent_name payloads and markdown headers in the streaming buffer. Fixes inconsistent naming where agents showed as 'HRHelperAgent' in AI Thinking but 'HR Helper Agent' in message headers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes agent display-name formatting in the backend so that agent names shown in streaming headers, messages, and tool-call updates are consistently human-readable and aligned with frontend naming conventions.
Changes:
- Added
format_agent_display_name()insrc/backend/callbacks/response_handlers.py. - Updated agent message callbacks to emit formatted
agent_namevalues for both final and streaming payloads. - Updated orchestration streaming headers to use the shared formatting utility.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/backend/orchestration/orchestration_manager.py | Uses the shared formatter for per-agent streaming section headers and sets the streamed agent_name to the formatted display value. |
| src/backend/callbacks/response_handlers.py | Introduces format_agent_display_name() and applies it to final/streaming agent messages and tool-call messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Akhileswara-Microsoft
left a comment
Contributor
Author
There was a problem hiding this comment.
All 5 Copilot review comments addressed in commit 2be207c:
- str.replace substring bug - Replaced with word-boundary regex
e.sub(r'\b...\b', ...). Added test verifying \HabitAgent\ -> \Habit Agent\ (not \HabIT Agent). - Inaccurate comment - Updated to \HelperAgent -> Helper Agent\ matching actual regex behavior.
- Missing unit tests - Added 11 tests in \TestFormatAgentDisplayName\ (empty/None, PascalCase, snake_case, acronyms, word-boundary safety, etc.).
- Breaking existing tests - Updated all assertions: \TestAgent\ -> \Test Agent, \�gent_123\ -> \Agent 123. 52 tests pass.
- Docstring mismatch - Updated to clarify function does NOT strip 'Agent' suffix (frontend handles that separately).
1f597d2 to
2be207c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces a utility function to consistently format agent display names across the backend, ensuring that agent names are human-readable and match frontend conventions. The new formatting logic is applied throughout agent response handling and orchestration, replacing ad-hoc string manipulation with a centralized approach.
Agent Display Name Formatting Improvements:
format_agent_display_nametoresponse_handlers.py, converting raw agent IDs (likeHRHelperAgentorhr_helper_agent) into human-readable names (like "HR Helper Agent"), mirroring frontend logic for consistency.agent_response_callbackandstreaming_agent_response_callbackto useformat_agent_display_name, ensuring all agent names in responses and streaming updates are properly formatted.Orchestration Consistency:
_process_event_streaminorchestration_manager.pyto useformat_agent_display_namefor agent headers and streaming messages, replacing previous underscore-to-space logic.Imports and Code Organization:
format_agent_display_nameinorchestration_manager.pyto support the new formatting logic.Does this introduce a breaking change?
What to Check
This pull request introduces a utility function to standardize the formatting of agent display names across the backend, ensuring consistency with the frontend's naming conventions. The new function is integrated into several response handling and orchestration flows, so agent names are now presented in a more human-readable format throughout the application.
Key changes:
Agent display name formatting:
format_agent_display_namefunction toresponse_handlers.pythat converts raw agent identifiers (e.g.,HRHelperAgent,hr_helper_agent) into human-readable display names (e.g.,HR Helper Agent). This mirrors frontend logic for consistency.agent_response_callbackandstreaming_agent_response_callbackto useformat_agent_display_namewhen setting agent names, ensuring all agent messages and tool calls display formatted names.Orchestration integration:
format_agent_display_nameinorchestration_manager.pyto format agent names in streaming event headers and message payloads, replacing previous ad-hoc formatting.Other Information
This pull request introduces a utility function to standardize the formatting of agent display names, ensuring consistency across backend and frontend components. The function is integrated into multiple places where agent names are shown to users, replacing previous ad-hoc formatting logic.
Key changes include:
Agent Display Name Formatting:
format_agent_display_namefunction insrc/backend/callbacks/response_handlers.pyto convert raw agent IDs (e.g.,hr_helper_agent,HRHelperAgent) into human-readable display names (e.g., "HR Helper Agent"), mirroring frontend logic for consistent naming.Integration of Formatting Utility:
Updated
agent_response_callbackandstreaming_agent_response_callbackinsrc/backend/callbacks/response_handlers.pyto useformat_agent_display_namewhen rendering agent names, ensuring all agent messages display standardized names.Modified
_process_event_streaminsrc/backend/orchestration/orchestration_manager.pyto useformat_agent_display_namefor agent section headers and streaming messages, replacing previous underscore-based formatting.Updated imports in
src/backend/orchestration/orchestration_manager.pyto include the new formatting function.