fix(scheduled-task): reject meta-only phrases in taskSpec parsing
Memind CI / Test, build, and release guards (push) Successful in 7m31s

Treat hollow requests like「我要做一个定时执行任务」as missing taskSpec so
WeChat preflight asks for both schedule and executable content instead of
accepting「执行」as a deliverable task description.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-12 01:36:38 +08:00
parent c58a23d155
commit 6ba95c6229
2 changed files with 43 additions and 0 deletions
+21
View File
@@ -90,3 +90,24 @@ test('isScheduledTaskIntent excludes none', () => {
assert.equal(isScheduledTaskIntent({ action: 'create_scheduled_task' }), true);
assert.equal(isScheduledTaskIntent({ action: 'none' }), false);
});
test('meta scheduled-task phrases require task_spec clarification', () => {
for (const text of [
'我要做一个定时执行任务',
'定时自动执行任务',
'不是待办,定时执行任务',
]) {
const intent = parseScheduledTaskIntent(text);
assert.equal(intent.action, 'create_scheduled_task', text);
assert.ok(intent.needsClarification?.includes('task_spec'), text);
assert.ok(intent.needsClarification?.includes('schedule'), text);
assert.equal(extractScheduledTaskSpec(text), null, text);
}
});
test('combined phrase keeps substantive taskSpec after time prefix', () => {
const text = '帮我创建一个定时执行任务,23:00执行,搜索今日新闻';
const intent = parseScheduledTaskIntent(text);
assert.equal(intent.needsClarification, undefined);
assert.match(intent.taskSpec, /搜索今日新闻/u);
});