feat(openworkflow): step.runWorkflow to run child workflows#349
Merged
jamescmartinez merged 1 commit intomainfrom Feb 27, 2026
Merged
feat(openworkflow): step.runWorkflow to run child workflows#349jamescmartinez merged 1 commit intomainfrom
step.runWorkflow to run child workflows#349jamescmartinez merged 1 commit intomainfrom
Conversation
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new step.runWorkflow() API for running child workflows from within a parent workflow, replacing the previous invoke-based naming and plumbing across worker execution, backends, tests, dashboard, and docs.
Changes:
- Replace
step.invokeWorkflowwithstep.runWorkflow(spec, input?, options?)and persist child-workflow steps as kind"workflow". - Update worker execution logic, backend wake-up reconciliation, and UI to use
"workflow"step kind and the new API shape. - Update tests and documentation to reflect the new child-workflow step API and behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openworkflow/worker/execution.ts | Implements step.runWorkflow, step kind "workflow", timeout handling, and child-run linking/validation. |
| packages/openworkflow/worker/execution.test.ts | Updates/extends worker tests for runWorkflow, including schema validation behavior. |
| packages/openworkflow/testing/backend.testsuite.ts | Updates backend test suite fixtures from "invoke" to "workflow" step kind. |
| packages/openworkflow/sqlite/backend.ts | Updates SQLite wake-up reconciliation queries to use "workflow" step kind. |
| packages/openworkflow/sqlite/backend.test.ts | Renames/updates SQLite reconciliation tests for "workflow" step kind. |
| packages/openworkflow/postgres/backend.ts | Updates Postgres wake-up reconciliation queries to use "workflow" step kind. |
| packages/openworkflow/postgres/backend.test.ts | Renames/updates Postgres reconciliation tests for "workflow" step kind. |
| packages/openworkflow/core/workflow-function.ts | Replaces invokeWorkflow API typing with runWorkflow + StepRunWorkflowOptions. |
| packages/openworkflow/core/step-attempt.ts | Renames step kind from "invoke" to "workflow" and updates context type/constructor. |
| packages/openworkflow/core/step-attempt.test.ts | Updates context-constructor tests to createWorkflowContext. |
| packages/openworkflow/client/client.ts | Updates docs snippet to pass workflow.spec into runWorkflow. |
| packages/docs/docs/workflows.mdx | Updates StepApi references to step.runWorkflow. |
| packages/docs/docs/steps.mdx | Renames docs section to step.runWorkflow() and updates examples. |
| packages/docs/docs/roadmap.mdx | Updates roadmap wording to step.runWorkflow. |
| packages/docs/docs/child-workflows.mdx | Updates child workflow docs/examples to the new API and option names. |
| packages/dashboard/src/routes/runs/$runId.tsx | Updates dashboard child-run linking to look for step kind "workflow". |
| openworkflow/hello-world-parent.ts | Updates example workflow to call step.runWorkflow. |
| ARCHITECTURE.md | Updates architecture docs to the new child-workflow step API and naming. |
Comments suppressed due to low confidence (2)
packages/dashboard/src/routes/runs/$runId.tsx:59
- The UI only treats steps with kind "workflow" as having
childWorkflowRunId. If older step attempts still exist with kind "invoke", the dashboard will stop showing their child run links after upgrading. Consider treating legacy "invoke" as equivalent here (or ensure data is migrated).
const childRunIds = [
...new Set(
steps
.map((step) =>
step.kind === "workflow" ? step.childWorkflowRunId : null,
)
.filter((childRunId): childRunId is string => childRunId !== null),
),
packages/dashboard/src/routes/runs/$runId.tsx:190
- This conditional hides child-run details unless
step.kind === "workflow". For backward compatibility with existing data, consider also accepting legacystep.kind === "invoke"so older runs still show their child workflow links in the dashboard.
const stepTypeLabel =
step.kind === "function" ? "run" : step.kind;
const childRunId =
step.kind === "workflow" ? step.childWorkflowRunId : null;
const childRun = childRunId
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.