Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address review — module-scoped guard for agentActionExecutor init

Adam Eivy482ac04b580a
diff --git a/server/services/agentActionExecutor.js b/server/services/agentActionExecutor.js
index e793bbe958..543bf8a613 100644
--- a/server/services/agentActionExecutor.js
+++ b/server/services/agentActionExecutor.js
@@ -568,9 +568,14 @@ async function executeMoltworldInteract(client, account, params) {
* Initialize the action executor
* Listens to scheduler events and executes actions
*/
+let executeListenerRegistered = false;
+
export function init() {
- // Prevent duplicate listeners; safe to re-register after listeners are removed
- if (scheduleEvents.listenerCount('execute') > 0) return;
+ // Prevent duplicate listeners from THIS module specifically; a plain
+ // listenerCount check would false-positive if another module also subscribes
+ // to the `execute` event.
+ if (executeListenerRegistered) return;
+ executeListenerRegistered = true;
scheduleEvents.on('execute', ({ scheduleId, schedule, timestamp }) => {
(async () => {