feat(context): 接入 session 级 skills 注入并修正 runtime 降级语义#301
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
/code 补充测试,解决review的问题 |
|
已按本次 review 意见完成修复并补测试,代码已推送到当前 PR 分支 本次修改
验证
提交
|
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
|
/code 添加相关测试,提高测试覆盖率!!!! |
|
已按“添加相关测试,提高测试覆盖率”完成补测并推送到当前 PR 分支 本次补充测试
验证
提交
附:按 fork 推送流程同步创建了 fork 内 PR:wynxing#13 |
Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: Yumiue <188874804+Yumiue@users.noreply.github.com>
|
/review |
| EventCompactError EventType = "compact_error" | ||
| // EventTokenUsage is emitted after each provider response with token statistics. | ||
| EventTokenUsage EventType = "token_usage" | ||
| // EventSkillActivated 表示会话成功激活了一个 skill。 |
There was a problem hiding this comment.
skill_activated/skill_deactivated/skill_missing are new public runtime events, but the runtime event contract doc still lists the older set only. Please update docs/runtime-provider-event-flow.md to include these events so TUI/consumer expectations stay aligned with the actual event stream.
| UpdatedAt time.Time `json:"updated_at"` | ||
| Workdir string `json:"workdir,omitempty"` | ||
| TaskState TaskState `json:"task_state"` | ||
| ActivatedSkills []SkillActivation `json:"activated_skills,omitempty"` |
There was a problem hiding this comment.
Session now persists activated_skills, but docs/session-persistence-design.md does not mention this field in the persisted model. Please update the session schema documentation to reflect the new durable field and its semantics.
| func (s *Service) prepareTurnSnapshot(ctx context.Context, state *runState) (turnSnapshot, bool, error) { | ||
| cfg := s.configManager.Get() | ||
| activeWorkdir := agentsession.EffectiveWorkdir(state.session.Workdir, cfg.Workdir) | ||
| activeSkills, err := s.resolveActiveSkills(ctx, state) |
There was a problem hiding this comment.
This run path now resolves active skills and injects them into context.BuildInput.ActiveSkills, but the context-flow doc still describes builder inputs/section ordering without a Skills section. Please update docs/runtime-provider-event-flow.md accordingly.
|
/simplify |
Result已按触发指令完成处理并推送到当前 PR 分支。 What I changed
Simplify pass
Validation
Commit & push
Note
|
背景
关联 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