test(cron): add empty-skills edge case for skill filter coverage

Addresses Greptile review feedback: locks in behavior when an agent
has skills: [] (explicit empty list), ensuring skillFilter: [] is
forwarded to buildWorkspaceSkillSnapshot to filter out all skills.
This commit is contained in:
Marcus Castro
2026-02-10 12:17:26 -03:00
committed by Peter Steinberger
parent 053affffec
commit e5dbfde7e1

View File

@@ -253,4 +253,22 @@ describe("runCronIsolatedAgentTurn — skill filter", () => {
// When no skills config, skillFilter should be undefined (no filtering applied)
expect(buildWorkspaceSkillSnapshotMock.mock.calls[0][1].skillFilter).toBeUndefined();
});
it("passes empty skillFilter when agent explicitly disables all skills", async () => {
resolveAgentSkillsFilterMock.mockReturnValue([]);
const { runCronIsolatedAgentTurn } = await import("./run.js");
const result = await runCronIsolatedAgentTurn(
makeParams({
cfg: { agents: { list: [{ id: "silent", skills: [] }] } },
agentId: "silent",
}),
);
expect(result.status).toBe("ok");
expect(buildWorkspaceSkillSnapshotMock).toHaveBeenCalledOnce();
// Explicit empty skills list should forward [] to filter out all skills
expect(buildWorkspaceSkillSnapshotMock.mock.calls[0][1]).toHaveProperty("skillFilter", []);
});
});