Dynamically registered extension slash commands show `unknown command` even when they execute successfully
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 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