Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions agent/skills/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,22 @@ func (p *providerState) loadSkills(ctx context.Context) ([]*Skill, error) {
if p.options.DisableSourceDeduplication {
return loaded, nil
}
seen := make(map[string]struct{}, len(loaded))
deduplicated := loaded[:0]
for _, skill := range loaded {
return deduplicateSkillsByName(loaded, p.logger), nil
}

func deduplicateSkillsByName(skills []*Skill, logger *slog.Logger) []*Skill {
seen := make(map[string]struct{}, len(skills))
deduplicated := skills[:0]
for _, skill := range skills {
resolvedKey := strings.ToLower(skill.Frontmatter.Name)
if _, ok := seen[resolvedKey]; ok {
p.logger.Warn("Duplicate skill name: subsequent skill skipped in favor of first occurrence", "skillName", skill.Frontmatter.Name)
logger.Warn("Duplicate skill name: subsequent skill skipped in favor of first occurrence", "skillName", skill.Frontmatter.Name)
continue
}
seen[resolvedKey] = struct{}{}
deduplicated = append(deduplicated, skill)
}
return deduplicated, nil
return deduplicated
}

func indexSkills(skills []*Skill) providedSkillSet {
Expand Down
Loading