Skip to content
Closed
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
7 changes: 7 additions & 0 deletions .changeset/fix-v3-executing-tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@trigger.dev/core": patch
---

fix(v3): remove executing tasks waiting to deploy

Removes the executing tasks that are waiting to deploy from the task list. This fixes an issue where tasks in EXECUTING state but waiting for deployment were incorrectly displayed.
Comment on lines +1 to +7

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Release note added to the wrong product, publishing an npm package with an unrelated note

A note for a change that only touches the server app is filed against the published @trigger.dev/core package ("@trigger.dev/core": patch at .changeset/fix-v3-executing-tasks.md:2) instead of the server-changes folder, so a package release is cut with a changelog entry describing work that never happened in that package.
Impact: Users see a version bump and release note for a package that did not change, and the actual server change is missing from server release notes.

Repository rule: changesets are only for packages/*, server-only changes use .server-changes/

AGENTS.md ("Changesets and Server Changes") and CONTRIBUTING.md ("Adding server changes") state: "When modifying only server components (apps/webapp/, apps/supervisor/, etc.) with no package changes, add a .server-changes/ file instead." All code in this PR is under apps/webapp/ (apps/webapp/app/services/worker.server.ts, apps/webapp/app/v3/commonWorker.server.ts, apps/webapp/app/v3/services/changeCurrentDeployment.server.ts, apps/webapp/app/v3/services/createDeploymentBackgroundWorkerV3.server.ts, and the deleted apps/webapp/app/v3/services/executeTasksWaitingForDeploy.ts); no file under packages/ is touched.

Additionally the body violates "Write the description for users, not maintainers" — fix(v3): remove executing tasks waiting to deploy is a commit-style, implementation-named line, and the second paragraph describes internal run states (EXECUTING, deployment waiting) rather than user-visible behavior.

Prompt for agents
This PR only changes files under apps/webapp/, so per AGENTS.md and CONTRIBUTING.md it must not add a changeset for a published package. Delete .changeset/fix-v3-executing-tasks.md and instead add a .server-changes/ markdown file with frontmatter `area: webapp` and `type: fix` (see .server-changes/README.md), with a one-line, user-facing description that avoids internal tool/state names and describes the behavior change for users.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

6 changes: 1 addition & 5 deletions apps/webapp/app/services/worker.server.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Formatting change will fail the automated code-quality check

An empty function body is rewritten with a space inside the braces (async (payload, job) => { } at apps/webapp/app/services/worker.server.ts:291), which the repository's auto-formatter will rewrite, so the required formatting check fails.
Impact: The pull request's CI code-quality job fails until the formatting is reverted.

Rule reference

AGENTS.md ("Formatting and linting") states format/lint are enforced by CI (code-quality check) and CONTRIBUTING.md requires running pnpm run format before pushing; oxfmt normalizes empty blocks to {} (as they were before this diff).

(Refers to line 291)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
} from "~/v3/services/cancelDevSessionRuns.server";
import { CancelTaskAttemptDependenciesService } from "~/v3/services/cancelTaskAttemptDependencies.server";
import { EnqueueDelayedRunService } from "~/v3/services/enqueueDelayedRun.server";
import { ExecuteTasksWaitingForDeployService } from "~/v3/services/executeTasksWaitingForDeploy";
import { ExpireEnqueuedRunService } from "~/v3/services/expireEnqueuedRun.server";
import { ResumeBatchRunService } from "~/v3/services/resumeBatchRun.server";
import { ResumeTaskDependencyService } from "~/v3/services/resumeTaskDependency.server";
Expand Down Expand Up @@ -220,9 +219,6 @@ function getWorkerQueue() {
priority: 0,
maxAttempts: 5,
handler: async (payload, job) => {
const service = new ExecuteTasksWaitingForDeployService();

return await service.call(payload.backgroundWorkerId);
},
},
// @deprecated, moved to ScheduleEngine
Expand Down Expand Up @@ -288,7 +284,7 @@ function getWorkerQueue() {
"v3.requeueTaskRun": {
priority: 0,
maxAttempts: 3,
handler: async (payload, job) => {}, // This is now handled by redisWorker
handler: async (payload, job) => { }, // This is now handled by redisWorker
},
// @deprecated, moved to commonWorker.server.ts
"v3.retryAttempt": {
Expand Down
3 changes: 0 additions & 3 deletions apps/webapp/app/v3/commonWorker.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { BatchTriggerV3Service } from "./services/batchTriggerV3.server";
import { CancelDevSessionRunsService } from "./services/cancelDevSessionRuns.server";
import { CancelTaskAttemptDependenciesService } from "./services/cancelTaskAttemptDependencies.server";
import { EnqueueDelayedRunService } from "./services/enqueueDelayedRun.server";
import { ExecuteTasksWaitingForDeployService } from "./services/executeTasksWaitingForDeploy";
import { ExpireEnqueuedRunService } from "./services/expireEnqueuedRun.server";
import { ResumeBatchRunService } from "./services/resumeBatchRun.server";
import { ResumeTaskDependencyService } from "./services/resumeTaskDependency.server";
Expand Down Expand Up @@ -252,8 +251,6 @@ function initializeWorker() {
await service.call(payload.deploymentId, payload.fromStatus, payload.errorMessage);
},
"v3.executeTasksWaitingForDeploy": async ({ payload }) => {
const service = new ExecuteTasksWaitingForDeployService();
await service.call(payload.backgroundWorkerId);
},
"v3.retryAttempt": async ({ payload }) => {
const service = new RetryAttemptService();
Expand Down
12 changes: 0 additions & 12 deletions apps/webapp/app/v3/services/changeCurrentDeployment.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { taskMetadataCacheInstance } from "~/services/taskMetadataCacheInstance.server";
import { BaseService, ServiceValidationError } from "./baseService.server";
import { syncDeclarativeSchedules } from "./createBackgroundWorker.server";
import { ExecuteTasksWaitingForDeployService } from "./executeTasksWaitingForDeploy";
import { compareDeploymentVersions } from "../utils/deploymentVersions";

export type ChangeCurrentDeploymentDirection = "promote" | "rollback";
Expand Down Expand Up @@ -175,17 +174,6 @@ export class ChangeCurrentDeploymentService extends BaseService {
});
}

// Only V1 engine workers need the WAITING_FOR_DEPLOY drain — V2 runs sit
// in PENDING_VERSION and are handled out of band, so enqueuing here for V2
// just produces empty scans of the TaskRun status index.
const worker = await this._prisma.backgroundWorker.findFirst({
where: { id: deployment.workerId },
select: { engine: true },
});

if (worker?.engine === "V1") {
await ExecuteTasksWaitingForDeployService.enqueue(deployment.workerId);
}
}
Comment on lines 176 to 177

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Legacy V1 runs can still enter WAITING_FOR_DEPLOY with no drain left

The V1 shared queue consumer still transitions runs into WAITING_FOR_DEPLOY (apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts:1433-1444). With the drain service deleted and both enqueue sites removed (here and in apps/webapp/app/v3/services/createDeploymentBackgroundWorkerV3.server.ts:212), nothing in the webapp flips those runs back to PENDING or re-enqueues them into MarQS, so any V1 run parked in that state would stay there indefinitely. Worth confirming that no V1 engine environments remain that can still hit the shared queue consumer path, otherwise the consumer-side marking should be removed/failed-fast too.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


async #syncSchedulesForDeployment(deployment: WorkerDeployment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
stripBackgroundWorkerMetadataForStorage,
syncDeclarativeSchedules,
} from "./createBackgroundWorker.server";
import { ExecuteTasksWaitingForDeployService } from "./executeTasksWaitingForDeploy";
import { projectPubSub } from "./projectPubSub.server";
import { TimeoutDeploymentService } from "./timeoutDeployment.server";
import { CURRENT_DEPLOYMENT_LABEL, BackgroundWorkerId } from "@trigger.dev/core/v3/isomorphic";
Expand Down Expand Up @@ -209,7 +208,6 @@ export class CreateDeploymentBackgroundWorkerServiceV3 extends BaseService {
});
}

await ExecuteTasksWaitingForDeployService.enqueue(backgroundWorker.id);
await PerformDeploymentAlertsService.enqueue(deployment.id);
await TimeoutDeploymentService.dequeue(deployment.id, this._prisma);

Expand Down
142 changes: 0 additions & 142 deletions apps/webapp/app/v3/services/executeTasksWaitingForDeploy.ts

This file was deleted.