fix(cron): trust agent output when channel is unresolved without explicit delivery (#92817)

resolveCronChannelOutputPolicy checked deliveryRequested === false
when there is no channel. Since deliveryRequested is optional
(?: boolean), undefined and missing opts both returned false,
blocking the hasRecoveredToolWarning rescue path for --no-deliver
cron runs whose agent recovered successfully.

Change === false to !== true: when no channel exists, prefer the
agent's final visible text unless delivery was explicitly
requested.

Fixes #90664

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
fsdwen
2026-06-16 00:28:22 +08:00
committed by GitHub
parent 1e2363b687
commit b90f7d2fd0
2 changed files with 11 additions and 1 deletions
@@ -56,6 +56,16 @@ describe("cron channel output policy", () => {
).resolves.toEqual({
preferFinalAssistantVisibleText: false,
});
// deliveryRequested is optional — undefined and missing opts are
// equivalent to "not requested" (no channel to deliver to). #90664
await expect(
resolveCronChannelOutputPolicy(undefined, { deliveryRequested: undefined }),
).resolves.toEqual({
preferFinalAssistantVisibleText: true,
});
await expect(resolveCronChannelOutputPolicy(undefined)).resolves.toEqual({
preferFinalAssistantVisibleText: true,
});
});
it("lets channel plugins format current tool context targets", async () => {
@@ -21,7 +21,7 @@ export async function resolveCronChannelOutputPolicy(
}> {
const channelId = normalizeOptionalLowercaseString(channel);
if (!channelId) {
return { preferFinalAssistantVisibleText: opts?.deliveryRequested === false };
return { preferFinalAssistantVisibleText: opts?.deliveryRequested !== true };
}
const { getChannelPlugin } = await loadChannelPluginRuntime();
return {