mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
UnifiedSwarmCoordinator.waitForTaskCompletion()/waitForQueuedTask() busy-polled state.tasks via setInterval(...,100) despite the coordinator already extending EventEmitter and already firing task.completed/task.failed at every terminal task-status transition. Rewritten to be event-driven with a synchronous pre-check for an already-terminal task and a setTimeout fallback for the timeout case; setMaxListeners raised to avoid spurious warnings at realistic concurrency (adversarial-critic finding, fixed same session). 4 new discriminating tests (baseline fails 3/4, candidate passes 4/4 via stash isolation); real wall-clock benchmark 100.359ms -> 0.206ms mean (~487x, N=20); 234/234 full swarm-package suite, tsc clean. Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01VWUxwsNQVofSGXi8us9dEc