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

Checkpoint: File edits

rUvc437655f4a42
diff --git a/v3/@claude-flow/cli/src/services/container-worker-pool.ts b/v3/@claude-flow/cli/src/services/container-worker-pool.ts
index 4bc2bf774c..8274c48197 100644
--- a/v3/@claude-flow/cli/src/services/container-worker-pool.ts
+++ b/v3/@claude-flow/cli/src/services/container-worker-pool.ts
@@ -202,12 +202,34 @@ export class ContainerWorkerPool extends EventEmitter {
// Start idle check timer
this.startIdleChecks();
+ // Register exit handlers for cleanup
+ this.registerExitHandlers();
+
this.initialized = true;
this.emit('initialized', { containers: this.containers.size });
return true;
}
+ /**
+ * Register process exit handlers to clean up containers
+ */
+ private registerExitHandlers(): void {
+ if (this.exitHandlersRegistered) return;
+
+ const cleanup = async () => {
+ if (!this.isShuttingDown) {
+ await this.shutdown();
+ }
+ };
+
+ process.once('SIGTERM', cleanup);
+ process.once('SIGINT', cleanup);
+ process.once('beforeExit', cleanup);
+
+ this.exitHandlersRegistered = true;
+ }
+
/**
* Execute a worker in a container
*/