Refactor Postgres queue execution#2660
Conversation
🦋 Changeset detectedLatest commit: 5828276 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Workflow Benchmarkscommit Backend:
📜 Previous results (2)380cd99Thu, 09 Jul 2026 00:16:52 GMT · run logs
51b4853Wed, 08 Jul 2026 23:10:29 GMT · run logs
Avg deltas compare against the most recent benchmark run on Metrics — TTFS: time to first step body execution · STSO: step-to-step overhead (gap between consecutive step bodies) · WO: workflow overhead (time outside step bodies, client start → last step body exit) · SL: stream latency (first chunk write → visible to the reader) Scenarios — stream: one step that streams chunks back to the client; no hooks, so the run stays in turbo mode · hook + stream: registers a hook before the same streaming step, which exits turbo mode · 1020 steps: 1020 trivial sequential steps; STSO is measured between consecutive steps in the given step ranges 🟢/🔴 mark percentiles within/above target. Targets (p75/p90/p99, ms) — TTFS 200/300/600 · SL 50/60/125 · STSO (1-20) 20/30/60 · STSO (101-120) 30/45/90 · STSO (1001-1020) 40/60/120 TTFS/WO compare client vs deployment clocks and SL compares the step runner’s clock vs the client’s (NTP-synced in CI). WO ends at the last step body exit, the closest observable proxy for the final step-completion request. |
🧪 E2E Test Results✅ All tests passed Summary
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
✅ 📋 Other
|
1ea871b to
34615b2
Compare
40dfae0 to
a2f17c4
Compare
The Graphile runner now starts once (registering both job types) as soon as a workflow executor exists, and each job resolves its executor at execution time: the registered in-process handler when present, HTTP against WORKFLOW_LOCAL_BASE_URL when that route is healthy, and otherwise a health probe plus a durable short-delay redelivery. This removes the runner-replacement machinery (RunnerTarget diffing, replaceRunner, the start mutex) and fixes step-queue messages (e.g. step health checks) never executing when the workflow handler registers before the queue starts probing. Also unify workflowEntrypoint's lazy world loading on getPostgresRegistrationWorld() (covering injected Postgres worlds, not just env-configured ones) and make getPostgresRegistrationWorld ignore worlds whose getDeploymentId throws. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The bootstrap loop now probes just the flow health route (the runner start condition); step routes are warmed exclusively by resolveExecutor when a step job actually arrives with no registered handler. One probe mechanism per need, and no HTTP traffic at all in steady state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Core no longer knows Postgres exists. Worlds whose queue executes in-process handlers declare it via a new optional Queue.inProcessQueueHandlers capability in @workflow/world, and world-postgres sets it. Core reacts to the capability only: workflowEntrypoint registers its queue handler once such a world is available (immediately when cached, or when later created/injected — onceInProcessQueueWorld listeners live on globalThis like the world caches), the step entrypoint registers on POST health probes for such worlds, and the env-string matching, getDeploymentId probing, and the flow-route health hook are deleted. Detection now also works for custom world module paths (e.g. WORKFLOW_TARGET_WORLD=./dist/index.js) that the string check never matched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…postgres-http-handler # Conflicts: # packages/core/src/runtime/world.ts # packages/world-postgres/src/queue.test.ts # packages/world-postgres/src/queue.ts # packages/world-postgres/src/reenqueue.test.ts
…postgres-http-handler
…postgres-http-handler
Summary:
WORKFLOW_LOCAL_BASE_URLauthoritative, retain healthy local HTTP delivery for older runtimes, and durably defer jobs while no executor is available.Validation:
Closes #2658
Refs #2656 #1334 #1417