bug: #4437 后续——项目 Skill 首轮输入置灰且文案与事实相反,/skill: 补全不覆盖项目技能
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 环境
- Cindy 0.1.79(Windows 安装版)、内置 pi 0.84.4、main `8736726`(含 #4437,本机 2026-09-15 16:26 打包)
- 仓库为本地 git 仓库,根目录含 `.pi/skills/software-factory-workflow/SKILL.md`(合法 frontmatter)
- 未使用 `--approve`、未读项目 settings;项目资源由 #4437 的 `--skill` / `--prompt-template` 原路径加载
## 问题 A:首条输入时项目 Skill 被置灰,且提示文案与事实相反(一轮对话后自愈)
复现:
1. 新任务(或历史任务重开)打开该仓库;在**发送任何消息之前**调出命令面板找项目 Skill(按其技能名,如 `/software-factory-workflow`)。
2. 该条目置灰,悬停/点按显示固定文案:**“当前 Pi 任务尚未加载此项目 Skill,新任务会自动尝试加载”**(key:`commandPalette.projectSkillNotLoaded`)。
3. 任意发送一轮对话后,再次打开面板:同一条目不再置灰、可选择调用。
期望:既然 #4437 在任务启动时已把项目资源交给 pi,首条输入时就应可用(至少不应给出与事实相反的“未加载”提示)。
实测证据:
- 该任务 pi 进程启动参数已含 `--skill \.pi\skills\software-factory-workflow`(资源确已加载)。
- 以相同参数直接起 pi 0.84.4 RPC 实测 `get_commands`,返回:
`{"name":"skill:software-factory-workflow","source":"skill","sourceInfo":{"scope":"project",...}}`
机制定位(0.1.79 app.asar):
- 置灰谓词 `Wr()`:`kind==="agent-skill" && ((scope==="repo" && runtimeStatus==="discovered") || runtimeStatus==="unknown" || runtimeStatus==="failed")`。
- 升为 loaded 依赖 `mergePiRuntimeSkillStatuses()`:需 runtime capabilities `status==="loaded"`,且 `projectResources.loadedSkills` 条目通过磁盘指纹比对(snapshotDigest / sourceFingerprint / canonicalRepoRoot)并与 runtime `commands` 中的 `skill:` 对上。该确认数据在首轮运行时交互之前拿不到 → 面板先按扫描态 `discovered` 处理。
- 文案是固定 key,未区分“尚未确认”与“确实未加载”。
## 问题 B:`/skill:` 前缀补全不覆盖项目技能
- 输入 `/skill:` 时补全只列全局技能(如 `~/.agents/skills`);项目 Skill 只能按**技能名**命中(如 `/software-factory-workflow`),与全局技能 `/skill:` 的用法不一致。
- 代码位置:`listPiRuntimePaletteCommands()` 显式排除运行期技能命令(`!name.startsWith("skill:")`);技能补全项的 `name` 是技能名、`runtimeCommandName` 才是 `skill:`;输入补全匹配(`Uy()`)只看 `name`。
- 期望:项目 Skill 确认 loaded 后也能用 `/skill:` 命中;或至少在 UI/文档中明示项目 Skill 的触发名与全局技能不同。
## 影响
- 用户被提示“未加载”(与事实相反),且首轮内找不到调用入口;对照 #4237 的验收标准“不可用提示与实际状态一致”,当前不满足。
- #4437 自述未做 Windows 安装包实机点命令面板验证——本报告即该盲区的实测补充。
## 复现参考
- `Get-CimInstance Win32_Process -Filter "Name='pi.exe'" | Select CommandLine` → 确认 `--skill` 已传入。
- 同参数起 `pi.exe --mode rpc`,发 `{"type":"get_commands","id":1}` → 确认 `skill:`(`scope: project`)存在。
(附加信息:Windows 11 中文环境;安装版 0.1.79;同一现象在历史会话与新会话均可复现,且均为“首轮置灰、一轮后恢复”。)
Contributor guide
Research direction
Trace the command-palette paths around Wr(), mergePiRuntimeSkillStatuses(), listPiRuntimePaletteCommands(), and Uy(), using the app.asar locations described in the report as the starting point. Verify the initial runtime state and project-skill command naming before changing behavior. Done means the first-turn palette state matches the loaded runtime and project skills can be reached through the intended /skill: completion path, with messaging consistent with the actual state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100