fix(engine): block dirty integration merge landings

Refuse AI merge landing on a checked-out dirty integration worktree by default. This prevents Fusion from stashing/restoring unrelated project-root edits into main and then marking tasks done against contaminated state.

Fusion-Task-Id: FN-5780
This commit is contained in:
Phil Larson
2026-05-31 12:11:54 -07:00
parent 93e8a5f78a
commit 3dee395d67
8 changed files with 97 additions and 15 deletions

View File

@@ -444,6 +444,7 @@ export function SettingsModal({
mergeStrategy: "direct",
mergeIntegrationWorktree: "reuse-task-worktree",
mergeAdvanceAutoSync: "stash-and-ff",
merger: { mode: "ai", maxReviewPasses: 3, allowDirtyLocalCheckoutSync: false },
recycleWorktrees: false,
executorAllowSiblingBranchRename: false,
worktreeNaming: "random",
@@ -4629,6 +4630,31 @@ export function SettingsModal({
/>
<small>AI corrective rounds before landing the best result (advisory concern) or hard-failing (unfixable correctness concern). Default 3. The reviewer uses your project&apos;s reviewer/validator model.</small>
</div>
<div className="form-group">
<label htmlFor="mergerAllowDirtyLocalCheckoutSync" className="checkbox-label">
<input
id="mergerAllowDirtyLocalCheckoutSync"
type="checkbox"
checked={form.merger?.allowDirtyLocalCheckoutSync === true}
onChange={(e) =>
setForm((f) => ({
...f,
merger: { ...(f.merger ?? {}), allowDirtyLocalCheckoutSync: e.target.checked },
}))
}
/>
Allow AI merge to sync a dirty checked-out integration branch
</label>
<details className="settings-option-details">
<summary>More details</summary>
<small>
Dangerous compatibility escape hatch. Leave off unless you explicitly want the legacy
stash → fast-forward → restore behavior when your checked-out integration branch has
unrelated local edits. When off, AI merge blocks before advancing the branch so dirty
project-root edits cannot contaminate a completed merge.
</small>
</details>
</div>
</>
)}
<div className="form-group">