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

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.

🟡 Changeset targets @trigger.dev/core but no package code was changed — should be a .server-changes/ file

The changeset declares "@trigger.dev/core": patch but this PR only changes files in apps/webapp/. No files under packages/core/ (or any other packages/ directory) were modified. Per the CONTRIBUTING.md rules table, server-only PRs should add a .server-changes/ file instead of a changeset. This changeset would cause a spurious patch release of @trigger.dev/core with no actual code changes, creating noise for downstream consumers.

Prompt for agents
The changeset file .changeset/fix-v3-executing-tasks.md references @trigger.dev/core: patch, but this PR only modifies files in apps/webapp/ (server-only changes). Per CONTRIBUTING.md, server-only changes should not use a changeset. Instead:

1. Delete .changeset/fix-v3-executing-tasks.md
2. Create a new file .server-changes/fix-v3-executing-tasks.md with the content:

---
area: webapp
type: fix
---

Remove ExecuteTasksWaitingForDeployService and its no-op handlers for the legacy V1 WAITING_FOR_DEPLOY drain
Open in Devin Review

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

---

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 +5 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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Make the changeset description user-facing.

This currently leads with internal v3 terminology and exposes the EXECUTING implementation state. Use one plain sentence describing the user-visible behavior instead:

-fix(v3): remove executing tasks waiting to deploy
-
-Removes the executing tasks that are waiting for deploy from the task list. This fixes an issue where tasks in EXECUTING state but waiting for deployment were incorrectly displayed.
+Tasks waiting for deployment are no longer shown in the task list.

As per coding guidelines: “In changesets and .server-changes/ notes, write the description for users rather than maintainers, leading with what changed for the user in one plain sentence and avoiding internal tool or infrastructure names.”

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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.
Tasks waiting for deployment are no longer shown in the task list.
🧰 Tools
🪛 LanguageTool

[style] ~7-~7: Consider using a different verb for a more formal wording.
Context: ...ting to deploy from the task list. This fixes an issue where tasks in EXECUTING state...

(FIX_RESOLVE)

Source: Coding guidelines

6 changes: 1 addition & 5 deletions apps/webapp/app/services/worker.server.ts
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

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.

🚩 V1 engine WAITING_FOR_DEPLOY runs will no longer be drained on deployment

The removed code in changeCurrentDeployment.server.ts specifically guarded the ExecuteTasksWaitingForDeployService.enqueue call behind a worker?.engine === 'V1' check. This means V1 engine workers that have runs stuck in WAITING_FOR_DEPLOY status will no longer have those runs transitioned to PENDING and enqueued into marqs when a new deployment is promoted. The WAITING_FOR_DEPLOY status still exists in the database schema (internal-packages/database/prisma/schema.prisma:1137) and is referenced throughout the UI code. If there are still active V1 engine environments, this could leave runs permanently stuck. However, per the CLAUDE.md architecture notes, V1 is in deprecation mode and all new work targets V2/Run Engine 2.0, which uses PENDING_VERSION instead. The deleted service also had a kill-switch env var (LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_DISABLED), suggesting this was already being phased out.

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 @@ -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);
}
}

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.