github / github/copilot-cli

Dynamically registered extension slash commands show `unknown command` even when they execute successfully

オープン
#2,674 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:plugins
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

## Summary

When an extension adds a slash command dynamically after session startup, Copilot CLI can show an `unknown command` error in the UI even though the command still executes successfully in the extension.

This looks like the local slash-command validation path is out of sync with the dynamically registered command list.

## Environment

- Copilot CLI: 1.0.25
- OS: Windows

## Reproduction

I reproduced this with a Telegram bridge extension that:

1. joins the session with `joinSession(...)`
2. then registers `/telegram` afterward via a follow-up `session.resume` request with a `commands` payload
3. handles the command through the extension command event path

Relevant pattern in the extension:

```js
await sess.connection.sendRequest("session.resume", {
sessionId: sess.sessionId,
commands: [{ name: "telegram", description: "Telegram bridge" }],
hooks: true,
});

sess.on("command.execute", (event) => {
const { requestId, commandName, args } = event.data;
if (commandName !== "telegram") return;
// handle command...
});
```

Then in Copilot CLI:

1. start the CLI with the extension loaded
2. run `/telegram`

## Actual behavior

Copilot CLI displays an `unknown command` style error, but the extension still receives and executes the command correctly.

So the command both:
- appears unknown in the UI
- and still works as intended

## Expected behavior

One of these should happen consistently:

1. the command is recognized normally with no error, or
2. if dynamically added commands are not supported in this way, the command should not execute either

## Notes

This seems related to extension commands being added after startup rather than being available in the initial command set.

In this case, the extension uses `session.resume` because `joinSession(...)` does not expose a direct way to provide slash commands up front.

That makes this look like either:
- a bug in Copilot CLI command discovery/validation for extension-added commands, or
- a gap in the extension API contract around dynamic slash-command registration.

If helpful, I can provide a reduced repro extension.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ソースファイルもテストも指定されていません。まず、CLI の slash-command のローカル検証と、session.resume commands payload が登録済みコマンドの一覧をどのように更新するかを追跡し、その後 Telegram bridge パターンで問題を再現してください。動的に登録されたコマンドが UI エラーなしで認識されるか、実行時の挙動と一貫した形で拒否されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, shell
領域
api, cli, developer-experience
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。