Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

review: only swallow the pool-full condition in spawnAgent() auto-domain pool.add()

ruv1597f840d3cb
diff --git a/v3/@claude-flow/swarm/__tests__/spawn-agent-domain-pool.test.ts b/v3/@claude-flow/swarm/__tests__/spawn-agent-domain-pool.test.ts
index e9895dba17..f4c64e4cab 100644
--- a/v3/@claude-flow/swarm/__tests__/spawn-agent-domain-pool.test.ts
+++ b/v3/@claude-flow/swarm/__tests__/spawn-agent-domain-pool.test.ts
@@ -119,6 +119,19 @@ describe('spawnAgent() auto-domain branch — domain pool visibility', () => {
expect(poolFullEvent).toBeDefined();
});
+ it('surfaces a non-capacity pool.add() failure instead of swallowing it', async () => {
+ const pool = coordinator.getDomainPool('queen');
+ expect(pool).toBeDefined();
+ const original = pool!.add.bind(pool);
+ pool!.add = async () => {
+ throw new Error('unexpected pool corruption');
+ };
+
+ await expect(coordinator.spawnAgent({ type: 'queen' })).rejects.toThrow('unexpected pool corruption');
+
+ pool!.add = original;
+ });
+
it('still works correctly via the domain-aware branches (regression guard)', async () => {
// registerAgentWithDomain()'s own pool.add() call path must be
// unaffected by this fix.
diff --git a/v3/@claude-flow/swarm/src/unified-coordinator.ts b/v3/@claude-flow/swarm/src/unified-coordinator.ts
index 145a08a476..89e332fc8e 100644
--- a/v3/@claude-flow/swarm/src/unified-coordinator.ts
+++ b/v3/@claude-flow/swarm/src/unified-coordinator.ts
@@ -1702,7 +1702,12 @@ export class UnifiedSwarmCoordinator extends EventEmitter implements IUnifiedSwa
if (pool && agent) {
try {
await pool.add(agent);
- } catch {
+ } catch (error) {
+ // Only the pool-full condition (AgentPool.add()'s sole throw) is
+ // tolerated; anything else is a real defect and must surface.
+ if (!(error instanceof Error) || !error.message.includes('maximum capacity')) {
+ throw error;
+ }
this.emitEvent('agent.domain_pool_full', { agentId, domain });
}
}