mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:10:45 +00:00
fix(cron): keep runner-owned delivery off message tool
This commit is contained in:
@@ -92,6 +92,14 @@ describe("runCronIsolatedAgentTurn message tool policy", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("disables the message tool when webhook delivery is active", async () => {
|
||||
await expectMessageToolDisabledForPlan({
|
||||
requested: false,
|
||||
mode: "webhook",
|
||||
to: "https://example.invalid/cron",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the message tool enabled for shared callers when delivery is not requested", async () => {
|
||||
mockRunCronFallbackPassthrough();
|
||||
resolveCronDeliveryPlanMock.mockReturnValue({
|
||||
|
||||
@@ -124,13 +124,14 @@ type IsolatedDeliveryContract = "cron-owned" | "shared";
|
||||
function resolveCronToolPolicy(params: {
|
||||
deliveryRequested: boolean;
|
||||
resolvedDelivery: ResolvedCronDeliveryTarget;
|
||||
deliveryMode: "announce" | "webhook" | "none";
|
||||
}) {
|
||||
return {
|
||||
// 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: params.deliveryRequested && params.resolvedDelivery.ok,
|
||||
disableMessageTool: params.deliveryRequested,
|
||||
disableMessageTool: params.deliveryMode !== "none",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -158,6 +159,7 @@ async function resolveCronDeliveryContext(params: {
|
||||
toolPolicy: resolveCronToolPolicy({
|
||||
deliveryRequested: false,
|
||||
resolvedDelivery,
|
||||
deliveryMode: deliveryPlan.mode,
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -176,6 +178,7 @@ async function resolveCronDeliveryContext(params: {
|
||||
toolPolicy: resolveCronToolPolicy({
|
||||
deliveryRequested: deliveryPlan.requested,
|
||||
resolvedDelivery,
|
||||
deliveryMode: deliveryPlan.mode,
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user