Skip to content

fix(agent-core-v2): watch explicit skill directories - #4766

Merged
7Sageer merged 3 commits into
MoonshotAI:mainfrom
pvzheroes125:fix/explicit-skill-root-watch
Nov 9, 2026
Merged

7Sageer merged 3 commits into
MoonshotAI:mainfrom
pvzheroes125:fix/explicit-skill-root-watch

Conversation

@pvzheroes125

@pvzheroes125 pvzheroes125 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Requirement or Bug

通过 --skills-dir 或 Core 启动选项指定技能目录后,运行中的会话需要自动发现新写入的技能。目录通过软链接或 Windows junction 指定时,入口改指向也需要刷新技能目录。

Bug Reproduction Steps

  1. 使用 kimi --skills-dir /path/to/skills 启动会话。
  2. 在普通技能目录下新建一个包含 SKILL.md 的目录,观察已加载的技能目录。
  3. 如果配置的是链接路径,将其切换到另一个目录,保留旧目标,在新目标里再新增一个技能。

Root Cause

显式技能源原先只读取文件,缺少触发重扫的事件。只监听启动时解析出的真实目录也会漏掉链接入口的变化,因为入口的替换发生在它的父目录。

Code Changes

显式技能源复用现有文件监听器。目标目录内的变更经过防抖后触发已有的目录重载流程。配置入口、指向其他位置的祖先路径和待创建的入口由各自的父目录监听。入口变化时重新解析路径,注册新目标的监听并释放旧目标的监听。

首次扫描与原生监听器的就绪分开。目标监听就绪后补扫一次,覆盖监听启动期间写入的文件。Program 负责释放该技能源持有的监听。

Behavior Changes and Affected Users

行为 改动前 改动后 受影响的用户 关闭方式
显式技能目录中的文件变化 已加载会话需要重载才会发现 文件变更触发技能目录刷新 通过 --skills-dir 或 Core 启动选项指定本地技能目录的用户 使用现有 watch 开关
显式技能目录的链接入口创建或改指向 已加载会话需要重载才会发现新目标 重新解析入口并刷新新目标的技能目录 显式配置目录软链接或 junction 的用户 使用现有 watch 开关

macOS 定向验证覆盖普通目录写入、原生监听就绪后的补扫、根链接和祖先链接改指向,以及启动后创建链接。四组相关测试 68 项通过、1 项跳过。Core v2 类型检查、生产文件 lint 和 git diff --check 通过。

Windows 11(10.0.26300,NTFS,Node v24.15.0)在独立工作树上复跑当前提交 0be7bf75a,实测通过 4 项,覆盖普通目录写入、根 junction 改指向、祖先 junction 改指向和启动后创建 junction。两项改指向测试保留了旧目标,并验证切换后在新目标中新增技能也会刷新。以同一测试对照初版 0d6d63969 时,两个改指向场景均未刷新。

技能目录内部的外部链接,以及悬空链接的目标后来出现,仍可能需要手动刷新。

Checklist

  • I have read the CONTRIBUTING document.
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Refresh loaded skill catalogs when explicitly configured directories change. Keep initial discovery independent of native watcher readiness.
@changeset-bot

changeset-bot Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0be7bf7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:34:37.843704Z 0be7bf7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@0be7bf7
npx https://pkg.pr.new/@moonshot-ai/kimi-code@0be7bf7

commit: 0be7bf7

sailist
sailist previously approved these changes Nov 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d6d639697

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@pvzheroes125
pvzheroes125 force-pushed the fix/explicit-skill-root-watch branch from e32837b to 3ea536c Compare November 9, 2026 13:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ea536cc8e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@7Sageer
7Sageer merged commit adc46cc into MoonshotAI:main Nov 9, 2026
17 checks passed
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.

3 participants