From a62677b212f613445d99bad65fb7bbef9fb35655 Mon Sep 17 00:00:00 2001 From: rUv Date: Mon, 4 Aug 2025 22:06:12 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/src/cli/simple-commands/automation-executor.j?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/1754345143.json | 1 + .claude/checkpoints/1754345144.json | 1 + .../simple-commands/automation-executor.js | 61 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .claude/checkpoints/1754345143.json create mode 100644 .claude/checkpoints/1754345144.json diff --git a/.claude/checkpoints/1754345143.json b/.claude/checkpoints/1754345143.json new file mode 100644 index 0000000000..ee7fd14151 --- /dev/null +++ b/.claude/checkpoints/1754345143.json @@ -0,0 +1 @@ +{"branch": "checkpoint/pre-edit-20250804-220543", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js", "timestamp": "2025-08-04T22:05:43Z", "type": "pre-edit", "original_branch": "alpha-85"} diff --git a/.claude/checkpoints/1754345144.json b/.claude/checkpoints/1754345144.json new file mode 100644 index 0000000000..209528dd89 --- /dev/null +++ b/.claude/checkpoints/1754345144.json @@ -0,0 +1 @@ +{"tag": "checkpoint-20250804-220544", "file": "/workspaces/claude-code-flow/src/cli/simple-commands/automation-executor.js", "timestamp": "2025-08-04T22:05:44Z", "type": "post-edit", "branch": "alpha-85", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 48 ++++++++++++++++++++++++++ .claude-flow/metrics/task-metrics.json | 6 ++-- .claude/checkpoints/1754345133.json | 1 + .claude/checkpoints/1754345135.json | 1 + claude-flow-wiki | 0 src/cli/simple-commands/automation-executor.js | 3 ++ 7 files changed, 57 insertions(+), 4 deletions(-) "} diff --git a/src/cli/simple-commands/automation-executor.js b/src/cli/simple-commands/automation-executor.js index 82be8c1844..a929f2c6a7 100644 --- a/src/cli/simple-commands/automation-executor.js +++ b/src/cli/simple-commands/automation-executor.js @@ -944,6 +944,67 @@ COORDINATION KEY POINTS: return result; } else { // When Claude integration is enabled, delegate to actual Claude instance + + // Check if we have a master coordinator (interactive mode) + const masterCoordinator = this.claudeInstances.get('master-coordinator'); + if (masterCoordinator && !this.options.nonInteractive) { + // Interactive mode: All tasks are coordinated by the master coordinator + console.log(` 🎯 Task delegated to Master Coordinator: ${task.description}`); + + // In interactive mode, the master coordinator handles all tasks + // We just wait for the master coordinator process to complete + const completionPromise = new Promise((resolve, reject) => { + masterCoordinator.process.on('exit', (code) => { + if (code === 0) { + resolve({ success: true, code }); + } else { + reject(new Error(`Master coordinator exited with code ${code}`)); + } + }); + + masterCoordinator.process.on('error', (err) => { + reject(err); + }); + }); + + // For interactive mode, we use a longer timeout since user interaction is involved + const timeout = Math.max(this.options.timeout, 1800000); // 30 minutes minimum for interactive + const timeoutPromise = new Promise((_, reject) => { + setTimeout(() => reject(new Error('Interactive session timeout')), timeout); + }); + + try { + await Promise.race([completionPromise, timeoutPromise]); + + const result = { + success: true, + taskId: task.id, + duration: Date.now() - startTime, + output: { + status: 'completed', + agent: 'master-coordinator', + executionTime: Date.now() - startTime, + metadata: { + timestamp: new Date().toISOString(), + executionId: this.executionId, + mode: 'interactive-coordination' + } + } + }; + + // Store result in memory + if (this.hooksEnabled) { + await this.storeTaskResult(task.id, result.output); + } + + return result; + + } catch (error) { + throw new Error(`Task execution failed: ${error.message}`); + } + } + + // Non-interactive mode or no master coordinator: use individual Claude instances const claudeInstance = this.claudeInstances.get(task.assignTo); if (!claudeInstance) { // If no pre-spawned instance, create one for this task