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
+2 -2
View File
@@ -4,7 +4,7 @@
*
* 默认:DB + mock worker 全链路(无需 Portal 进程)
* 可选:
* VERIFY_SCHEDULED_TASK_LIVE=1 等待已开启 worker 的 Portal 到点执行(需 H5_SCHEDULED_TASK_WORKER_ENABLED=1
* VERIFY_SCHEDULED_TASK_LIVE=1 等待已开启 worker 的 Portal 到点执行(需 H5_SCHEDULED_TASK_WORKER_ENABLED=1 或未显式关闭且 H5_REMINDER_WORKER_ENABLED=1
* --due-seconds=90 创建 N 秒后执行的一次性任务(live 模式用)
*/
import assert from 'node:assert/strict';
@@ -204,7 +204,7 @@ async function testLivePortalWorker(pool, userId, { dueSeconds }) {
pass('Live 任务已创建', `${waitSeconds}s 后执行,id=${created.id}`);
console.log(`\n等待 Portal worker 执行(最多 ${waitSeconds + 120}s)…`);
console.log('请确认 Portal 进程已设置 H5_SCHEDULED_TASK_WORKER_ENABLED=1\n');
console.log('请确认 Portal 进程已开启 scheduled task workerH5_SCHEDULED_TASK_WORKER_ENABLED=1,或未设置时 H5_REMINDER_WORKER_ENABLED=1\n');
const deadline = Date.now() + (waitSeconds + 120) * 1000;
let terminal = null;