Skip to content

feat(openworkflow): step.runWorkflow to run child workflows#349

Merged
jamescmartinez merged 1 commit intomainfrom
step-run-workflow
Feb 27, 2026
Merged

feat(openworkflow): step.runWorkflow to run child workflows#349
jamescmartinez merged 1 commit intomainfrom
step-run-workflow

Conversation

@jamescmartinez
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 27, 2026 03:35
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/cli@349
npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/dashboard@349
npm i https://pkg.pr.new/openworkflowdev/openworkflow@349

commit: 5997f49

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.invokeWorkflow with step.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 legacy step.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.

Comment thread packages/openworkflow/worker/execution.ts
Comment thread packages/openworkflow/worker/execution.ts
Comment thread packages/openworkflow/core/step-attempt.ts
Comment thread packages/openworkflow/sqlite/backend.ts
Comment thread packages/openworkflow/postgres/backend.ts
Comment thread packages/openworkflow/worker/execution.ts
Comment thread packages/openworkflow/sqlite/backend.ts
Comment thread packages/openworkflow/postgres/backend.ts
@jamescmartinez jamescmartinez merged commit 3909135 into main Feb 27, 2026
14 checks passed
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.

2 participants