fix: harden isolated cron announce delivery fallback (#15739) (thanks @widingmarcus-cyber)

This commit is contained in:
Peter Steinberger
2026-02-13 23:48:36 +01:00
parent ea95e88dd6
commit 45a2cd55cc
5 changed files with 99 additions and 6 deletions

View File

@@ -103,8 +103,9 @@ export type RunCronAgentTurnResult = {
sessionKey?: string;
/**
* `true` when the isolated run already delivered its output to the target
* channel (via outbound payloads or the subagent announce flow). Callers
* should skip posting a summary to the main session to avoid duplicate
* channel (via outbound payloads, the subagent announce flow, or a matching
* messaging-tool send). Callers should skip posting a summary to the main
* session to avoid duplicate
* messages. See: https://github.com/openclaw/openclaw/issues/15692
*/
delivered?: boolean;
@@ -525,7 +526,9 @@ export async function runCronIsolatedAgentTurn(params: {
}),
);
let delivered = false;
// `true` means we confirmed at least one outbound send reached the target.
// Keep this strict so timer fallback can safely decide whether to wake main.
let delivered = skipMessagingToolDelivery;
if (deliveryRequested && !skipHeartbeatDelivery && !skipMessagingToolDelivery) {
if (resolvedDelivery.error) {
if (!deliveryBestEffort) {
@@ -556,7 +559,7 @@ export async function runCronIsolatedAgentTurn(params: {
// for media/channel payloads so structured content is preserved.
if (deliveryPayloadHasStructuredContent) {
try {
await deliverOutboundPayloads({
const deliveryResults = await deliverOutboundPayloads({
cfg: cfgWithAgentDefaults,
channel: resolvedDelivery.channel,
to: resolvedDelivery.to,
@@ -566,7 +569,7 @@ export async function runCronIsolatedAgentTurn(params: {
bestEffort: deliveryBestEffort,
deps: createOutboundSendDeps(params.deps),
});
delivered = true;
delivered = deliveryResults.length > 0;
} catch (err) {
if (!deliveryBestEffort) {
return withRunSession({ status: "error", summary, outputText, error: String(err) });