Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Custom agents in the Chat mode picker dropdown were displayed in Map insertion order rather than alphabetically. Fresh repository clones showed alphabetical ordering due to cache loading behavior, while incremental additions preserved insertion order.

Changes

  • modePickerActionItem.ts: Sort both customBuiltinModeActions and customModeActions arrays alphabetically using localeCompare() after mapping
    • Applied to custom agents considered built-in (line 121)
    • Applied to regular custom agents (lines 123-124)
const customBuiltinModeActions = customModes.builtin?.map(mode => {
    const action = makeActionFromCustomMode(mode, currentMode);
    action.category = agentModeDisabledViaPolicy ? policyDisabledCategory : builtInCategory;
    return action;
}) ?? [];
customBuiltinModeActions.sort((a, b) => a.label.localeCompare(b.label));

const customModeActions = customModes.custom?.map(mode => makeActionFromCustomMode(mode, currentMode)) ?? [];
customModeActions.sort((a, b) => a.label.localeCompare(b.label));

Agents now display alphabetically regardless of creation order.

Original prompt

This section details on the original issue you should resolve

<issue_title>Custom agents not ordered alphabetically in agent dropdown unless in a new/clean repository</issue_title>
<issue_description>
Type: Bug

I have been authoring several custom agents for a personal project. When I was authoring the agents, I noticed that the custom agent dropdown in Copilot Chat wouldn't sort alphabetically by default. However, when I cloned the same repo down fresh, they were sorted alphabetically.

It would be great to have this sorted alphabetically, even as you're adding them to the project to make scanability of the agent names much easier.

Extension version: 0.37.2026011403
VS Code version: Code - Insiders 1.109.0-insider (Universal) (17523c0, 2026-01-14T10:29:51.420Z)
OS version: Darwin arm64 25.2.0
Modes:

Image

Image</issue_description>

<agent_instructions>The change will be here:

</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI changed the title [WIP] Fix custom agents sorting in dropdown menu Sort custom agents alphabetically in mode picker dropdown Jan 16, 2026
Copilot AI requested a review from aeschli January 16, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom agents not ordered alphabetically in agent dropdown unless in a new/clean repository

2 participants