fix(scheduled-task): enable worker by default and add WeChat preflight
Memind CI / Test, build, and release guards (push) Has been cancelled
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:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user