perf: skip redundant skill resolution when already resolved

This commit is contained in:
Greyson Lalonde
2026-03-06 01:08:03 -05:00
parent 01c1bf4bcc
commit c2eca17619

View File

@@ -299,7 +299,8 @@ class Agent(BaseAgent):
"""Resolve skill paths into loaded Skill objects.
Path entries trigger discovery and activation. Skill entries pass through.
Crew-level skill paths are merged in.
Crew-level skill paths are merged in. Skips work when all items are
already resolved and there are no crew-level paths to merge.
"""
crew_skills: list[Path] | None = (
self.crew.skills
@@ -310,6 +311,10 @@ class Agent(BaseAgent):
if not self.skills and not crew_skills:
return
has_unresolved = self.skills and any(isinstance(s, Path) for s in self.skills)
if not has_unresolved and not crew_skills:
return
seen: set[str] = set()
resolved: list[Path | SkillModel] = []
items: list[Path | SkillModel] = list(self.skills) if self.skills else []