fix(api): log only genuine processing faults at error level

The earlier worker error-logging change logged every job failure at error level, including expected InputValidationErrors (e.g. 'needs at least two audio files') -- flooding error logs with non-actionable user-input rejections (visible across the integration run). Skip validation errors (matched by name, which survives the BullMQ boundary); genuine faults still log at error, and all failures still reach the OTel span.
This commit is contained in:
SnapOtter
2026-06-17 14:28:41 +08:00
parent c483897452
commit 965501aef9
+6 -3
View File
@@ -340,9 +340,12 @@ async function processToolJob(job: Job<ToolJobData>): Promise<ToolJobResult> {
? `Timed out after ${Math.round(timeoutMs / 1000)}s`
: errorMessage;
// Keep the full error (incl. raw tool stderr) in server logs; clients only
// ever see friendlyError(finalError).
if (!isCanceled && !isTimeout) {
// Log genuine processing faults at error level (clients only ever see
// friendlyError(finalError)). Expected validation rejections -- bad user
// input, not a server fault -- would otherwise flood error logs, so skip
// them here; they still reach the OTel span recorded below.
const isValidationError = err instanceof Error && err.name === "InputValidationError";
if (!isCanceled && !isTimeout && !isValidationError) {
logger.error({ err, jobId, toolId: data.toolId }, "tool job failed");
}