-
Notifications
You must be signed in to change notification settings - Fork 34
Fix getAgentName to support both agent names and login names #8529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| const normalized = assignee.startsWith("@") ? assignee.slice(1) : assignee; | ||
|
|
||
| // Check if it's a known agent | ||
| return AGENT_LOGIN_NAMES[normalized] || null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot || normalized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for both agent name ("copilot") and login name ("copilot-swe-agent") recognition. The function now checks if the input is a key in the map first, then checks if it's a value (login name), returning the corresponding agent name in both cases. Commit: 7874b8e
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| // Check if it's a known agent by key (e.g., "copilot") | ||
| if (normalized in AGENT_LOGIN_NAMES) { | ||
| return normalized; | ||
| } | ||
|
|
||
| // Check if it's a known agent by login name value (e.g., "copilot-swe-agent") | ||
| for (const [agentName, loginName] of Object.entries(AGENT_LOGIN_NAMES)) { | ||
| if (loginName === normalized) { | ||
| return agentName; | ||
| } | ||
| } | ||
|
|
||
| return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot use pattern A[key] || key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified using .find() with optional chaining pattern. The implementation now uses Object.entries(A).find(([, v]) => v === normalized)?.[0] || null for cleaner code. Commit: eb39f6a
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot make it simpler, single line. |
Fix getAgentName to support both agent names and login names
Issue: https://github.com/githubnext/gh-aw/actions/runs/20647172011/job/59286360410#step:6:1
Root Cause: The
getAgentNamefunction incorrectly returned the login name value instead of the agent name key.Changes Made:
.find()with optional chaining patternImplementation Details:
The function now handles input in both formats using a concise pattern:
Supported inputs:
"copilot"→"copilot"✅"@copilot"→"copilot"✅"copilot-swe-agent"→"copilot"✅"@copilot-swe-agent"→"copilot"✅Test Results:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.