Skip to content

feat: add start_mode to worker functions to skip HTTP pings for process workers#626

Open
jumski wants to merge 1 commit into
mainfrom
portable-worker-start
Open

feat: add start_mode to worker functions to skip HTTP pings for process workers#626
jumski wants to merge 1 commit into
mainfrom
portable-worker-start

Conversation

@jumski
Copy link
Copy Markdown
Contributor

@jumski jumski commented Jun 7, 2026

Adds a start_mode field to worker_functions to distinguish between workers that are HTTP-pinged by ensure_workers() and workers that manage their own startup lifecycle (process mode).

The ensure_workers() cron function now filters exclusively on start_mode = 'http', meaning process-mode workers are never targeted by HTTP pings regardless of environment (local or production). The track_worker_function() SQL function and its TypeScript counterpart accept an optional start_mode parameter (defaulting to 'http'), and update the stored mode on conflict.

WorkerBootstrap gains an optional startMode field, which WorkerLifecycle and FlowWorkerLifecycle read during acknowledgeStart to forward the correct mode when registering the worker. SupabasePlatformAdapter explicitly passes 'http' when bootstrapping via HTTP request handling.

A database constraint enforces that only 'http' and 'process' are valid values. Tests cover default mode storage, explicit mode storage, conflict updates, constraint violations, and that ensure_workers() skips process-mode workers in both local and production environments.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 7, 2026

⚠️ No Changeset found

Latest commit: 30f8253

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jun 7, 2026

View your CI Pipeline Execution ↗ for commit 30f8253

Command Status Duration Result
nx run edge-worker:test:integration ✅ Succeeded 4m 25s View ↗
nx run client:e2e ✅ Succeeded 1m 16s View ↗
nx run edge-worker:e2e ✅ Succeeded 37s View ↗
nx run core:pgtap ✅ Succeeded 1m 54s View ↗
nx run cli:e2e ✅ Succeeded 3s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 3s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 3s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 31s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-08 18:32:40 UTC

@jumski jumski force-pushed the portable-worker-start branch from ca1dd9b to 8f4bb3e Compare June 8, 2026 17:50
@jumski jumski force-pushed the portable-worker-start branch from 8f4bb3e to 30f8253 Compare June 8, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant