github / github/copilot-cli

Plugin skills installed by sessionStart hooks are not available in the current session

未关闭
#1,855 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:installation area:plugins area:sessions
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

# Plugin skills installed by sessionStart hooks are not available in the current session

---

## Description

When a sessionStart hook installs plugins via copilot plugin install, the installed plugin skills are never made available to the current session. /skills reload does not pick them up either.

## Steps to Reproduce

1. Create .github/hooks/hooks.json with a sessionStart hook that installs plugins:
```json
{
"version": 1,
"hooks": {
"sessionStart": [{
"type": "command",
"bash": "copilot plugin marketplace add owner/repo; copilot plugin install my-plugin@my-marketplace",
"cwd": ".",
"timeoutSec": 120
}]
}
}
```
2. Start a new copilot session and send a message
3. Hook logs confirm success: Plugin "my-plugin" installed successfully. Installed 4 skills.
4. Run /skills reload
5. Observe: plugin_skill_count: 0 — no plugin skills are loaded

## Root Cause

- Skills are loaded **eagerly at process startup** (e.g. skills_loaded at 18:36:32)
- sessionStart hooks fire **lazily on the first user message** (e.g. 18:37:24)
- The hook successfully installs plugins and updates config.json (with nabled: true)
- Plugin skill files exist on disk at ~/.copilot/installed-plugins/ with valid SKILL.md files
- But the running CLI process never re-reads the plugin configuration
- /skills reload re-scans project/personal skills but does **not** re-read installed_plugins from config.json

## Expected Behavior

After sessionStart hooks complete, newly installed plugin skills should be available in the current session. At minimum, /skills reload should re-read installed_plugins from config.json.

## Suggested Fix

Either:
1. **Automatically re-scan plugins/skills after sessionStart hooks complete** — hooks exist precisely for session setup like installing plugins
2. **Have /skills reload also re-read installed_plugins from config.json** and load newly added plugin skills
3. **Defer skills loading until after sessionStart hooks have completed** (may impact perceived startup latency)

## Workaround

Start a second session after the first one. Since the plugins are now in config.json, they will be discovered at process startup in subsequent sessions.

## Environment

- Copilot CLI: 0.0.422-1
- OS: Windows 11
- Node.js: v24.11.1

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。