Skip to content

Commit ce75f57

Browse files
authored
Merge branch 'main' into eslint-no-trigger-core-import
2 parents 7270f48 + 0e77e7e commit ce75f57

File tree

90 files changed

+1665
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1665
-377
lines changed

.changeset/fast-colts-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Increase dev worker timeout

.changeset/friendly-walls-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Add sox and audiowaveform binaries to worker images

.changeset/modern-stingrays-end.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@trigger.dev/sdk": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
v3: Trigger delayed runs and reschedule them

.changeset/nervous-planets-sparkle.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
- Improve non-zero exit code error messages
7+
- Detect OOM conditions within worker child processes
8+
- Internal errors can have optional stack traces
9+
- Docker provider can be set to enforce machine presets

.changeset/purple-spiders-care.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
Await file watcher cleanup in dev

.changeset/silly-forks-kiss.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
v3: Copy over more of the project's package.json keys into the deployed package.json (support for custom config like zenstack)

.changeset/spicy-frogs-remain.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
- Prevent downgrades during update check and advise to upgrade CLI
6+
- Detect bun and use npm instead
7+
- During init, fail early and advise if not a TypeScript project
8+
- During init, allow specifying custom package manager args
9+
- Add links to dev worker started message
10+
- Fix links in unsupported terminals

.changeset/tall-masks-repeat.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@trigger.dev/core-apps": patch
3+
"trigger.dev": patch
4+
"@trigger.dev/core": patch
5+
---
6+
7+
- Fix artifact detection logs
8+
- Fix OOM detection and error messages
9+
- Add test link to cli deployment completion

.changeset/tame-apricots-clap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"trigger.dev": patch
3+
---
4+
5+
v3: postInstall config option now replaces the postinstall script found in package.json

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ jobs:
4949
uses: ./.github/workflows/unit-tests.yml
5050
secrets: inherit
5151

52-
e2e:
53-
uses: ./.github/workflows/e2e.yml
54-
with:
55-
package: cli-v3
56-
secrets: inherit
52+
# e2e:
53+
# uses: ./.github/workflows/e2e.yml
54+
# with:
55+
# package: cli-v3
56+
# secrets: inherit
5757

5858
publish:
5959
needs: [typecheck, units]

