fix(runner): sync active Monaco workspace edits into parallel execution worktrees
This commit is contained in:
12
vibn-agent-runner/dist/server.js
vendored
12
vibn-agent-runner/dist/server.js
vendored
@@ -125,6 +125,18 @@ function ensureWorkspace(repo, sessionId) {
|
|||||||
return mainRepoDir;
|
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;
|
return taskWorktreePath;
|
||||||
}
|
}
|
||||||
function buildContext(repo, sessionId) {
|
function buildContext(repo, sessionId) {
|
||||||
|
|||||||
@@ -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;
|
return taskWorktreePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user