fix(schedule): auto-create reminders when agent only writes schedule items

When schedule_create_item includes a start time and reminder intent, create the
matching h5_schedule_reminders row in the same tool call so 10:00 pushes are not
lost. Also reconcile Goose SSE request ids with the portal agent-run gate to keep
MindSpace chat streaming reliable.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-12 08:11:43 +08:00
parent 32fb2cdeaf
commit 97d0e8d970
9 changed files with 552 additions and 21 deletions
+36 -1
View File
@@ -1,6 +1,41 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createScheduleService } from './schedule-service.mjs';
import { createScheduleService, shouldAutoCreateReminderAtStart } from './schedule-service.mjs';
test('shouldAutoCreateReminderAtStart detects reminder intent from title or description', () => {
assert.equal(
shouldAutoCreateReminderAtStart({
title: '吃药提醒',
description: '今天上午10点吃药',
startAt: 1,
}),
true,
);
assert.equal(
shouldAutoCreateReminderAtStart({
title: '开会',
description: '明天下午三点',
startAt: 1,
}),
false,
);
assert.equal(
shouldAutoCreateReminderAtStart({
title: '吃药提醒',
description: '今天上午10点吃药',
startAt: 1,
noReminder: true,
}),
false,
);
assert.equal(
shouldAutoCreateReminderAtStart({
title: '买菜',
startAt: null,
}),
false,
);
});
test('listUserNotifications accepts mysql JSON columns returned as objects', async () => {
const service = createScheduleService({