fix(cron): pass agent-level skill filter to isolated cron sessions

Isolated cron sessions called buildWorkspaceSkillSnapshot without
the skillFilter parameter, causing all skills to be included even
when an agent had a restricted skills list via agents.list[].skills.

Resolves the filter using resolveAgentSkillsFilter and passes it
through, aligning isolated cron with main session behavior.

Fixes #10804
This commit is contained in:
Marcus Castro
2026-02-10 11:47:28 -03:00
committed by Peter Steinberger
parent e1e46dc11b
commit 053affffec
2 changed files with 260 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import {
resolveAgentConfig,
resolveAgentDir,
resolveAgentModelFallbacksOverride,
resolveAgentSkillsFilter,
resolveAgentWorkspaceDir,
resolveDefaultAgentId,
} from "../../agents/agent-scope.js";
@@ -520,7 +521,7 @@ export async function runCronIsolatedAgentTurn(params: {
`${commandBody}\n\nReturn your summary as plain text; it will be delivered automatically. If the task explicitly calls for messaging a specific external recipient, note who/where it should go instead of sending it yourself.`.trim();
}
let skillsSnapshot = cronSession.sessionEntry.skillsSnapshot;
let skillsSnapshot = cronSession.sessionEntry.skillsSnapshot;
if (isFastTestEnv) {
// Fast unit-test mode: avoid scanning the workspace and writing session stores.
skillsSnapshot = skillsSnapshot ?? { prompt: "", skills: [] };
@@ -529,9 +530,11 @@ export async function runCronIsolatedAgentTurn(params: {
const skillsSnapshotVersion = getSkillsSnapshotVersion(workspaceDir);
const needsSkillsSnapshot =
!existingSnapshot || existingSnapshot.version !== skillsSnapshotVersion;
const skillFilter = resolveAgentSkillsFilter(cfgWithAgentDefaults, agentId);
if (needsSkillsSnapshot) {
skillsSnapshot = buildWorkspaceSkillSnapshot(workspaceDir, {
config: cfgWithAgentDefaults,
skillFilter,
eligibility: { remote: getRemoteSkillEligibility() },
snapshotVersion: skillsSnapshotVersion,
});