Quiet the logs and capture the errors that were missing
- Activity page: "Delete all" empties the open tab (api/admin/logs/clear-logs, super admin only, logged under system) - Stop logging every WebSocket connect - Log unexpected API errors (safeErrorMessage -> logUnexpectedError), every failed bot job attempt and every job the queue lost - Drop the cron jobs' console output; a failed model sync goes to the logs Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -290,6 +290,38 @@ export default async function processBotJob({
|
||||
return null;
|
||||
});
|
||||
|
||||
/**
|
||||
* Every failed try is on the Activity page, so a model or provider
|
||||
* that keeps failing shows there and not only in one chat.
|
||||
*/
|
||||
if (failed) {
|
||||
const final = failed.status == "failed";
|
||||
|
||||
await logError({
|
||||
title: final
|
||||
? `Bot job #${job_id} failed`
|
||||
: `Bot job #${job_id} failed, retrying (try ${tries})`,
|
||||
error: timed_out ? new Error(timeout_message) : error,
|
||||
user_id: user_id || undefined,
|
||||
details: [
|
||||
{ label: "Bot", value: bot_id },
|
||||
{ label: "Kind", value: job.kind },
|
||||
{ label: "Title", value: job.title || "" },
|
||||
{ label: "Try", value: tries },
|
||||
],
|
||||
metadata: {
|
||||
job_id,
|
||||
bot_id,
|
||||
kind: job.kind,
|
||||
session_id: job.session_id,
|
||||
workspace_id: job.workspace_id,
|
||||
schedule_id,
|
||||
fatal: error instanceof BotJobFatalError,
|
||||
harness_code: error instanceof HarnessError ? error.code : undefined,
|
||||
},
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
if (failed?.notice) {
|
||||
await pushBotNotice({ bot_id, ...failed.notice });
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import grabUnreportedFailedBotJobs from "@/src/functions/backend/db/bots-queue/grab-unreported-failed-bot-jobs";
|
||||
import notifyBotJobFailed from "@/src/functions/backend/db/bots-queue/notify-bot-job-failed";
|
||||
import { logError } from "@/src/functions/backend/logger";
|
||||
import pushBotNotice from "./push-bot-notice";
|
||||
|
||||
/**
|
||||
* Tells the user about jobs that ran out of attempts by going silent
|
||||
* (bun-sqlite fails those itself, without a message).
|
||||
* (bun-sqlite fails those itself, without a message), and logs each.
|
||||
*/
|
||||
export default async function reportLostBotJobs() {
|
||||
const jobs = await grabUnreportedFailedBotJobs();
|
||||
@@ -18,5 +19,16 @@ export default async function reportLostBotJobs() {
|
||||
});
|
||||
|
||||
await pushBotNotice({ bot_id: job.bot_id, ...notice });
|
||||
|
||||
await logError({
|
||||
title: `Bot job #${job.id} lost`,
|
||||
error: job.last_error || "The job's lock timed out.",
|
||||
details: [
|
||||
{ label: "Bot", value: job.bot_id },
|
||||
{ label: "Kind", value: job.kind },
|
||||
{ label: "Title", value: job.title || "" },
|
||||
],
|
||||
metadata: { job_id: job.id, bot_id: job.bot_id, kind: job.kind },
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user