fix(skills): emit warning for all pruned skills, not just agent-attached ones

Previously, skills pruned during re-scan only emitted a warning when
they were attached to agents. Skills with no agent references were
deleted silently. Now every pruned skill emits a warning in the scan
result so the deletion is always visible to the caller.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-13 00:03:17 +00:00
parent 157729ea95
commit 3610559cc7
2 changed files with 8 additions and 1 deletions
@@ -250,7 +250,10 @@ describeEmbeddedPostgres("scanProjectWorkspaces prune path", () => {
expect(remainingSlugs).toContain("keep-skill");
expect(remainingSlugs).not.toContain("prune-skill");
// No warnings about agent detachment since no agents used it
// A deletion warning should still be emitted (no detachment, but deletion is confirmed)
const deleteWarnings = result.warnings.filter((w) => w.includes("prune-skill") && w.includes("deleted"));
expect(deleteWarnings).toHaveLength(1);
// No agent-detachment warning since no agents used it
const detachWarnings = result.warnings.filter((w) => w.includes("prune-skill") && w.includes("detached"));
expect(detachWarnings).toHaveLength(0);
});
+4
View File
@@ -2061,6 +2061,10 @@ export function companySkillService(db: Db) {
warnings.push(
`Skill "${skill.slug}" was removed from ${sourceLocator} and detached from ${usedByAgents.map((a) => a.name).join(", ")}.`,
);
} else {
warnings.push(
`Skill "${skill.slug}" was removed from ${sourceLocator} and deleted.`,
);
}
await deleteSkill(companyId, skill.id);
}