fix(core): allow empty command in updateSchedule when steps present

Aligns updateSchedule validation with createSchedule so step-based
automations (auto-summarize, memory dreams) can sync at startup
without hitting "Command cannot be empty".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-02 13:11:43 -07:00
parent 6b4f28a1fb
commit 2769e4a57b
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix startup sync errors for step-based automations (auto-summarize, memory dreams) by allowing empty `command` in `updateSchedule` when the schedule has steps.

View File

@@ -269,12 +269,15 @@ export class AutomationStore extends EventEmitter<AutomationStoreEvents> {
schedule.description = updates.description?.trim() || undefined;
}
if (updates.command !== undefined) {
if (!updates.command.trim()) throw new Error("Command cannot be empty");
schedule.command = updates.command.trim();
}
if (updates.steps !== undefined) {
schedule.steps = updates.steps.length > 0 ? updates.steps : undefined;
}
const willHaveSteps = schedule.steps && schedule.steps.length > 0;
if (!willHaveSteps && !schedule.command) {
throw new Error("Command is required and cannot be empty");
}
if (updates.timeoutMs !== undefined) {
schedule.timeoutMs = updates.timeoutMs;
}