forked from farhoodlabs/paperclip
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:
@@ -250,7 +250,10 @@ describeEmbeddedPostgres("scanProjectWorkspaces prune path", () => {
|
|||||||
expect(remainingSlugs).toContain("keep-skill");
|
expect(remainingSlugs).toContain("keep-skill");
|
||||||
expect(remainingSlugs).not.toContain("prune-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"));
|
const detachWarnings = result.warnings.filter((w) => w.includes("prune-skill") && w.includes("detached"));
|
||||||
expect(detachWarnings).toHaveLength(0);
|
expect(detachWarnings).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2061,6 +2061,10 @@ export function companySkillService(db: Db) {
|
|||||||
warnings.push(
|
warnings.push(
|
||||||
`Skill "${skill.slug}" was removed from ${sourceLocator} and detached from ${usedByAgents.map((a) => a.name).join(", ")}.`,
|
`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);
|
await deleteSkill(companyId, skill.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user