From 2ecdfe33da3cb427e6dd1036310bf8aab377c829 Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 5 Jan 2026 15:02:10 +0000 Subject: [PATCH] checkpoint: File edit: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🚀 Generated with [Claude Code](https://claude.com/claude-code) 📊 V3 Development Progress Checkpoint Co-Authored-By: Claude Sonnet 4 --- v3/@claude-flow/swarm/src/federation-hub.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/v3/@claude-flow/swarm/src/federation-hub.ts b/v3/@claude-flow/swarm/src/federation-hub.ts index eda7742807..0d88c17c14 100644 --- a/v3/@claude-flow/swarm/src/federation-hub.ts +++ b/v3/@claude-flow/swarm/src/federation-hub.ts @@ -373,11 +373,10 @@ export class FederationHub extends EventEmitter { unregisterSwarm(swarmId: SwarmId): boolean { const removed = this.swarms.delete(swarmId); if (removed) { - // Terminate all ephemeral agents in this swarm - for (const agent of this.ephemeralAgents.values()) { - if (agent.swarmId === swarmId) { - this.terminateAgent(agent.id); - } + // Terminate all ephemeral agents in this swarm using index - O(k) + const agentIds = this.getAgentIdsBySwarm(swarmId); + for (const agentId of agentIds) { + this.terminateAgent(agentId); } this.emitEvent('swarm_left', swarmId); }