From 41143fc1fdc47841b252d2eacca7f8564c1bfff3 Mon Sep 17 00:00:00 2001 From: mawkone Date: Wed, 3 Jun 2026 14:44:57 -0700 Subject: [PATCH] fix(runner): sync active Monaco workspace edits into parallel execution worktrees --- vibn-agent-runner/dist/server.js | 12 ++++++++++++ vibn-agent-runner/src/server.ts | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/vibn-agent-runner/dist/server.js b/vibn-agent-runner/dist/server.js index fea5c0c..d6ef32c 100644 --- a/vibn-agent-runner/dist/server.js +++ b/vibn-agent-runner/dist/server.js @@ -125,6 +125,18 @@ function ensureWorkspace(repo, sessionId) { return mainRepoDir; } } + // 5. Sync active workspace edits from mainRepoDir (containing Monaco edits) to taskWorktreePath + if (taskWorktreePath !== mainRepoDir) { + try { + console.log(`[worktree] Syncing active workspace edits from ${mainRepoDir} to ${taskWorktreePath}...`); + // Use rsync to copy active files while preserving structure and deleting files deleted in mainRepoDir + // Exclude node_modules, .git, .next, .vibncode/settings.json, etc. + (0, child_process_1.execSync)(`rsync -ar --delete --exclude="node_modules" --exclude=".git" --exclude=".next" --exclude=".vibncode/settings.json" "${mainRepoDir}/" "${taskWorktreePath}/"`, { stdio: "pipe" }); + } + catch (syncErr) { + console.warn("[worktree] rsync failed, falling back to cp:", syncErr.message || syncErr); + } + } return taskWorktreePath; } function buildContext(repo, sessionId) { diff --git a/vibn-agent-runner/src/server.ts b/vibn-agent-runner/src/server.ts index 15de187..51d564c 100644 --- a/vibn-agent-runner/src/server.ts +++ b/vibn-agent-runner/src/server.ts @@ -113,6 +113,26 @@ function ensureWorkspace(repo?: string, sessionId?: string): string { } } + // 5. Sync active workspace edits from mainRepoDir (containing Monaco edits) to taskWorktreePath + if (taskWorktreePath !== mainRepoDir) { + try { + console.log( + `[worktree] Syncing active workspace edits from ${mainRepoDir} to ${taskWorktreePath}...`, + ); + // Use rsync to copy active files while preserving structure and deleting files deleted in mainRepoDir + // Exclude node_modules, .git, .next, .vibncode/settings.json, etc. + execSync( + `rsync -ar --delete --exclude="node_modules" --exclude=".git" --exclude=".next" --exclude=".vibncode/settings.json" "${mainRepoDir}/" "${taskWorktreePath}/"`, + { stdio: "pipe" }, + ); + } catch (syncErr: any) { + console.warn( + "[worktree] rsync failed, falling back to cp:", + syncErr.message || syncErr, + ); + } + } + return taskWorktreePath; }