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

@@ -268,7 +268,7 @@ export const DEFAULT_PROJECT_SETTINGS = {
],
prerebaseDivergenceThreshold: 50,
mergeConflictStrategy: "smart-prefer-main",
merger: { mode: "ai", maxReviewPasses: 3 },
merger: { mode: "ai", maxReviewPasses: 3, allowDirtyLocalCheckoutSync: false },
mergeDiffVolumeMinLines: undefined,
mergeDiffVolumeThreshold: undefined,
mergeDiffVolumeAllowlist: undefined,

View File

@@ -367,6 +367,12 @@ export interface MergerSettings {
* hard-failing (blocking). Default: 3. The reviewer uses the project's
* validator/reviewer model lane — there is no merge-specific model setting. */
maxReviewPasses?: number;
/** Dangerous compatibility escape hatch for the AI merge landing path.
* When false (default), Fusion refuses to land an AI merge if the checked-out
* integration worktree is dirty. When true, restores the legacy stash →
* fast-forward → restore behavior for operators who explicitly accept that
* unrelated local edits can be reintroduced after landing. */
allowDirtyLocalCheckoutSync?: boolean;
}
export const AUTO_RECOVERY_MODES = ["off", "deterministic-only", "programmatic", "ai-assisted"] as const;