fix(scheduled-task): enable worker by default and add WeChat preflight
Memind CI / Test, build, and release guards (push) Has been cancelled

Scheduled automations were saved but never executed because the worker
required an explicit env flag. Follow H5_REMINDER_WORKER_ENABLED when unset,
add WeChat preflight to write tasks deterministically, and surface worker
warnings on create.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-10 19:32:09 +08:00
parent 2313d76eed
commit 049d8a6f80
17 changed files with 602 additions and 14 deletions
+35
View File
@@ -28,6 +28,7 @@ import {
} from './wechat/customer-service-deferred.mjs';
import { guardScheduleConfirmationReply } from './wechat/handlers/schedule-guard.mjs';
import { handleWechatScheduleIntent } from './wechat/handlers/schedule.mjs';
import { handleWechatScheduledTaskIntent } from './wechat/handlers/scheduled-task.mjs';
import {
buildStatusText,
resolveSyncReply,
@@ -1564,6 +1565,7 @@ export function createWechatMpService({
sessionApiFetch = null,
submitSessionReply = null,
scheduleService = null,
scheduledTaskService = null,
wechatScheduleLlmConfigService = null,
llmProviderService = null,
chatIntentRouter = null,
@@ -3830,6 +3832,39 @@ export function createWechatMpService({
};
}
const scheduledTaskReply =
intent.msgType === 'text' || intent.msgType === 'voice'
? await handleWechatScheduledTaskIntent({
intent,
user: boundUser,
scheduledTaskService,
logger,
}).catch((err) => {
logger.warn?.(
'WeChat MP scheduled task intent handling failed open:',
err instanceof Error ? err.message : err,
);
return null;
})
: null;
if (scheduledTaskReply) {
if (inbound.msgId && typeof userAuth.finishWechatMpMessage === 'function') {
await userAuth.finishWechatMpMessage({
appId: config.appId,
openid: inbound.fromUserName,
msgId: inbound.msgId,
status: 'done',
agentSessionId: null,
});
}
return {
ok: true,
status: 200,
contentType: 'application/xml; charset=utf-8',
body: await buildPassiveReplyBody(scheduledTaskReply),
};
}
const scheduleReply =
intent.msgType === 'text' || intent.msgType === 'voice'
? await handleWechatScheduleIntent({