fix(cron): condition requireExplicitMessageTarget on resolved delivery (#28017)

When a cron job's delivery target resolution fails (resolvedDelivery.ok
is false), the agent was still started with requireExplicitMessageTarget:
true. This caused "Action send requires a target" errors because the
agent's message tool demanded a target that was never resolved.

Condition the flag on both deliveryRequested AND resolvedDelivery.ok so
the agent can still use messaging tools freely when no valid delivery
target exists.

Fixes #27898

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Anandesh Sharma
2026-02-28 22:38:37 +05:30
committed by GitHub
parent 5e2ef0e883
commit 2851926314

View File

@@ -466,7 +466,10 @@ export async function runCronIsolatedAgentTurn(params: {
verboseLevel: resolvedVerboseLevel,
timeoutMs,
runId: cronSession.sessionEntry.sessionId,
requireExplicitMessageTarget: true,
// Only enforce an explicit message target when the cron delivery target
// was successfully resolved. When resolution fails the agent should not
// be blocked by a target it cannot satisfy (#27898).
requireExplicitMessageTarget: deliveryRequested && resolvedDelivery.ok,
disableMessageTool: deliveryRequested,
abortSignal,
});