From d1eb9766536db8dd8cd07efc8761c03c2851c20e Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Fri, 29 May 2026 13:23:29 +0700 Subject: [PATCH] Fix duplicate /clear in the slash command menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A client command and a provider command can share a name (e.g. clear). Both produced the same option id, which became a duplicate React key — React then left stale rows and scrambled ordering, so /clear showed twice and ranking broke as the query narrowed. Drop the colliding provider command and keep the client one, which has extra affordances. --- packages/app/src/hooks/use-agent-autocomplete.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app/src/hooks/use-agent-autocomplete.ts b/packages/app/src/hooks/use-agent-autocomplete.ts index 5b82b1f3e..0e005da41 100644 --- a/packages/app/src/hooks/use-agent-autocomplete.ts +++ b/packages/app/src/hooks/use-agent-autocomplete.ts @@ -318,13 +318,14 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut const providerCommands = commands.map( (command): AvailableCommand => ({ source: "provider", command }), ); + const clientCommandNames = new Set(CLIENT_SLASH_COMMANDS.map((command) => command.name)); const availableCommands: AvailableCommand[] = isDraftContext ? providerCommands : [ ...CLIENT_SLASH_COMMANDS.map( (command): AvailableCommand => ({ source: "client", command }), ), - ...providerCommands, + ...providerCommands.filter((entry) => !clientCommandNames.has(entry.command.name)), ]; const matches = filterAndRankCommandAutocompleteEntries( availableCommands,