fix(engine): add cross-process merge guard to prevent concurrent merges
Multiple engine processes (dashboard + serve) share the same SQLite database but each has its own in-memory merge queue. Without a cross-process check, two processes can start merging different tasks simultaneously. Added store.getActiveMergingTask() as a DB-level check before any merge starts. The drainMergeQueue defers with pollIntervalMs delay, and both aiMergeTask and processPullRequestMergeTask have safety-net checks. Also moved stale merge status cleanup to run regardless of autoMerge setting. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,7 @@ const mocks = vi.hoisted(() => {
|
||||
emitter.off(event, handler);
|
||||
}),
|
||||
emit: emitter.emit.bind(emitter),
|
||||
getActiveMergingTask: vi.fn().mockReturnValue(undefined),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user