From decf7ab8b44b7b8e7a6e70aead773edf262bcb04 Mon Sep 17 00:00:00 2001 From: lezi-fun <177434121+lezi-fun@users.noreply.github.com> Date: Fri, 14 Aug 2026 13:54:13 +0800 Subject: [PATCH] fix: extend conflict resolution budgets --- src/review/conflictResolver.ts | 22 ++++++++++++---------- test/conflict-resolver.test.ts | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/review/conflictResolver.ts b/src/review/conflictResolver.ts index 389c859..28a9bf0 100644 --- a/src/review/conflictResolver.ts +++ b/src/review/conflictResolver.ts @@ -32,9 +32,11 @@ const finalConfirmationSchema = z.object({ concerns: z.array(z.string()) }); -const CONFLICT_TOTAL_TIMEOUT_MS = 12 * 60 * 1000; -const CONFLICT_AGENT_TIMEOUT_MS = 4 * 60 * 1000; -const CONFLICT_VALIDATION_TIMEOUT_MS = 3 * 60 * 1000; +const CONFLICT_TOTAL_TIMEOUT_MS = 25 * 60 * 1000; +const CONFLICT_INITIAL_AGENT_TIMEOUT_MS = 10 * 60 * 1000; +const CONFLICT_CORRECTION_AGENT_TIMEOUT_MS = 5 * 60 * 1000; +const CONFLICT_VALIDATION_TIMEOUT_MS = 7 * 60 * 1000; +const CONFLICT_CONFIRMATION_TIMEOUT_MS = 5 * 60 * 1000; type SnapshotFile = { hash: string; @@ -176,7 +178,7 @@ export async function resolvePullRequestConflicts( const beforeAgent = await inventorySnapshot(snapshot); try { await runGooseAgent(buildConflictPrompt(params, conflictFiles), snapshot, { - timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) + timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_INITIAL_AGENT_TIMEOUT_MS) }); } catch (error) { if (error instanceof Error && error.message.toLowerCase().includes("timed out")) { @@ -240,7 +242,7 @@ export async function resolvePullRequestConflicts( const previousAgent = afterAgent; try { await runGooseAgent(buildDiffCheckRepairPrompt(commandFailureOutput(diffCheck)), snapshot, { - timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) + timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_CORRECTION_AGENT_TIMEOUT_MS) }); } catch (error) { if (error instanceof Error && error.message.toLowerCase().includes("timed out")) { @@ -293,7 +295,7 @@ export async function resolvePullRequestConflicts( testCommand: config.conflictTestCommand, output: validationSummary }), snapshot, { - timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) + timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_CORRECTION_AGENT_TIMEOUT_MS) }); afterAgent = await inventorySnapshot(snapshot); const validationRepairChanges = diffSnapshotInventories(previousAgent, afterAgent); @@ -360,7 +362,7 @@ export async function resolvePullRequestConflicts( diff: finalDiff, repositoryKnowledge: knowledge, validationSummary - }, snapshot, remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS)); + }, snapshot, remainingConflictTime(resolutionStartedAt, CONFLICT_CONFIRMATION_TIMEOUT_MS)); const afterConfirmation = await inventorySnapshot(snapshot); if (diffSnapshotInventories(beforeConfirmation, afterConfirmation).length > 0) { throw new Error("Final goose confirmation modified the workspace during its read-only pass."); @@ -511,13 +513,13 @@ export function describeConflictResolutionFailure(error: unknown): string { return "goose produced a candidate resolution, but the configured validation or final safety confirmation rejected it. No commit was pushed."; } if (message.includes("conflict resolution timed out")) { - return "Conflict repair exceeded its 12-minute total time budget and stopped safely. No commit was pushed."; + return "Conflict repair exceeded its 25-minute total time budget and stopped safely. No commit was pushed."; } if (message.includes("initial goose conflict-editing pass timed out")) { - return "The initial conflict-editing pass exceeded its 4-minute limit. No commit was pushed."; + return "The initial conflict-editing pass exceeded its 10-minute limit. No commit was pushed."; } if (message.includes("git diff --check goose correction timed out")) { - return "The whitespace or conflict-marker correction pass exceeded its 4-minute limit. No commit was pushed."; + return "The whitespace or conflict-marker correction pass exceeded its 5-minute limit. No commit was pushed."; } if (message.includes("git diff --check failed")) { return "The candidate resolution still contained Git whitespace or conflict-marker errors after one automatic correction pass. No commit was pushed."; diff --git a/test/conflict-resolver.test.ts b/test/conflict-resolver.test.ts index d73e900..5c54f8f 100644 --- a/test/conflict-resolver.test.ts +++ b/test/conflict-resolver.test.ts @@ -82,11 +82,11 @@ test("conflict failures are actionable without exposing raw command output", () ); assert.match( describeConflictResolutionFailure(new Error("git diff --check goose correction timed out")), - /4-minute limit/ + /5-minute limit/ ); assert.match( describeConflictResolutionFailure(new Error("initial goose conflict-editing pass timed out")), - /initial conflict-editing pass.*4-minute limit/i + /initial conflict-editing pass.*10-minute limit/i ); assert.match( describeConflictResolutionFailure(new Error("rejected: stale info")),