Skip to content

Commit 322e1b6

Browse files
authored
Merge branch 'main' into docs/python-doc-to-markdown
2 parents 3372859 + f579afb commit 322e1b6

File tree

93 files changed

+4806
-1196
lines changed

Some content is hidden

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

93 files changed

+4806
-1196
lines changed

.changeset/pre.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
"shiny-kiwis-beam",
3434
"smart-coins-hammer",
3535
"sour-mirrors-accept",
36+
"spotty-ducks-punch",
3637
"spotty-pants-wink",
38+
"tender-jobs-collect",
39+
"tidy-books-smell",
3740
"tiny-buckets-teach",
3841
"tricky-houses-invite",
3942
"two-tigers-dream",

.changeset/spotty-ducks-punch.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+
fix: default machine config indexing now works

.changeset/tender-jobs-collect.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+
TriggerApiError 4xx errors will no longer cause tasks to be retried

.changeset/tidy-books-smell.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
- Fix polling interval reset bug that could create duplicate intervals
7+
- Protect against unexpected attempt number changes
8+
- Prevent run execution zombies after warm starts

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
{
2626
"type": "node-terminal",
2727
"request": "launch",
28-
"name": "Debug fairDequeuingStrategy.test.ts",
29-
"command": "pnpm run test -t FairDequeuingStrategy",
28+
"name": "Debug triggerTask.test.ts",
29+
"command": "pnpm run test --run ./test/engine/triggerTask.test.ts",
3030
"envFile": "${workspaceFolder}/.env",
3131
"cwd": "${workspaceFolder}/apps/webapp",
3232
"sourceMaps": true

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,8 +841,8 @@ function BatchIdDropdown({
841841
if (batchId) {
842842
if (!batchId.startsWith("batch_")) {
843843
error = "Batch IDs start with 'batch_'";
844-
} else if (batchId.length !== 27) {
845-
error = "Batch IDs are 27 characters long";
844+
} else if (batchId.length !== 27 && batchId.length !== 31) {
845+
error = "Batch IDs are 27 or 31 characters long";
846846
}
847847
}
848848

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ export function SpanEventError({
8383
time={spanEvent.time}
8484
titleClassName="text-rose-500"
8585
/>
86-
{enhancedException.message && <Callout variant="error">{enhancedException.message}</Callout>}
86+
{enhancedException.message && (
87+
<Callout variant="error">
88+
<pre className="text-wrap font-sans text-sm font-normal text-rose-200">
89+
{enhancedException.message}
90+
</pre>
91+
</Callout>
92+
)}
8793
{enhancedException.link &&
8894
(enhancedException.link.magic === "CONTACT_FORM" ? (
8995
<Feedback

apps/webapp/app/env.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ const EnvironmentSchema = z.object({
384384
.int()
385385
.default(60 * 1000 * 15),
386386
MARQS_SHARED_QUEUE_LIMIT: z.coerce.number().int().default(1000),
387+
MARQS_MAXIMUM_QUEUE_PER_ENV_COUNT: z.coerce.number().int().default(50),
387388
MARQS_DEV_QUEUE_LIMIT: z.coerce.number().int().default(1000),
388389
MARQS_MAXIMUM_NACK_COUNT: z.coerce.number().int().default(64),
389390
MARQS_CONCURRENCY_LIMIT_BIAS: z.coerce.number().default(0.75),
@@ -459,7 +460,6 @@ const EnvironmentSchema = z.object({
459460
RUN_ENGINE_REUSE_SNAPSHOT_COUNT: z.coerce.number().int().default(0),
460461
RUN_ENGINE_MAXIMUM_ENV_COUNT: z.coerce.number().int().optional(),
461462
RUN_ENGINE_WORKER_SHUTDOWN_TIMEOUT_MS: z.coerce.number().int().default(60_000),
462-
RUN_ENGINE_MAX_DEQUEUE_LOOP_ATTEMPTS: z.coerce.number().int().default(10),
463463

464464
RUN_ENGINE_WORKER_REDIS_HOST: z
465465
.string()

apps/webapp/app/presenters/v3/NewAlertChannelPresenter.server.ts

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,47 @@ async function getSlackChannelsForToken(integration: AuthenticatableIntegration)
100100

101101
type Channels = Awaited<ReturnType<WebClient["conversations"]["list"]>>["channels"];
102102

103-
async function getSlackConversationsPage(client: WebClient, nextCursor?: string) {
104-
return client.conversations.list({
105-
types: "public_channel,private_channel",
106-
exclude_archived: true,
107-
cursor: nextCursor,
108-
});
109-
}
110-
111103
async function getAllSlackConversations(client: WebClient) {
112104
let nextCursor: string | undefined = undefined;
113105
let channels: Channels = [];
114106

115-
do {
116-
const response = await getSlackConversationsPage(client, nextCursor);
117-
118-
if (!response.ok) {
119-
throw new Error(`Failed to get channels: ${response.error}`);
107+
try {
108+
do {
109+
// The `tryCatch` util runs into a type error due to self referencing.
110+
// So we fall back to a good old try/catch block here.
111+
const response = await client.conversations.list({
112+
types: "public_channel,private_channel",
113+
exclude_archived: true,
114+
cursor: nextCursor,
115+
limit: 999,
116+
});
117+
118+
channels = channels.concat(response.channels ?? []);
119+
nextCursor = response.response_metadata?.next_cursor;
120+
} while (nextCursor);
121+
} catch (error) {
122+
if (error && isSlackError(error) && error.data.error === "ratelimited") {
123+
logger.warn("Rate limiting issue occurred while fetching Slack channels", {
124+
error,
125+
});
126+
127+
// This is a workaround to the current way we handle Slack channels for creating alerts.
128+
// For workspaces with a lot of channels (>10000) we might hit the rate limit for this slack endpoint,
129+
// as multiple requests are needed to fetch all channels.
130+
// We use the largest allowed page size of 999 to reduce the chance of hitting the rate limit.
131+
132+
// This is mainly due to workspaces with a large number of archived channels,
133+
// which this slack endpoint unfortunately filters out only after fetching the page of channels without applying any filters first.
134+
// https://api.slack.com/methods/conversations.list#markdown
135+
136+
// We expect most workspaces not to run into this issue, but if they do, we at least return some channels.
137+
// In the future, we might revisit the way we handle Slack channels and cache them on our side to support
138+
// proper searching. Until then, we track occurrences of this issue using a metric.
139+
return channels;
120140
}
121141

122-
channels = channels.concat(response.channels ?? []);
123-
nextCursor = response.response_metadata?.next_cursor;
124-
} while (nextCursor);
142+
throw error;
143+
}
125144

126145
return channels;
127146
}

apps/webapp/app/routes/api.v1.tasks.$taskId.trigger.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import { TaskRun } from "@trigger.dev/database";
88
import { z } from "zod";
99
import { env } from "~/env.server";
10+
import { EngineServiceValidationError } from "~/runEngine/concerns/errors";
1011
import { AuthenticatedEnvironment, getOneTimeUseToken } from "~/services/apiAuth.server";
1112
import { logger } from "~/services/logger.server";
1213
import { createActionApiRoute } from "~/services/routeBuilders/apiBuilder.server";
@@ -116,7 +117,9 @@ const { action, loader } = createActionApiRoute(
116117
);
117118
} catch (error) {
118119
if (error instanceof ServiceValidationError) {
119-
return json({ error: error.message }, { status: 422 });
120+
return json({ error: error.message }, { status: error.status ?? 422 });
121+
} else if (error instanceof EngineServiceValidationError) {
122+
return json({ error: error.message }, { status: error.status ?? 422 });
120123
} else if (error instanceof OutOfEntitlementError) {
121124
return json({ error: error.message }, { status: 422 });
122125
} else if (error instanceof Error) {

0 commit comments

Comments
 (0)