fix(wechat): recognize news page intents and harden scheduled task delivery
Memind CI / Test, build, and release guards (push) Failing after 4s
Memind CI / Test, build, and release guards (push) Failing after 4s
Expand page.generate rules for post-page verbs and link-missing retries, recover HTML artifacts when shadow LLM agrees, and stop marking scheduled tasks failed when WeChat notification hits rate limits. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -175,3 +175,62 @@ test('scheduled task worker marks failure when agent only asks for clarification
|
||||
|
||||
assert.deepEqual(calls, ['failed:SCHEDULED_TASK_NON_DELIVERY', 'notify:scheduled_task_failed']);
|
||||
});
|
||||
|
||||
test('scheduled task worker keeps success when wechat notification fails', async () => {
|
||||
const calls = [];
|
||||
const task = {
|
||||
id: 'task-4',
|
||||
userId: 'user-4',
|
||||
title: '每日新闻页',
|
||||
recurrence: 'daily',
|
||||
notifyChannel: 'both',
|
||||
attempts: 1,
|
||||
};
|
||||
const worker = startScheduledTaskWorker({
|
||||
intervalMs: 60_000,
|
||||
userAuth: { id: 'user-auth' },
|
||||
tkmindProxy: { id: 'proxy' },
|
||||
scheduledTaskService: {
|
||||
async listDueTasks() {
|
||||
return [task];
|
||||
},
|
||||
async lockTask() {
|
||||
return task;
|
||||
},
|
||||
async markTaskRunning(input) {
|
||||
return input;
|
||||
},
|
||||
async markTaskSucceeded(input) {
|
||||
calls.push(`success:${input.id}`);
|
||||
return { ...input, status: 'completed' };
|
||||
},
|
||||
async markTaskFailed() {
|
||||
calls.push('failed');
|
||||
},
|
||||
},
|
||||
scheduleService: {
|
||||
async createUserNotification() {
|
||||
calls.push('notify:web');
|
||||
},
|
||||
},
|
||||
notificationDispatcher: {
|
||||
async sendScheduleNotification() {
|
||||
const err = new Error('out of response count limit');
|
||||
err.errcode = 45047;
|
||||
throw err;
|
||||
},
|
||||
},
|
||||
executeTask: async () => ({
|
||||
sessionId: 'session-4',
|
||||
requestId: 'req-4',
|
||||
deliveryText: '页面已生成:https://example.com/news.html',
|
||||
}),
|
||||
logger: { warn() {} },
|
||||
runOnStart: false,
|
||||
});
|
||||
|
||||
await worker.runOnce();
|
||||
worker.stop();
|
||||
|
||||
assert.deepEqual(calls, ['notify:web', 'success:task-4']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user