Skip to content

Commit 5ba8557

Browse files
authored
chore(webapp,core): remove the end-of-life v3 (engine V1) execution stack (#4236)
## Summary v3 (the engine that ran the SDK v3 era, internally `RunEngineVersion.V1`) is end-of-life. Following the removal of the v3 execution apps ([#4194](#4194)) and the legacy dev websocket ([#4198](#4198)), this removes the remaining v3 execution stack from the server. Clients still on v3 (an old SDK or CLI that has not upgraded) keep getting a clear "upgrade to v4" response. Triggers, batch triggers, reschedules, and deploys that resolve to v3 are rejected with a graceful 4xx pointing at the migration guide, never a 5xx, so a stale client cannot affect server health. Self-hosted instances still running v3 should stay on the 4.5.x release line until they migrate. ## What is removed - The MarQS queue and its shared/dev queue consumers. - The v3 socket.io namespaces (coordinator, provider, shared-queue) and the v3 run lifecycle services (attempt, checkpoint, and batch-resume). - The graphile-worker background job system; all live jobs already run on `@trigger.dev/redis-worker`. - The `DEPRECATE_V3_ENABLED` flag: v3 is now rejected unconditionally, so the flag is gone. - Unused v3 exports from `@trigger.dev/core` (the `v3/zodNamespace` subpath and the legacy socket message catalogs) and the now-dead MarQS environment variables. ## What stays The v4 engine is untouched. The graceful v3 rejection boundary stays, `determineEngineVersion` still detects a v3 project so it can reject it, and the batch service plus batch-completion worker stay for current clients. Live queue concurrency limits and metrics now read from the v4 run engine instead of MarQS, and a brand-new dev environment now defaults to v4. ## Dependency cleanup Removes webapp dependencies left unused by this change: `seedrandom` and `semver` (only the removed v3 code used them) plus a set that was already dead, their orphaned `@types` packages, and two dead files. Adds a `knip:deps` script and a `knip.json` config so unused dependencies can be found the same way going forward.
1 parent c0f7c80 commit 5ba8557

114 files changed

Lines changed: 769 additions & 23238 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@trigger.dev/core": patch
3+
---
4+
5+
Removed the unused `@trigger.dev/core/v3/zodNamespace` export and the legacy v3 socket message schemas. These were only used by the now-retired v3 engine and have no v4 consumers.

.claude/rules/legacy-v3-code.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,24 @@ paths:
33
- "apps/webapp/app/v3/**"
44
---
55

6-
# Legacy V1 Engine Code in `app/v3/`
6+
# v3 (engine V1) has been removed
77

8-
The `v3/` directory name is misleading - most code here is actively used by the current V2 engine. Only the specific files below are legacy V1-only code.
8+
The v3 engine (RunEngineVersion `V1`: MarQS queue + Graphile worker) is end-of-life and its execution code has been removed from the webapp. The `app/v3/` directory name is historical: everything under it now serves the current V2 engine (`@internal/run-engine` + `@trigger.dev/redis-worker`).
99

10-
## V1-Only Files - Never Modify
10+
There is no `V1` execution path anymore. If you find a `RunEngineVersion` branch, the `V1` arm should only reject or finalize gracefully (for example, mark a historical run cancelled in the DB), never run V1 work. Do not reintroduce MarQS, the graphile worker, or the v3 socket.io namespaces.
1111

12-
- `marqs/` directory (entire MarQS queue system: sharedQueueConsumer, devQueueConsumer, fairDequeuingStrategy, devPubSub)
13-
- `legacyRunEngineWorker.server.ts` (V1 background job worker)
14-
- `services/triggerTaskV1.server.ts` (deprecated V1 task triggering)
15-
- `services/cancelTaskRunV1.server.ts` (deprecated V1 cancellation)
16-
- `authenticatedSocketConnection.server.ts` (V1 dev WebSocket using DevQueueConsumer)
17-
- `sharedSocketConnection.ts` (V1 shared queue socket using SharedQueueConsumer)
12+
## The deprecation boundary (keep this)
1813

19-
## V1/V2 Branching Pattern
14+
Requests from clients still on v3 (old SDK/CLI) or historical V1 runs must return a clean 4xx, never a 5xx. The boundary lives in:
2015

21-
Some services act as routers that branch on `RunEngineVersion`:
22-
- `services/cancelTaskRun.server.ts` - calls V1 service or `engine.cancelRun()` for V2
23-
- `services/batchTriggerV3.server.ts` - uses marqs for V1 path, run-engine for V2
16+
- `engineDeprecation.server.ts` - the `V3_TRIGGER_DEPRECATION_MESSAGE` / `V3_DEV_DEPRECATION_MESSAGE` / `V3_MIGRATION_URL` upgrade messages.
17+
- `engineVersion.server.ts` - `determineEngineVersion()` still detects a V1 project/run so callers can reject it.
18+
- `services/triggerTask.server.ts`, `services/cancelTaskRun.server.ts`, `services/rescheduleTaskRun.server.ts` - the `V1` arm rejects or finalizes gracefully instead of executing.
19+
- `services/initializeDeployment.server.ts` - the `DEPRECATE_V3_CLI_DEPLOYS_ENABLED`-gated v3 CLI deploy rejection.
20+
- `handleWebsockets.server.ts` - the legacy `trigger dev` websocket closes with the upgrade message.
2421

25-
When editing these shared services, only modify V2 code paths.
22+
## V2 modern stack
2623

27-
## V2 Modern Stack
28-
29-
- **Run lifecycle**: `@internal/run-engine` (internal-packages/run-engine)
30-
- **Background jobs**: `@trigger.dev/redis-worker` (not graphile-worker/zodworker)
31-
- **Queue operations**: RunQueue inside run-engine (not MarQS)
32-
- **V2 engine singleton**: `runEngine.server.ts`, `runEngineHandlers.server.ts`
33-
- **V2 workers**: `commonWorker.server.ts`, `alertsWorker.server.ts`, `batchTriggerWorker.server.ts`
24+
- **Run lifecycle**: `@internal/run-engine` (`runEngine.server.ts`, `runEngineHandlers.server.ts`)
25+
- **Background jobs**: `@trigger.dev/redis-worker` (`commonWorker.server.ts`, `alertsWorker.server.ts`, `batchTriggerWorker.server.ts`; `legacyRunEngineWorker.server.ts` still hosts the live batch-completion jobs)
26+
- **Queue operations**: RunQueue inside run-engine (`runQueue.server.ts`), not MarQS
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: breaking
4+
---
5+
6+
Removed support for the end-of-life v3 engine. Instances or projects still on v3 must stay on the 4.5.x release line or upgrade to v4; v3 triggers, batch triggers, reschedules, and deploys now return a clear upgrade message instead of running.

AGENTS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ User API call -> Webapp routes -> Services -> RunEngine -> Redis Queue -> Superv
138138
- **internal-packages/redis**: Redis client creation utilities (ioredis)
139139
- **internal-packages/testcontainers**: Test helpers for Redis/PostgreSQL containers
140140
- **internal-packages/schedule-engine**: Durable cron scheduling
141-
- **internal-packages/zod-worker**: Graphile-worker wrapper (DEPRECATED - use redis-worker)
142141

143-
### Legacy V1 Engine Code
142+
### v3 (engine V1) removed
144143

145-
The `apps/webapp/app/v3/` directory name is misleading - most code there is actively used by V2. Only specific files are V1-only legacy (MarQS queue, triggerTaskV1, cancelTaskRunV1, etc.). See `apps/webapp/CLAUDE.md` for the exact list. When you encounter V1/V2 branching in services, only modify V2 code paths. All new work uses Run Engine 2.0 (`@internal/run-engine`) and redis-worker.
144+
v3 (engine V1: MarQS + Graphile worker) is end-of-life and its execution code has been removed. The `apps/webapp/app/v3/` directory name is historical - everything there now serves V2 (Run Engine 2.0, `@internal/run-engine` + redis-worker). There is no V1 execution path: a `RunEngineVersion` `V1` branch only rejects or finalizes gracefully so v3 clients get a clean 4xx, never a 5xx. Do not reintroduce V1. See `apps/webapp/CLAUDE.md` and `.claude/rules/legacy-v3-code.md`.
146145

147146
### Documentation
148147

ai/references/repo.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ This is a pnpm 10.33.2 monorepo that uses turborepo @turbo.json. The following w
2323
- <root>/internal-packages/run-engine is the `@internal/run-engine` package that is "Run Engine 2.0" and handles moving a run all the way through it's lifecycle
2424
- <root>/internal-packages/redis is the `@internal/redis` package that exports Redis types and the `createRedisClient` function to unify how we create redis clients in the repo. It's not used everywhere yet, but it's the preferred way to create redis clients from now on.
2525
- <root>/internal-packages/testcontainers is the `@internal/testcontainers` package that exports a few useful functions for spinning up local testcontainers when writing vitest tests. See our [tests.md](./tests.md) file for more information.
26-
- <root>/internal-packages/zodworker is the `@internal/zodworker` package that implements a wrapper around graphile-worker that allows us to use zod to validate our background jobs. We are moving away from using graphile-worker as our background job system, replacing it with our own redis-worker package.
2726

2827
## References
2928

apps/supervisor/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Node.js app that manages task execution containers. Receives work from the platf
77
- `src/services/` - Core service logic
88
- `src/workloadManager/` - Container orchestration abstraction (Docker or Kubernetes)
99
- `src/workloadServer/` - HTTP server for workload communication (heartbeats, snapshots)
10-
- `src/clients/` - Platform communication (webapp/coordinator)
10+
- `src/clients/` - Platform communication (webapp)
1111
- `src/env.ts` - Environment configuration
1212

1313
## Architecture

apps/webapp/CLAUDE.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,14 @@ Background job workers use `@trigger.dev/redis-worker`:
9191
- `app/v3/alertsWorker.server.ts`
9292
- `app/v3/batchTriggerWorker.server.ts`
9393

94-
Do NOT add new jobs using zodworker/graphile-worker (legacy).
95-
9694
## Real-time
9795

9896
- Socket.io: `app/v3/handleSocketIo.server.ts`, `app/v3/handleWebsockets.server.ts`
9997
- Electric SQL: Powers real-time data sync for the dashboard
10098

101-
## Legacy V1 Code
102-
103-
The `app/v3/` directory name is misleading - most code is actively used by V2. Only these specific files are V1-only legacy:
104-
- `app/v3/marqs/` (old MarQS queue system)
105-
- `app/v3/legacyRunEngineWorker.server.ts`
106-
- `app/v3/services/triggerTaskV1.server.ts`
107-
- `app/v3/services/cancelTaskRunV1.server.ts`
108-
- `app/v3/authenticatedSocketConnection.server.ts`
109-
- `app/v3/sharedSocketConnection.ts`
99+
## v3 (engine V1) removed
110100

111-
Some services (e.g., `cancelTaskRun.server.ts`, `batchTriggerV3.server.ts`) branch on `RunEngineVersion` to support both V1 and V2. When editing these, only modify V2 code paths.
101+
v3 (engine V1: MarQS + Graphile worker) is end-of-life and its execution code is gone. The `app/v3/` directory name is historical; everything under it now serves V2. There is no V1 execution path: a `RunEngineVersion` `V1` branch (e.g. in `triggerTask.server.ts`, `cancelTaskRun.server.ts`) only rejects/finalizes gracefully so v3 clients get a clean 4xx, never a 5xx. Do not reintroduce V1. See `.claude/rules/legacy-v3-code.md` for the deprecation boundary.
112102

113103
## Performance: Trigger Hot Path
114104

0 commit comments

Comments
 (0)