[Fix] normalize agent skill lookup and tool filtering#832
[Fix] normalize agent skill lookup and tool filtering#832dingyi222666 merged 1 commit intov1-devfrom
Conversation
Reset remote skill materialization state between reloads and make skill and sub-agent matching case-insensitive. This also aligns sub-agent tool exposure with permission checks so imported skills and delegated tools stay consistent.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
总体信息Walkthrough该PR围绕技能匹配、权限管理和远程技能物化进行优化。具体包括:引入技能物化器清理机制、实现远程技能目录重置逻辑、移除技能导入时的自动映射、将技能名称匹配改为不区分大小写,以及调整子代理工具掩码的权限处理流程。 Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~65 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces case-insensitive matching for skills and sub-agents, refactors sub-agent tool management to use permission checks instead of explicit masks, and adds a mechanism to reset remote skill directories. A review comment suggests simplifying the shell command for directory cleanup by removing redundant existence checks, as rm -rf is idempotent.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/extension-agent/src/service/skills.ts (1)
123-130:⚠️ Potential issue | 🟠 Major把物化缓存清理提前到
reload()开头。现在
materializer.clear()只会在scanSkills()/buildSkillCatalog()成功后执行。只要 reload 因坏 skill 或 I/O 错误中途抛错,旧的远端物化映射就会继续保留,后续仍可能复用陈旧状态,这和本次修复目标相反。💡 建议修改
async reload() { + this.ctx.chatluna_agent?.computer.materializer.clear() await syncBundledSkills(this.ctx) const local = await scanSkills(this.ctx, this.config) const scanned = local this._skills = new Map(scanned.map((s) => [s.id, s])) this._catalog = buildSkillCatalog(scanned, this.config.skills.items) - this.ctx.chatluna_agent?.computer.materializer.clear() this._visibleByName = new Map( this._catalog .filter((s) => s.visible) .map((s) => [s.name.toLowerCase(), this._skills.get(s.id)!]) )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/extension-agent/src/service/skills.ts` around lines 123 - 130, The materializer.clear() call should happen at the start of reload() so cached remote materializations are cleared even if syncBundledSkills/scanSkills/buildSkillCatalog fail; move the this.ctx.chatluna_agent?.computer.materializer.clear() invocation to the top of reload() (before awaiting syncBundledSkills/scanSkills) and keep the existing optional chaining to avoid null deref; ensure reload() still proceeds to call syncBundledSkills, scanSkills, buildSkillCatalog and then sets this._skills/_catalog as before.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/extension-agent/src/service/skills.ts`:
- Around line 123-130: The materializer.clear() call should happen at the start
of reload() so cached remote materializations are cleared even if
syncBundledSkills/scanSkills/buildSkillCatalog fail; move the
this.ctx.chatluna_agent?.computer.materializer.clear() invocation to the top of
reload() (before awaiting syncBundledSkills/scanSkills) and keep the existing
optional chaining to avoid null deref; ensure reload() still proceeds to call
syncBundledSkills, scanSkills, buildSkillCatalog and then sets
this._skills/_catalog as before.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9697354d-fa01-406d-b51d-f6e8b501f204
📒 Files selected for processing (6)
packages/extension-agent/src/computer/materialize.tspackages/extension-agent/src/service/index.tspackages/extension-agent/src/service/permissions.tspackages/extension-agent/src/service/skills.tspackages/extension-agent/src/service/sub_agent.tspackages/extension-agent/src/sub-agent/run.ts
description: |-
This pr fixes extension-agent skill materialization, case-insensitive skill and sub-agent resolution, and delegated tool filtering so agent reloads and handoffs stay consistent.
New Features
None.
Bug fixes
Other Changes