Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Slash commands from chatSessions contributed chat participants (e.g., @claude) were appearing in the global chat completion menu, even when not actively talking with that participant.

Changes

  • Filter out chatSessions-contributed agents ahead of time using chatSessionsService.getChatSessionContribution(agent.id) in chatInputCompletions.ts
  • Added IChatSessionsService dependency injection to AgentCompletions class
  • Affects two completion providers:
    • @ trigger (shows @agent /command)
    • / trigger (shows /command @agent)
  • Does not affect the chatAgentSubcommand provider—once a user selects @claude, their slash commands still appear as expected
// Filter out chatSessions contributions for slash command completions
const agentsForSlashCommands = agents.filter(a => !this.chatSessionsService.getChatSessionContribution(a.id));
Original prompt

This section details on the original issue you should resolve

<issue_title>@claude slash commands show in local chat window</issue_title>
<issue_description>Image

I know there is a fake participant and we might need some new concept of how the claude agent gets plugged in. cc @joshspicer or whoever owns the infra</issue_description>

<agent_instructions>For a 'chatSessions' contributed chat particpant (anything that uses the chat sessions contribution point to register a chat participant) we should not show slash commands in the menu unless you're actively talking with that participant</agent_instructions>

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

@TylerLeonhardt @roblourens these are defined here:

https://github.com/microsoft/vscode-copilot-chat/blob/70e69675306a883f990e0579def19ffd2873b426/package.json#L5020-L5041

for these particular chat sessions. I would not expect these to bleed to others... seems like a platform bug.</comment_new>
<comment_new>@joshspicer
This isn't correct in general? Selected one of those options will place @claude /command. @claude is a valid way to start a claude session, so there could be some cases where /command makes sense on the initial request

Seems like this should maybe be configurable? Compact certainly doesn't make sense for a new chat :D

(sorry, new gh keybinding or something and I accidentally closed)</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

For chatSessions contributed chat participants (isDynamic agents), we now
hide their slash commands from the global menu unless the user is actively
talking with that participant. The agent itself can still be selected via
@mention, and once selected, their slash commands will be available.

Co-authored-by: joshspicer <[email protected]>
Copilot AI changed the title [WIP] Hide slash commands in local chat menu Hide slash commands from chatSessions participants in global chat menu Jan 16, 2026
@joshspicer
Copy link
Member

@copilot 'isDynamic' is a bit too broad - we instead need to check if it's a chatSessions contribution with one of the chatSessions helpers

Changed from using agent.isDynamic to using
chatSessionsService.getChatSessionContribution(agent.id) to specifically
check for chatSessions contributions rather than filtering all dynamic
agents.

Co-authored-by: joshspicer <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 16, 2026

@copilot 'isDynamic' is a bit too broad - we instead need to check if it's a chatSessions contribution with one of the chatSessions helpers

Updated in 6f66616 to use chatSessionsService.getChatSessionContribution(agent.id) instead of checking isDynamic. This specifically targets chatSessions contributions rather than all dynamic agents.

@joshspicer
Copy link
Member

@copilot seems like it may be more efficient to filter out the relevant chatSession-contrbuted agents ahead of time? What do you think?

Moved the chatSessions contribution check to filter agents upfront
rather than checking inside each flatMap iteration. This is more
efficient as it avoids calling getChatSessionContribution multiple
times for each agent's slash commands.

Co-authored-by: joshspicer <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 17, 2026

@copilot seems like it may be more efficient to filter out the relevant chatSession-contrbuted agents ahead of time? What do you think?

Good suggestion. In 47fc606 I moved the filtering to happen upfront rather than inside the flatMap loop. This avoids calling getChatSessionContribution multiple times for each agent's slash commands.

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.

@claude slash commands show in local chat window

2 participants