Skip to content

Commit 1050b3d

Browse files
MaxLinCodeclaude
andcommitted
fix: log interpretWriteTurn failures instead of silently falling back
The catch block and Zod parse failure both returned fallbackInterpretation with no logging, making it impossible to diagnose why the LLM call was being skipped. Now logs the Zod error or exception details before falling back. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9ede728 commit 1050b3d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

apps/web/src/lib/server/interpret-write-turn.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@ export async function interpretWriteTurn(
1818
const parsed = rawWriteInterpretationSchema.safeParse(raw);
1919

2020
if (!parsed.success) {
21+
console.error("interpret_write_turn_parse_failed", {
22+
zodError: parsed.error.format(),
23+
rawOutput: raw,
24+
});
2125
return fallbackInterpretation(input);
2226
}
2327

2428
return normalizeRawWriteInterpretation(parsed.data, input.currentTurnText);
25-
} catch {
29+
} catch (err) {
30+
console.error("interpret_write_turn_error", {
31+
error: err instanceof Error ? err.message : String(err),
32+
stack: err instanceof Error ? err.stack : undefined,
33+
});
2634
return fallbackInterpretation(input);
2735
}
2836
}

0 commit comments

Comments
 (0)