apps/docker-provider/src/index.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,27 @@ class DockerTaskOperations implements TaskOperations {
109109

110110
const containerName = this.#getRunContainerName(opts.runId);
111111

112+
const runArgs = [
113+
"run",
114+
"--network=host",
115+
"--detach",
116+
`--env=TRIGGER_ENV_ID=${opts.envId}`,
117+
`--env=TRIGGER_RUN_ID=${opts.runId}`,
118+
`--env=OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}`,
119+
`--env=POD_NAME=${containerName}`,
120+
`--env=COORDINATOR_HOST=${COORDINATOR_HOST}`,
121+
`--env=COORDINATOR_PORT=${COORDINATOR_PORT}`,
122+
`--name=${containerName}`,
123+
];
124+
125+
if (process.env.ENFORCE_MACHINE_PRESETS) {
126+
runArgs.push(`--cpus=${opts.machine.cpu}`, `--memory=${opts.machine.memory}G`);
127+
}
128+
129+
runArgs.push(`${opts.image}`);
130+
112131
try {
113-
logger.debug(
114-
await execa("docker", [
115-
"run",
116-
"--network=host",
117-
"--detach",
118-
`--env=TRIGGER_ENV_ID=${opts.envId}`,
119-
`--env=TRIGGER_RUN_ID=${opts.runId}`,
120-
`--env=OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}`,
121-
`--env=POD_NAME=${containerName}`,
122-
`--env=COORDINATOR_HOST=${COORDINATOR_HOST}`,
123-
`--env=COORDINATOR_PORT=${COORDINATOR_PORT}`,
124-
`--name=${containerName}`,
125-
`${opts.image}`,
126-
])
127-
);
132+
logger.debug(await execa("docker", runArgs));
128133
} catch (error) {
129134
if (!isExecaChildProcess(error)) {
130135
throw error;

apps/kubernetes-provider/src/index.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,27 +529,28 @@ provider.listen();
529529

530530
const taskMonitor = new TaskMonitor({
531531
runtimeEnv: RUNTIME_ENV,
532-
onIndexFailure: async (deploymentId, failureInfo) => {
533-
logger.log("Indexing failed", { deploymentId, failureInfo });
532+
onIndexFailure: async (deploymentId, details) => {
533+
logger.log("Indexing failed", { deploymentId, details });
534534

535535
try {
536536
provider.platformSocket.send("INDEXING_FAILED", {
537537
deploymentId,
538538
error: {
539-
name: `Crashed with exit code ${failureInfo.exitCode}`,
540-
message: failureInfo.reason,
541-
stack: failureInfo.logs,
539+
name: `Crashed with exit code ${details.exitCode}`,
540+
message: details.reason,
541+
stack: details.logs,
542542
},
543+
overrideCompletion: details.overrideCompletion,
543544
});
544545
} catch (error) {
545546
logger.error(error);
546547
}
547548
},
548-
onRunFailure: async (runId, failureInfo) => {
549-
logger.log("Run failed:", { runId, failureInfo });
549+
onRunFailure: async (runId, details) => {
550+
logger.log("Run failed:", { runId, details });
550551

551552
try {
552-
provider.platformSocket.send("WORKER_CRASHED", { runId, ...failureInfo });
553+
provider.platformSocket.send("WORKER_CRASHED", { runId, ...details });
553554
} catch (error) {
554555
logger.error(error);
555556
}

apps/kubernetes-provider/src/taskMonitor.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
import * as k8s from "@kubernetes/client-node";
22
import { SimpleLogger } from "@trigger.dev/core-apps";
3+
import { EXIT_CODE_ALREADY_HANDLED, EXIT_CODE_CHILD_NONZERO } from "@trigger.dev/core-apps/process";
34
import { setTimeout } from "timers/promises";
45
import PQueue from "p-queue";
6+
import type { Prettify } from "@trigger.dev/core/v3";
57

6-
type IndexFailureHandler = (
7-
deploymentId: string,
8-
failureInfo: {
9-
exitCode: number;
10-
reason: string;
11-
logs: string;
12-
}
13-
) => Promise<any>;
14-
15-
type RunFailureHandler = (
16-
runId: string,
17-
failureInfo: {
18-
exitCode: number;
19-
reason: string;
20-
logs: string;
21-
}
22-
) => Promise<any>;
8+
type FailureDetails = Prettify<{
9+
exitCode: number;
10+
reason: string;
11+
logs: string;
12+
overrideCompletion: boolean;
13+
}>;
14+
15+
type IndexFailureHandler = (deploymentId: string, details: FailureDetails) => Promise<any>;
16+
17+
type RunFailureHandler = (runId: string, details: FailureDetails) => Promise<any>;
2318

2419
type TaskMonitorOptions = {
2520
runtimeEnv: "local" | "kubernetes";
@@ -144,8 +139,7 @@ export class TaskMonitor {
144139
const containerState = this.#getContainerStateSummary(containerStatus.state);
145140
const exitCode = containerState.exitCode ?? -1;
146141

147-
// We use this special exit code to signal any errors were already handled elsewhere
148-
if (exitCode === 111) {
142+
if (exitCode === EXIT_CODE_ALREADY_HANDLED) {
149143
return;
150144
}
151145

@@ -162,6 +156,7 @@ export class TaskMonitor {
162156

163157
let reason = rawReason || "Unknown error";
164158
let logs = rawLogs || "";
159+
let overrideCompletion = false;
165160

166161
switch (rawReason) {
167162
case "Error":
@@ -181,7 +176,10 @@ export class TaskMonitor {
181176
}
182177
break;
183178
case "OOMKilled":
184-
reason = "Out of memory! Try increasing the memory on this task.";
179+
overrideCompletion = true;
180+
reason = `${
181+
exitCode === EXIT_CODE_CHILD_NONZERO ? "Child process" : "Parent process"
182+
} ran out of memory! Try choosing a machine preset with more memory for this task.`;
185183
break;
186184
default:
187185
break;
@@ -191,7 +189,8 @@ export class TaskMonitor {
191189
exitCode,
192190
reason,
193191
logs,
194-
};
192+
overrideCompletion,
193+
} satisfies FailureDetails;
195194

196195
const app = pod.metadata?.labels?.app;
197196

apps/webapp/app/components/runs/v3/RunFilters.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ function FilterMenu(props: RunFiltersProps) {
146146

147147
const filterTrigger = (
148148
<SelectTrigger
149-
autoFocus
150149
icon={
151150
<div className="flex size-4 items-center justify-center">
152151
<ListFilterIcon className="size-3.5" />

apps/webapp/app/components/runs/v3/TaskRunStatus.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import {
33
BoltSlashIcon,
44
BugAntIcon,
55
CheckCircleIcon,
6+
ClockIcon,
67
FireIcon,
78
NoSymbolIcon,
89
PauseCircleIcon,
910
RectangleStackIcon,
11+
TrashIcon,
1012
XCircleIcon,
1113
} from "@heroicons/react/20/solid";
1214
import { TaskRunStatus } from "@trigger.dev/database";
@@ -16,6 +18,7 @@ import { Spinner } from "~/components/primitives/Spinner";
1618
import { cn } from "~/utils/cn";
1719

1820
export const allTaskRunStatuses = [
21+
"DELAYED",
1922
"WAITING_FOR_DEPLOY",
2023
"PENDING",
2124
"EXECUTING",
@@ -28,10 +31,12 @@ export const allTaskRunStatuses = [
2831
"PAUSED",
2932
"INTERRUPTED",
3033
"SYSTEM_FAILURE",
34+
"EXPIRED",
3135
] as const satisfies Readonly<Array<TaskRunStatus>>;
3236

3337
export const filterableTaskRunStatuses = [
3438
"WAITING_FOR_DEPLOY",
39+
"DELAYED",
3540
"PENDING",
3641
"EXECUTING",
3742
"RETRYING_AFTER_FAILURE",
@@ -42,9 +47,11 @@ export const filterableTaskRunStatuses = [
4247
"CRASHED",
4348
"INTERRUPTED",
4449
"SYSTEM_FAILURE",
50+
"EXPIRED",
4551
] as const satisfies Readonly<Array<TaskRunStatus>>;
4652

4753
const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
54+
DELAYED: "Task has been delayed and is waiting to be executed",
4855
PENDING: "Task is waiting to be executed",
4956
WAITING_FOR_DEPLOY: "Task needs to be deployed first to start executing",
5057
EXECUTING: "Task is currently being executed",
@@ -57,9 +64,10 @@ const taskRunStatusDescriptions: Record<TaskRunStatus, string> = {
5764
SYSTEM_FAILURE: "Task has failed due to a system failure",
5865
PAUSED: "Task has been paused by the user",
5966
CRASHED: "Task has crashed and won't be retried",
67+
EXPIRED: "Task has surpassed its ttl and won't be executed",
6068
};
6169

62-
export const QUEUED_STATUSES: TaskRunStatus[] = ["PENDING", "WAITING_FOR_DEPLOY"];
70+
export const QUEUED_STATUSES: TaskRunStatus[] = ["PENDING", "WAITING_FOR_DEPLOY", "DELAYED"];
6371

6472
export const RUNNING_STATUSES: TaskRunStatus[] = [
6573
"EXECUTING",
@@ -74,6 +82,7 @@ export const FINISHED_STATUSES: TaskRunStatus[] = [
7482
"INTERRUPTED",
7583
"SYSTEM_FAILURE",
7684
"CRASHED",
85+
"EXPIRED",
7786
];
7887

7988
export function descriptionForTaskRunStatus(status: TaskRunStatus): string {
@@ -109,6 +118,8 @@ export function TaskRunStatusIcon({
109118
className: string;
110119
}) {
111120
switch (status) {
121+
case "DELAYED":
122+
return <ClockIcon className={cn(runStatusClassNameColor(status), className)} />;
112123
case "PENDING":
113124
return <RectangleStackIcon className={cn(runStatusClassNameColor(status), className)} />;
114125
case "WAITING_FOR_DEPLOY":
@@ -133,6 +144,8 @@ export function TaskRunStatusIcon({
133144
return <BugAntIcon className={cn(runStatusClassNameColor(status), className)} />;
134145
case "CRASHED":
135146
return <FireIcon className={cn(runStatusClassNameColor(status), className)} />;
147+
case "EXPIRED":
148+
return <TrashIcon className={cn(runStatusClassNameColor(status), className)} />;
136149

137150
default: {
138151
assertNever(status);
@@ -143,6 +156,7 @@ export function TaskRunStatusIcon({
143156
export function runStatusClassNameColor(status: TaskRunStatus): string {
144157
switch (status) {
145158
case "PENDING":
159+
case "DELAYED":
146160
return "text-charcoal-500";
147161
case "WAITING_FOR_DEPLOY":
148162
return "text-amber-500";
@@ -154,6 +168,7 @@ export function runStatusClassNameColor(status: TaskRunStatus): string {
154168
case "PAUSED":
155169
return "text-amber-300";
156170
case "CANCELED":
171+
case "EXPIRED":
157172
return "text-charcoal-500";
158173
case "INTERRUPTED":
159174
return "text-error";
@@ -173,6 +188,8 @@ export function runStatusClassNameColor(status: TaskRunStatus): string {
173188

174189
export function runStatusTitle(status: TaskRunStatus): string {
175190
switch (status) {
191+
case "DELAYED":
192+
return "Delayed";
176193
case "PENDING":
177194
return "Queued";
178195
case "WAITING_FOR_DEPLOY":
@@ -197,6 +214,8 @@ export function runStatusTitle(status: TaskRunStatus): string {
197214
return "System failure";
198215
case "CRASHED":
199216
return "Crashed";
217+
case "EXPIRED":
218+
return "Expired";
200219
default: {
201220
assertNever(status);
202221
}

apps/webapp/app/components/runs/v3/TaskRunsTable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ export function TaskRunsTable({
118118
<TableHeaderCell>Duration</TableHeaderCell>
119119
<TableHeaderCell>Test</TableHeaderCell>
120120
<TableHeaderCell>Created at</TableHeaderCell>
121+
<TableHeaderCell>Delayed until</TableHeaderCell>
122+
<TableHeaderCell>TTL</TableHeaderCell>
121123
<TableHeaderCell>
122124
<span className="sr-only">Go to page</span>
123125
</TableHeaderCell>
124126
</TableRow>
125127
</TableHeader>
126128
<TableBody>
127129
{total === 0 && !hasFilters ? (
128-
<TableBlankRow colSpan={9}>
130+
<TableBlankRow colSpan={10}>
129131
{!isLoading && <NoRuns title="No runs found" />}
130132
</TableBlankRow>
131133
) : runs.length === 0 ? (
@@ -187,6 +189,10 @@ export function TaskRunsTable({
187189
<TableCell to={path}>
188190
{run.createdAt ? <DateTime date={run.createdAt} /> : "–"}
189191
</TableCell>
192+
<TableCell to={path}>
193+
{run.delayUntil ? <DateTime date={run.delayUntil} /> : "–"}
194+
</TableCell>
195+
<TableCell to={path}>{run.ttl ?? "–"}</TableCell>
190196
<RunActionsCell run={run} path={path} />
191197
</TableRow>
192198
);

0 commit comments

Comments
 (0)