Skip to content

fix(skill): NDR Alert Analysis Hub 更新永远 422(read-only shadow) / Hub update permanently blocked by duplicate skill - #781

Open
WenhuaXia wants to merge 1 commit into
AgentFlocks:mainfrom
WenhuaXia:fix/ndr-skill-duplicate
Open

WenhuaXia wants to merge 1 commit into
AgentFlocks:mainfrom
WenhuaXia:fix/ndr-skill-duplicate

Conversation

@WenhuaXia

Copy link
Copy Markdown

问题描述 / Bug Description

在 Hub 页面点击 NDR Alert Analysis「更新」,永远失败:

POST /api/hub/plugins/skill/ndr-alert-analysis/update → 422
Skill 'ndr-alert-analysis' is read-only; installation cannot replace or shadow it

根因 / Root Cause

PR #775 (v2026.9.23) 把同一个 skill 打包进了两个位置:

副本 路径 内容
系统包版 .flocks/plugins/skills/ndr-alert-analysis/SKILL.md 380 行,裸文件,无 manifest
官方 Hub 包 .flocks/flockshub/plugins/skills/ndr-alert-analysis/ 29 行 + manifest.json (v1.0.0) + references/ + scripts/ + templates/,trust: official

Skill._discover() 只扫描前者的路径(plugins/skills/),不扫描 flockshub/(Hub 是安装源,不是发现源)。因此:

  1. 运行时生效的是 380 行版,is_system_shipped=True → is_readonly=True
  2. Hub「更新」调用 install_plugin → preserve_install_group 写前守卫重新 _discover → 发现 ndr-alert-analysis 已存在且 readonly → 422
  3. 只要 380 行版存在,Hub 更新永远不可能成功

修复 / Fix

删除 380 行裸文件,保留官方 Hub 包作为唯一来源。

  • 380 行版的完整内容已备份(本 PR 删除前已提交至 git 历史,git show dde8faa:.flocks/plugins/skills/ndr-alert-analysis/SKILL.md 可找回)
  • 删除后 Hub 安装/更新链路恢复正常
  • 29 行官方版 + references/scripts/templates 是上游维护的正式包,380 行版应作为内容贡献反馈给上游合并

验证 / Verification

1. 删除后 install_plugin('skill', 'ndr-alert-analysis', scope='global')
   → INSTALL OK, version=1.0.0, installPath=~/.flocks/plugins/skills/ndr-alert-analysis

2. Skill._discover() →
   location: ~/.flocks/plugins/skills/ndr-alert-analysis/SKILL.md
   source: user | native: False | readonly: False  ← 可更新、可编辑

3. installed.json 记录:
   skill:ndr-alert-analysis → v1.0.0, source=bundled:.flocks/flockshub/...

4. 文件完整性: 29 行官方版 + references/ + scripts/ + templates/ 均在

风险评估 / Risk Assessment

Low — 删除的是一个与官方 Hub 包同名的遗留裸文件。官方 Hub 包(29 行 + manifest)保留且已验证可正常安装。380 行版的完整内容在 git 历史中可恢复。

….0.0)同名冲突

问题 / Problem:
Hub 页点击 NDR Alert Analysis「更新」永远 422:
  Skill 'ndr-alert-analysis' is read-only; installation cannot replace or shadow it

根因 / Root cause:
PR AgentFlocks#775 (v2026.9.23) 把同一个 skill 打包进了两个位置:
1. .flocks/plugins/skills/ndr-alert-analysis/SKILL.md     (380行 详细版)
2. .flocks/flockshub/plugins/skills/ndr-alert-analysis/   (29行 官方 hub 包 + manifest v1.0.0 + references/scripts/templates)
discovery 只扫 (1) 所在的项目级路径,(2) 是 hub 安装源不在 discovery 里。
(1) 因 is_system_shipped 命中 → readonly → preserve_install_group 永久拦截。
hub 更新想装 (2) 到 ~/.flocks/plugins/skills/ 时,守卫在 write 前重新
_discover 找到 (1),判定为 readonly,拒绝影子化。

修复 / Fix:
删除 (1) 380行裸文件。
- (2) 是官方正式 hub 包(有 manifest / references / scripts / templates),
  保留作为唯一来源,Hub 安装/更新恢复正常。
- 380行详细流程内容已固化备份到 ~/workspace/ndr-backup/,
  需要时可作为 PR 反馈给上游合并进 (2) 的 SKILL.md。

验证 / Verified:
1. rm (1) 后 install_plugin('skill','ndr-alert-analysis',scope='global')
   → INSTALL OK, v1.0.0, installPath=~/.flocks/plugins/skills/ndr-alert-analysis
2. Skill._discover():
   location=~/.flocks/plugins/skills/ndr-alert-analysis/SKILL.md
   source=user  native=False  readonly=False  (可更新可编辑)
   content: 29行官方版, has references/scripts/templates
3. installed.json: skill:ndr-alert-analysis v1.0.0 source=bundled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant