feat(context): 接入 session 级 skills 注入并修正 runtime 降级语义#305
Merged
Conversation
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
test: add coverage for skill session/runtime/context branches
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
|
||
| // renderActiveSkillsSection 负责去重、排序并渲染激活 skills 的结构化提示文本。 | ||
| func renderActiveSkillsSection(activeSkills []skills.Skill) string { | ||
| normalized := normalizeActiveSkills(activeSkills) |
Contributor
There was a problem hiding this comment.
renderActiveSkillsSection 会再次做去重+排序;而上游 Session.ActiveSkillIDs() 已经返回了规范化且稳定排序的 ID。当前实现是安全的,但每轮构建上下文都会额外产生一次 O(n log n) 和 map/slice 分配。若后续会引入较多激活 skills,可考虑在 runtime 侧保证有序唯一后,这里只做轻量遍历渲染。
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
关联 issue: #258
当前仓库里
skills已有基础 loader/registry 能力,但还没有真正进入主链路。本次改动将
session + runtime + context + bootstrap串起来,让 session 级 skill 激活、运行时解析以及 prompt 注入真正生效,并补齐对应测试。主要修改
1. Session
ActivatedSkills []SkillActivation持久化字段ActivateSkill、DeactivateSkill、ActiveSkillIDs2. Runtime
skills.RegistryActivateSessionSkill、DeactivateSessionSkill、ListSessionSkillsprepareTurnSnapshot()在构建上下文前解析当前 session 激活的 skills,并传入 context builderskill_activatedskill_deactivatedskill_missing3. Context
BuildInput增加ActiveSkills []skills.SkillSkillsprompt section4. Bootstrap
~/.neocode/skills初始化本地 skills registryregistry unavailable5. 降级与错误语义修正
skills.ErrSkillNotFound做skill_missing软降级验证
已通过:
go test ./internal/skillsgo test ./internal/runtimego test ./internal/appgo test ./internal/sessiongo test ./internal/contextgo test ./internal/tui/...影响
skill_missing