mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 09:11:12 +00:00
fix(cron): share isolated announce flow + harden cron scheduling/delivery (#11641)
* fix(cron): comprehensive cron scheduling and delivery fixes - Fix delivery target resolution for isolated agent cron jobs - Improve schedule parsing and validation - Add job retry logic and error handling - Enhance cron ops with better state management - Add timer improvements for more reliable cron execution - Add cron event type to protocol schema - Support cron events in heartbeat runner (skip empty-heartbeat check, use dedicated CRON_EVENT_PROMPT for relay) * fix: remove cron debug test and add changelog/docs notes (#11641) (thanks @tyler6204)
This commit is contained in:
@@ -70,12 +70,21 @@ export async function resolveDeliveryTarget(
|
||||
const mode = resolved.mode as "explicit" | "implicit";
|
||||
const toCandidate = resolved.to;
|
||||
|
||||
// Only carry threadId when delivering to the same recipient as the session's
|
||||
// last conversation. This prevents stale thread IDs (e.g. from a Telegram
|
||||
// supergroup topic) from being sent to a different target (e.g. a private
|
||||
// chat) where they would cause API errors.
|
||||
const threadId =
|
||||
resolved.threadId && resolved.to && resolved.to === resolved.lastTo
|
||||
? resolved.threadId
|
||||
: undefined;
|
||||
|
||||
if (!toCandidate) {
|
||||
return {
|
||||
channel,
|
||||
to: undefined,
|
||||
accountId: resolved.accountId,
|
||||
threadId: resolved.threadId,
|
||||
threadId,
|
||||
mode,
|
||||
};
|
||||
}
|
||||
@@ -91,7 +100,7 @@ export async function resolveDeliveryTarget(
|
||||
channel,
|
||||
to: docked.ok ? docked.to : undefined,
|
||||
accountId: resolved.accountId,
|
||||
threadId: resolved.threadId,
|
||||
threadId,
|
||||
mode,
|
||||
error: docked.ok ? undefined : docked.error,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user