mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
c3ab5ef240
Two of the five integration tests skipped under #1872 fix real production bugs in SwarmCoordinator. 1. scaleAgents({type, count}) treated `count` as a delta added to the existing count. Calling scaleAgents({count:3}) then scaleAgents({count:2}) ended up at 1+3+2=6 instead of the intuitive target of 2. Fixed: count now means TARGET TOTAL of the given type; spawn or terminate to reach it. Scale-down terminates the oldest first so the operation is deterministic. 2. executeTask(agentId, task) did `await agent.executeTask(task)` without a try/catch. A thrown error propagated up to the caller, defeating the documented `TaskResult{status:'failed', error}` contract callers rely on for graceful degradation. Fixed: wrap the call, convert a throw into a structured failed result with the error message preserved. Both tests now run (was `it.skip`, now `it`), with the skip-banner comments replaced by "fixed" notes that point back to this issue. Pure source-side fixes — no API surface change, callers that were already using the documented contract keep working. Co-authored-by: Reuven <cohen@ruv-mac-mini.local>