skills: a Claude-compatible SKILL.md that fails to parse is dropped without any log

未关闭 适合新手
#66,970 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
tooling

调研方向

修复应放在 packages/core/src/config/plugin/compatibility.ts 中兼容性加载器的 if (parsed._tag === "Parsed") 分支里,该分支目前会静默丢弃 Skipped 结果。请阅读 agent.ts(约第 153 和 175 行)和 command.ts(约第 142 和 150 行)如何记录存在但无法使用的文件,并保持相同的写法。完成标准是:警告中包含 markdown 和 frontmatter 跳过情况下的文件名和原因,并且有测试确认该消息会出现。

由索引模型根据 Issue 内容生成。

描述

area/plugins platform/linux reproduced type/bug version/v2

Summary

The compatibility loader reads SKILL.md files from Claude and agent skill roots (packages/core/src/config/plugin/compatibility.ts). When SkillFile.parse returns Skipped, the file is simply not added to the loaded map:

const parsed = SkillFile.parse(resolved, filepath, content)
if (parsed._tag === "Parsed") loaded.set(parsed.skill.id, parsed.skill)

There is no log call on the other branch, so a skill that exists but cannot be parsed disappears without a trace at every log level, including DEBUG. The model then works without instructions the user believes are loaded.

This is the same symptom as #66716, which covers the native skill loader (skill.ts, which logs the skip at logDebug). This loader is the only one of the three that reports nothing at all.

Environment

  • opencode version: 2.4.2, and dev at 2204311e
  • Client: TUI / shared service
  • Model and provider: Not relevant
  • OS: Linux 6.x x86_64
  • Terminal: xterm-kitty, truecolor
  • Shell: /bin/bash
  • Install/channel: latest (release)
  • Active plugins: none related

Reproduction

  1. Create a skill under a compatibility root, for example ~/.claude/skills/repro/SKILL.md, with frontmatter that parses as YAML but does not decode into the expected shape:

    ---
    name: repro
    description: [not, a, string]
    ---
    body
    
  2. Make sure that root is part of compatibility.claude so ConfigCompatibilityPlugin scans it.

  3. Start opencode and open the skills list (/skills).

  4. The skill is absent.

  5. Search the log for the path: there is no line naming the file, at the default level or with OPENCODE_LOG_LEVEL=DEBUG.

Expected Behavior

A warning that names the file and the reason it was skipped, in the same shape the other two loaders already use for a file that exists but cannot be used (agent.ts:153/agent.ts:175, command.ts:142/command.ts:150). Both skip reasons should be reported, since both mean the file was found and then dropped.

Actual Behavior

No log output at any level; the skill is silently missing from the catalog.

Additional Context

SkillFile.parse returns { _tag: "Skipped", reason: "markdown" } when the frontmatter block cannot be read at all, and { _tag: "Skipped", reason: "frontmatter", issue } when it decodes into the wrong shape. Both are currently discarded by the if above.

主要语言
TypeScript
星标
228k
派生
31k
平均合并
5 小时 16 分钟
30 天内合并 PR
464

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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