fix: extend conflict resolution budgets

This commit is contained in:
lezi-fun committed 2026-08-14 13:54:13 +08:00
1 parent 508f6423c4
commit decf7ab8b4
2 files changed
+14 -12

No files matched your search

+12 -10
View File
@@ -32,9 +32,11 @@ const finalConfirmationSchema = z.object({
concerns: z.array(z.string()) concerns: z.array(z.string())
}); });
const CONFLICT_TOTAL_TIMEOUT_MS = 12 * 60 * 1000; const CONFLICT_TOTAL_TIMEOUT_MS = 25 * 60 * 1000;
const CONFLICT_AGENT_TIMEOUT_MS = 4 * 60 * 1000; const CONFLICT_INITIAL_AGENT_TIMEOUT_MS = 10 * 60 * 1000;
const CONFLICT_VALIDATION_TIMEOUT_MS = 3 * 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 = { type SnapshotFile = {
hash: string; hash: string;
@@ -176,7 +178,7 @@ export async function resolvePullRequestConflicts(
const beforeAgent = await inventorySnapshot(snapshot); const beforeAgent = await inventorySnapshot(snapshot);
try { try {
await runGooseAgent(buildConflictPrompt(params, conflictFiles), snapshot, { await runGooseAgent(buildConflictPrompt(params, conflictFiles), snapshot, {
timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_INITIAL_AGENT_TIMEOUT_MS)
}); });
} catch (error) { } catch (error) {
if (error instanceof Error && error.message.toLowerCase().includes("timed out")) { if (error instanceof Error && error.message.toLowerCase().includes("timed out")) {
@@ -240,7 +242,7 @@ export async function resolvePullRequestConflicts(
const previousAgent = afterAgent; const previousAgent = afterAgent;
try { try {
await runGooseAgent(buildDiffCheckRepairPrompt(commandFailureOutput(diffCheck)), snapshot, { await runGooseAgent(buildDiffCheckRepairPrompt(commandFailureOutput(diffCheck)), snapshot, {
timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_CORRECTION_AGENT_TIMEOUT_MS)
}); });
} catch (error) { } catch (error) {
if (error instanceof Error && error.message.toLowerCase().includes("timed out")) { if (error instanceof Error && error.message.toLowerCase().includes("timed out")) {
@@ -293,7 +295,7 @@ export async function resolvePullRequestConflicts(
testCommand: config.conflictTestCommand, testCommand: config.conflictTestCommand,
output: validationSummary output: validationSummary
}), snapshot, { }), snapshot, {
timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS) timeoutMs: remainingConflictTime(resolutionStartedAt, CONFLICT_CORRECTION_AGENT_TIMEOUT_MS)
}); });
afterAgent = await inventorySnapshot(snapshot); afterAgent = await inventorySnapshot(snapshot);
const validationRepairChanges = diffSnapshotInventories(previousAgent, afterAgent); const validationRepairChanges = diffSnapshotInventories(previousAgent, afterAgent);
@@ -360,7 +362,7 @@ export async function resolvePullRequestConflicts(
diff: finalDiff, diff: finalDiff,
repositoryKnowledge: knowledge, repositoryKnowledge: knowledge,
validationSummary validationSummary
}, snapshot, remainingConflictTime(resolutionStartedAt, CONFLICT_AGENT_TIMEOUT_MS)); }, snapshot, remainingConflictTime(resolutionStartedAt, CONFLICT_CONFIRMATION_TIMEOUT_MS));
const afterConfirmation = await inventorySnapshot(snapshot); const afterConfirmation = await inventorySnapshot(snapshot);
if (diffSnapshotInventories(beforeConfirmation, afterConfirmation).length > 0) { if (diffSnapshotInventories(beforeConfirmation, afterConfirmation).length > 0) {
throw new Error("Final goose confirmation modified the workspace during its read-only pass."); 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."; 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")) { 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")) { 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")) { 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")) { 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."; return "The candidate resolution still contained Git whitespace or conflict-marker errors after one automatic correction pass. No commit was pushed.";
+2 -2
View File
@@ -82,11 +82,11 @@ test("conflict failures are actionable without exposing raw command output", ()
); );
assert.match( assert.match(
describeConflictResolutionFailure(new Error("git diff --check goose correction timed out")), describeConflictResolutionFailure(new Error("git diff --check goose correction timed out")),
/4-minute limit/ /5-minute limit/
); );
assert.match( assert.match(
describeConflictResolutionFailure(new Error("initial goose conflict-editing pass timed out")), 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( assert.match(
describeConflictResolutionFailure(new Error("rejected: stale info")), describeConflictResolutionFailure(new Error("rejected: stale info")),