Skip to content

Run connectors as Dynamic Workers - #53

Merged
tnkuehne merged 10 commits into
mainfrom
feat/dynamic-connectors
Oct 19, 2026
Merged

tnkuehne merged 10 commits into
mainfrom
feat/dynamic-connectors

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Connector code and secret updates previously required separate native Workers and fleet configuration changes. This moves connectors onto the Dynamic Worker runtime used by apps. Code and secret changes prepare and activate versioned snapshots without redeploying the shared native runtime.

Apps and connectors now share the worker infrastructure end to end:

  • The CLI uses one Wrangler configuration model for common fields, one bundler/source-map collector with project-relative paths on every OS, and one multipart publisher with stable request IDs across retries. API uploads share parsing, file/metadata limits, module validation and management-user accounting.
  • Common metadata describes the entry module, compatibility settings, normalized bindings and debug information. Connector metadata adds entrypoints and object declarations; app metadata adds assets and events. Both accept the same module types. Connector uploads require a UUID Idempotency-Key: the same key/content returns the original operation, different content conflicts, and a new key starts a new attempt.
  • Manifests and runtime snapshots reference immutable files by SHA-256 and size. Connector source is no longer embedded in internal package JSON. Agents download app and connector module files through the same lease-authorized endpoint and byte/size/checksum checks, then publish them through the same immutable storage path. Source maps remain private control-plane artifacts and never reach executable runtime storage. Secret reads load snapshot metadata, not source code.
  • Both roles use the same resource provisioning within each deployment backend, including D1 identity selection, and the same runtime worker-definition builder, binding adapters, module loader and native tail attachment. Variables follow the existing app limits: 32 ordinary bindings and 16,384 characters per variable. Connector secrets remain limited to 5,000 UTF-8 bytes each and 128 variables/secrets combined.

Role-specific behavior remains explicit:

  • Apps retain host routing, authentication, network policies, static assets, previews, and their existing event/Workflow integration. Connector grants are administrator-controlled and resolve the active connector version through scoped entrypoints. Connector Cron, Queues and Workflows are not added.
  • Connector Durable Objects use persistent facets behind shared supervisors, isolated by fleet, connector and class. Updates drain active calls, response streams and waitUntil work, including nested calls and asynchronous cancellation cleanup. Older generations cannot downgrade an object that has advanced.
  • Connector snapshots include fixed secret versions. An independent 256-bit key encrypts runtime secrets, so control-token rotation does not invalidate them. Self-hosting retains a random key per fleet in fleet object storage; hosted deployment requires WIDEFLEET_CONNECTOR_KEY through versioned deployment configuration. Encryption-key rotation and historical snapshot/resource cleanup remain manual.
  • Connector logs use the existing Workers Logs or Collector/ClickHouse backend, OTLP sender, queries, filters, pagination, CLI following and source-map resolution. UI, CLI and API enforce administrator access. Attribution includes fleet, connector and version; malformed span IDs are excluded from structured OTLP context. Historical code, secret-update and runtime-update versions resolve their own maps.

Runtime boundaries:

  • celld 0.6.2 captures entrypoint fetch tails, including waitUntil, but not RPC/facet calls; the connector gateway test also observes no tail for rejected fetch calls. Local workerd tests verify HTTP/RPC tails. Missing events are not reconstructed; delivery remains best-effort.
  • ES modules and Wasm load through the shared loader on both runtimes. celld 0.6.2 rejects separate text/data modules; local workerd loads them. This native limitation applies to apps and connectors alike.
  • Custom RPC transfers values; streaming uses fetch(). Callbacks, returned RPC objects, facet alarms and WebSockets are outside the common connector contract. There is no console instrumentation, alarm scheduler or WebSocket implementation without hibernation. celld is unchanged.
  • The existing workerd response-abort workaround remains shared across runtime deployments. Long-lived work can delay an object version switch.
  • This targets fresh installations, without migration of native connector state or older package/capability formats. Install matching control-plane, CLI, agent and app-runtime releases. Native resource additions may still update shared runtime configuration.

Validation:

  • pnpm check, production control-plane build, Rust formatting/Clippy, and 51 Rust workspace tests pass.

  • The regular suite passes 421 tests; environment-gated suites are run separately. Dynamic connector/app tests pass 45 cases on celld/workerd, with three runtime-specific skips, including shared Wasm loading and native text/data rejection. App and connector CLI suites pass 46 cases, including stable upload identity and bytes across a transient failure.

  • All 164 Cloudflare tests in 16 files pass after a fresh hosted build, including app/connector deployment, runtime behavior and replay/conflict tests. Shared upload, binary-download authorization, secret rotation, module reuse, source-map storage/resolution and telemetry regressions pass. Replaying an old request preserves the newer desired deployment; a new key can retry failed activation.

  • All 14 packaged CLI/agent/container deployment tests pass against a freshly built local runtime image, covering connector RPC, durable state, secret rotation, activation recovery, app deployment, assets, resources, network restrictions, previews, migrations, Workflows and restarts.

  • A deterministic native Workflow regression proves that paused instances must not run failure-recording steps. The existing Miniflare development patch enforces this, and SQL failure fixtures remove their triggers even after an assertion fails. Runtime rejection/retry assertions use the same bounded wait as neighboring asynchronous Workflow tests. Hosted production deployment logic is unchanged by this test-runtime correction.

Public documentation is maintained separately in draft PR #54. Publication remains blocked until matching platform and runtime releases contain these changes and their artifacts are available.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge for the stated fresh-installation scope.

Summary

Connectors now run as Dynamic Workers and share upload, module storage, resource bindings and logging with apps.

  • The CLI sends connector code as modules that the agent can fetch by hash.
  • Connector deployments prepare and activate snapshots through the shared runtime.
  • Administrators can read connector logs with connector and version details.
  • Shared API and deployment setup changes support the new connector paths.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI["CLI multipart upload"] --> API["Authorized API"]
  API --> Store["Immutable modules and manifest"]
  Store --> Deploy["Agent or hosted deployment"]
  Deploy --> Prepare["Prepare snapshot and check readiness"]
  Prepare --> Activate["Activate connector version"]
  App["App connector binding"] --> Gateway["Resolve active version"]
  Activate --> Gateway
  Gateway --> Worker["Dynamic Worker"]
  Worker --> Supervisor["Object supervisor"]
  Supervisor --> Facet["Persistent object facet"]
Loading

Reviews (9) · Last reviewed commit: "Fix portable bundles and paused workflow..." · Reviewed by Greptile

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 61e1c87 Oct 19 2026, 09:21 PM

Comment thread packages/contracts/src/index.ts Resolved
Comment thread packages/contracts/src/index.ts Resolved
Comment thread crates/platform-agent/src/fleet.rs Resolved
Comment thread packages/app-runtime/src/telemetry.ts Resolved
@tnkuehne
tnkuehne merged commit 6e52e97 into main Oct 19, 2026
18 checks passed
@tnkuehne
tnkuehne deleted the feat/dynamic-connectors branch October 19, 2026 21:36
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