Skip to content

feat(temporal): support per-node-type taskQueue routing - #142

Open
tbrandenburg wants to merge 1 commit into
synergycodes:mainfrom
tbrandenburg:issue-141-taskqueue-routing
Open

tbrandenburg wants to merge 1 commit into
synergycodes:mainfrom
tbrandenburg:issue-141-taskqueue-routing

Conversation

@tbrandenburg

Copy link
Copy Markdown

Issues fixed

Closes #141 — Support per-node-type activity worker routing (dedicated Docker images/tools per node type)

Summary

Adds an optional taskQueue field to the per-node-type ActivityProfile, so a specific node type's activity can be pinned to a non-default Temporal task queue and served by a dedicated, minimal worker process/Docker image — while every other node type keeps running exactly as today on the shared worker. Fully additive/backward-compatible: no taskQueue in a profile means the current behavior.

Changes:

  • packages/temporal: ActivityProfile.taskQueue?: string, validated (non-empty string) in profile-validation.ts, forwarded by resolveFromValidatedProfiles into the options handed to proxyActivities (only when present). Added findProfilesWithUnpolledTaskQueue, the worker-side check for a profile routed to a queue nobody polls (mirrors the existing findProfilesWithoutExecutor).
  • apps/execution-worker: new activity-only entrypoint specialized-worker.ts (no workflowsPath) that registers only the AI-agent executor as the illustrative "needs its own image" example, polling a new SPECIALIZED_TASK_QUEUE.
  • deploy/ai-studio: new worker-specialized compose service reusing the existing runtime image/target with its own command and env — no new Dockerfile stage needed since the specialized worker is still plain TS on the same base image.
  • READMEs updated in packages/temporal, apps/execution-worker, deploy/ai-studio.

No changes to runGraph, the graph interpreter, the UI, the DB schema, or the backend — purely a worker-topology/deployment change, per the issue's non-goals.

Validation commands run

  • pnpm build:temporal
  • pnpm -F @workflowbuilder/temporal test — 9 files / 92 tests passed
  • pnpm -F @workflowbuilder/temporal typecheck / lint — clean
  • pnpm -F execution-worker typecheck / lint / test — clean, 3 files / 10 tests passed
  • pnpm exec prettier --check packages/temporal apps/execution-worker deploy/ai-studio — clean
  • pnpm test (full monorepo, all workspaces) — all passing

E2E coverage

packages/temporal/test/task-queue-routing.test.ts is a real end-to-end test: it spins up a real TestWorkflowEnvironment (real embedded Temporal server, no mocks), runs an actual workflow with a node profile carrying taskQueue, and asserts against the real recorded Event History that the ActivityTaskScheduled command for that node names the specialized queue rather than the workflow's default queue.

Risks / follow-ups

  • findProfilesWithUnpolledTaskQueue is exported but not auto-wired into WorkflowBuilderPlugin's constructor (unlike findProfilesWithoutExecutor), since that would require the plugin to know about every queue in a multi-worker deployment. Left as a standalone check a consumer calls explicitly — documented in the package README.
  • worker-specialized and specialized-worker.ts are illustrative reference implementations (routes ai-studio/ai-agent as the example specialized node type); no node type in this app is actually configured with taskQueue today, so the service idles until an app opts a node type in via nodeActivityProfiles.
  • No unrelated issues found during this work.

@tbrandenburg

Copy link
Copy Markdown
Author

Ran the full pr-check.yml suite independently on my fork (fork PRs need a maintainer to approve the workflow run on this repo before it executes here) — all 6 jobs pass, including the Temporal plugin job covering this change: https://github.com/tbrandenburg/workflowbuilder/actions/runs/34834106741

  • Execution pipeline lint + typecheck + test — pass
  • Format check — pass
  • SDK lint + typecheck + test + build — pass
  • Starter build — pass
  • Temporal plugin lint + typecheck + test + build — pass
  • UI + UI tokens lint + typecheck + test + build — pass

Happy to answer questions or make changes based on review.

tbrandenburg pushed a commit to tbrandenburg/workflowbuilder that referenced this pull request Sep 14, 2026
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.

Support per-node-type activity worker routing (dedicated Docker images/tools per node type)

1 participant