Guard against empty stdout when resolving merge conflicts

Claude can exit 0 but produce no output, leaving the file blank.
This commit is contained in:
Chris Wanstrath 2026-04-10 09:41:39 -07:00
parent b4d0d9e948
commit fbb8680376

View File

@ -127,7 +127,7 @@ export async function resolveConflicts(
"resolve this merge conflict. output ONLY the resolved file content with no markdown fences, no explanation, no surrounding text.",
)
if (resolved.exitCode !== 0) {
if (resolved.exitCode !== 0 || !resolved.stdout.trim()) {
const stderr = resolved.stderr.trim()
throw new Error(`Claude failed to resolve ${file}: ${stderr || "(no output)"}`)
}