Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions apps/webapp/app/v3/services/alerts/deliverAlert.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class DeliverAlertService extends BaseService {
}
} catch (error) {
if (error instanceof SkipRetryError) {
logger.error("[DeliverAlert] Skipping retry", {
logger.warn("[DeliverAlert] Skipping retry", {
reason: error.message,
});

Expand Down Expand Up @@ -951,7 +951,7 @@ export class DeliverAlertService extends BaseService {
return await client.chat.postMessage(message);
} catch (error) {
if (isWebAPIRateLimitedError(error)) {
logger.error("[DeliverAlert] Slack rate limited", {
logger.warn("[DeliverAlert] Slack rate limited", {
error,
message,
});
Expand All @@ -960,7 +960,7 @@ export class DeliverAlertService extends BaseService {
}

if (isWebAPIHTTPError(error)) {
logger.error("[DeliverAlert] Slack HTTP error", {
logger.warn("[DeliverAlert] Slack HTTP error", {
error,
message,
});
Expand All @@ -969,7 +969,7 @@ export class DeliverAlertService extends BaseService {
}

if (isWebAPIRequestError(error)) {
logger.error("[DeliverAlert] Slack request error", {
logger.warn("[DeliverAlert] Slack request error", {
error,
message,
});
Expand All @@ -978,7 +978,7 @@ export class DeliverAlertService extends BaseService {
}

if (isWebAPIPlatformError(error)) {
logger.error("[DeliverAlert] Slack platform error", {
logger.warn("[DeliverAlert] Slack platform error", {
error,
message,
});
Expand All @@ -991,10 +991,19 @@ export class DeliverAlertService extends BaseService {
throw new SkipRetryError("Slack invalid blocks");
}

if (error.data.error === "account_inactive") {
logger.info("[DeliverAlert] Slack account inactive, skipping retry", {
error,
message,
});

throw new SkipRetryError("Slack account inactive");
}

throw new Error("Slack platform error");
}

logger.error("[DeliverAlert] Failed to send slack message", {
logger.warn("[DeliverAlert] Failed to send slack message", {
error,
message,
});
Expand Down
9 changes: 5 additions & 4 deletions apps/webapp/app/v3/services/finalizeTaskRun.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class FinalizeTaskRunService extends BaseService {
}

if (isFatalRunStatus(run.status)) {
logger.error("FinalizeTaskRunService: Fatal status", { runId: run.id, status: run.status });
logger.warn("FinalizeTaskRunService: Fatal status", { runId: run.id, status: run.status });

const extendedRun = await this._prisma.taskRun.findFirst({
where: { id: run.id },
Expand All @@ -170,7 +170,7 @@ export class FinalizeTaskRunService extends BaseService {
});

if (extendedRun && extendedRun.runtimeEnvironment.type !== "DEVELOPMENT") {
logger.error("FinalizeTaskRunService: Fatal status, requesting worker exit", {
logger.warn("FinalizeTaskRunService: Fatal status, requesting worker exit", {
runId: run.id,
status: run.status,
});
Expand Down Expand Up @@ -305,9 +305,10 @@ export class FinalizeTaskRunService extends BaseService {
});

if (!run.lockedById) {
logger.error(
// This happens when a run is expired or was cancelled before an attempt, it's not a problem
logger.info(
"FinalizeTaskRunService: No lockedById, so can't get the BackgroundWorkerTask. Not creating an attempt.",
{ runId: run.id }
{ runId: run.id, status: run.status }
);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class CheckpointSystem {
snapshot.executionStatus === "QUEUED_EXECUTING");

if (!isValidSnapshot) {
this.$.logger.error("Tried to createCheckpoint on an invalid snapshot", {
this.$.logger.info("Tried to createCheckpoint on an invalid snapshot", {
snapshot,
snapshotId,
});
Expand Down
15 changes: 11 additions & 4 deletions internal-packages/run-engine/src/engine/systems/dequeueSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PrismaClientOrTransaction } from "@trigger.dev/database";
import { getRunWithBackgroundWorkerTasks } from "../db/worker.js";
import { sendNotificationToWorker } from "../eventBus.js";
import { getMachinePreset } from "../machinePresets.js";
import { isDequeueableExecutionStatus } from "../statuses.js";
import { isDequeueableExecutionStatus, isExecuting } from "../statuses.js";
import { RunEngineOptions } from "../types.js";
import { ExecutionSnapshotSystem, getLatestExecutionSnapshot } from "./executionSnapshotSystem.js";
import { RunAttemptSystem } from "./runAttemptSystem.js";
Expand Down Expand Up @@ -132,9 +132,16 @@ export class DequeueSystem {
},
tx: prisma,
});
this.$.logger.error(
`RunEngine.dequeueFromWorkerQueue(): Run is not in a valid state to be dequeued: ${runId}\n ${snapshot.id}:${snapshot.executionStatus}`
);

if (isExecuting(snapshot.executionStatus)) {
this.$.logger.error(
`RunEngine.dequeueFromWorkerQueue(): Run is not in a valid state to be dequeued: ${runId}\n ${snapshot.id}:${snapshot.executionStatus}`
);
} else {
this.$.logger.warn(
`RunEngine.dequeueFromWorkerQueue(): Run is in an expected not valid state to be dequeued: ${runId}\n ${snapshot.id}:${snapshot.executionStatus}`
);
}

return;
}
Expand Down
Loading