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

fix(daemon): break IPC pipe so background daemon survives parent exit on Windows (#1766)

Reuven69e72d2e4771
diff --git a/package.json b/package.json
index 4b0d22a7cf..7ddf6da39e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "claude-flow",
- "version": "3.7.0-alpha.1",
+ "version": "3.7.0-alpha.3",
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "dist/index.js",
"type": "module",
diff --git a/ruflo/package.json b/ruflo/package.json
index 721ad24f5d..0553560723 100644
--- a/ruflo/package.json
+++ b/ruflo/package.json
@@ -1,6 +1,6 @@
{
"name": "ruflo",
- "version": "3.7.0-alpha.2",
+ "version": "3.7.0-alpha.3",
"description": "Ruflo - Enterprise AI agent orchestration platform. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
"main": "bin/ruflo.js",
"type": "module",
diff --git a/v3/@claude-flow/cli/package.json b/v3/@claude-flow/cli/package.json
index d21298ae9c..5fe4d2e35b 100644
--- a/v3/@claude-flow/cli/package.json
+++ b/v3/@claude-flow/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/cli",
- "version": "3.7.0-alpha.1",
+ "version": "3.7.0-alpha.3",
"type": "module",
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
"main": "dist/src/index.js",
diff --git a/v3/@claude-flow/cli/src/commands/daemon.ts b/v3/@claude-flow/cli/src/commands/daemon.ts
index e791ef6189..4fae377a6a 100644
--- a/v3/@claude-flow/cli/src/commands/daemon.ts
+++ b/v3/@claude-flow/cli/src/commands/daemon.ts
@@ -264,8 +264,14 @@ async function startBackgroundDaemon(projectRoot: string, quiet: boolean, maxCpu
const isWin = process.platform === 'win32';
const forkOpts: Record<string, unknown> = {
cwd: resolvedRoot,
- // detached is POSIX-only; on Windows we rely on windowsHide
- detached: !isWin,
+ // detached: true on every platform (#1766). On Windows, leaving detached:false
+ // kept the child in the parent's process group AND the IPC pipe held the
+ // child to npx — when npx exited, the IPC pipe tore down and the daemon
+ // died within ~1s. detached:true + child.disconnect() (below) gives the
+ // child its own session/pgid and breaks the IPC pipe so the daemon
+ // genuinely survives parent exit. On POSIX, detached:true was already the
+ // path; this just makes Windows match.
+ detached: true,
// Use 'ignore' for all stdio + 'ignore' for the IPC channel via silent:true off.
// fork() defaults to creating an IPC channel; we don't need it here, so we
// pass stdio explicitly. Passing fs.openSync() FDs causes the child to die
@@ -304,8 +310,15 @@ async function startBackgroundDaemon(projectRoot: string, quiet: boolean, maxCpu
}
// Unref BEFORE writing PID file — prevents race where parent exits
- // but child hasn't fully detached yet (fixes macOS daemon death #1283)
+ // but child hasn't fully detached yet (fixes macOS daemon death #1283).
child.unref();
+ // #1766: also break the IPC pipe explicitly. unref() releases the libuv
+ // handle but does NOT close the IPC channel; on Windows the open IPC
+ // pipe keeps the daemon tied to its parent npx, and when npx exits the
+ // pipe is torn down and the daemon exits with it. disconnect() severs
+ // the IPC pipe so the daemon truly stands on its own. Wrapped in try
+ // because disconnect() throws if the IPC channel is already gone.
+ try { child.disconnect(); } catch { /* IPC channel already closed */ }
// Longer delay to let the child process start and write its own PID file.
// 100ms was too short on Windows; the child's checkExistingDaemon() would