feat: Enhance command handling and completion for runtime commands#322976
Merged
Conversation
- Updated `MockCopilotSession` to include aliases and input hints for commands. - Modified command invocation logic to support trailing text as input for commands like `/env` and `/review`. - Improved slash command parsing to retain raw input for better handling of multiline commands. - Enhanced completion provider to include runtime command descriptions and hints in completion items. - Added tests for new command behaviors and completion scenarios, ensuring robust handling of runtime commands. - Updated `AgentHostInputCompletionHandler` to provide detailed command descriptions in completion suggestions.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances Copilot CLI runtime slash-command handling end-to-end in the agent host: it broadens slash-command parsing (including preserving raw trailing input), routes more commands through the runtime commands API (with alias + input forwarding), and improves completion items to surface richer command metadata.
Changes:
- Extend slash-command parsing to accept arbitrary
/tokencommands and preserve both trimmedrestand untrimmedrawRest(including multiline). - Fetch and cache a runtime command catalog (names + aliases + input hints), use it for both invocation routing and completion suggestions.
- Improve UI-side completion rendering to show descriptions in the label/documentation, and add/update unit tests for the new behaviors.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/chat/browser/agentHostInputCompletions.ts | Enriches command completion items with label descriptions and documentation derived from attachment metadata. |
| src/vs/platform/agentHost/test/node/copilotSlashCommandCompletionProvider.test.ts | Updates parsing + completion tests for arbitrary tokens, rawRest preservation, aliases, and hinted completions. |
| src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts | Adds coverage for forwarding trailing input to runtime commands and runtime-command vs. fallback send behavior. |
| src/vs/platform/agentHost/node/copilot/copilotSlashCommandCompletionProvider.ts | Switches completion source to runtime command listing (including aliases/hints) and broadens slash-command parsing. |
| src/vs/platform/agentHost/node/copilot/copilotSessionWrapper.ts | Exposes a new commands.changed SDK event to support invalidating cached runtime command metadata. |
| src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts | Routes more slash commands via runtime commands.invoke, forwards raw input, and replaces TTL-based cache with event-driven invalidation. |
| src/vs/platform/agentHost/node/copilot/copilotAgent.ts | Wires runtime command listing into the completion provider and introduces a wait timeout parameter for command discovery. |
Copilot's findings
- Files reviewed: 7/7 changed files
- Comments generated: 5
dmitrivMS
approved these changes
Jun 25, 2026
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.
MockCopilotSessionto include aliases and input hints for commands./envand/review.AgentHostInputCompletionHandlerto provide detailed command descriptions in completion suggestions.