fix(automation): log no-op status-change calls instead of silently returning

P2-34: Silent no-op guard hid caller bugs. Warn-log the violation so
it shows up in traces; callers should still gate.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:51:12 -04:00
1 parent 4ebd98bb99
commit 66f5e0923d
1 file changed
+7 -1
+7 -1
View File
@@ -31,7 +31,13 @@ export function handleTaskStatusChange(
newStatus: string,
): void {
if (deps.isQuitting()) return;
if (previousStatus === newStatus) return;
if (previousStatus === newStatus) {
// Caller should gate this; log the no-op so the offender can be traced.
deps.logger.warn(
`[automation] handleTaskStatusChange called with no-op status (${previousStatus}) for task ${taskId} — caller should gate this.`,
);
return;
}
const { db, wakeAgentIfPossible } = deps;
const { dispatchAutomation } = callbacks;