Skip to content

feat(openworkflow,dashboard): add child workflows#342

Merged
jamescmartinez merged 2 commits into
mainfrom
child-workflows
Feb 25, 2026
Merged

feat(openworkflow,dashboard): add child workflows#342
jamescmartinez merged 2 commits into
mainfrom
child-workflows

Conversation

@jamescmartinez
Copy link
Copy Markdown
Contributor

@jamescmartinez jamescmartinez commented Feb 25, 2026

This PR adds step.invoke() to invoke child workflows and visibility in the dashboard.

import { helloWorld } from "./hello-world.js";
import { defineWorkflow } from "openworkflow";

export const helloWorldParent = defineWorkflow(
  { name: "hello-world-parent" },
  async ({ step, run }) => {
    // 👇 new
    const childResult = await step.invoke("hello-world-child", {
      workflow: helloWorld,
    });

    return { childResult, parentMessage: "Hello from the parent workflow!" };
  },
);
Screenshot 2026-02-25 at 2 26 36 PM Screenshot 2026-02-25 at 2 27 27 PM Screenshot 2026-02-25 at 2 27 04 PM

Copilot AI review requested due to automatic review settings February 25, 2026 20:17
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 25, 2026

Open in StackBlitz

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

commit: d85c439

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 25, 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 pull request adds child workflow support to OpenWorkflow through a new step.invoke() API. The feature enables workflows to start and wait for child workflow runs durably, with timeout handling, parent-child linkage, and automatic parent wake-up when children complete.

Changes:

  • Added step.invoke() API to invoke child workflows with configurable timeouts (default 7 days)
  • Implemented parent-child workflow linkage via parentStepAttemptId and parentStepAttemptNamespaceId fields
  • Added automatic parent workflow wake-up mechanism when child workflows reach terminal states
  • Extended dashboard to display parent-child workflow relationships

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/openworkflow/worker/execution.ts Core implementation of step.invoke() with timeout resolution, child workflow creation, and parent-child linking
packages/openworkflow/worker/execution.test.ts Comprehensive test coverage for invoke functionality including timeout, failure propagation, and replay scenarios
packages/openworkflow/core/workflow-function.ts Added InvokeStepConfig interface and updated StepApi with invoke method
packages/openworkflow/core/step-attempt.ts Added "invoke" step kind and InvokeStepAttemptContext type
packages/openworkflow/core/error.ts Added deserializeError to rehydrate errors from child workflows
packages/openworkflow/core/workflow-run.ts Added isTerminalStatus helper function
packages/openworkflow/core/backend.ts Added setStepAttemptChildWorkflowRun and parent step attempt fields to CreateWorkflowRunParams
packages/openworkflow/sqlite/backend.ts Implemented wakeParentWorkflowRun and setStepAttemptChildWorkflowRun for SQLite
packages/openworkflow/postgres/backend.ts Implemented wakeParentWorkflowRun and setStepAttemptChildWorkflowRun for PostgreSQL
packages/openworkflow/testing/backend.testsuite.ts Added parent-child relationship tests and updated all createWorkflowRun calls with new fields
packages/dashboard/src/routes/runs/$runId.tsx Enhanced run details page to display parent and child workflow relationships
packages/dashboard/src/routes/index.tsx Updated run list loader to fetch parent workflow information for child runs
packages/dashboard/src/components/run-list.tsx Added child run relation badges to workflow run list
packages/dashboard/src/lib/api.ts Added getStepAttemptServerFn for fetching step attempts
packages/docs/docs/steps.mdx Documented step.invoke() API with examples
packages/docs/docs/workflows.mdx Updated workflow status table to mention step.invoke
openworkflow/hello-world-parent.ts Added example parent workflow demonstrating child invocation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{config.label}
</Badge>
{childRunRelation && (
<Badge variant="outline" className="">
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Empty className attribute on Badge component. Consider removing it if no additional styling is needed, or add the intended class if one was accidentally deleted.

Suggested change
<Badge variant="outline" className="">
<Badge variant="outline">

Copilot uses AI. Check for mistakes.
@jamescmartinez jamescmartinez changed the title feat(openworkflow,cli,dashboard): add child workflows feat(openworkflow,dashboard): add child workflows Feb 25, 2026
Copilot AI review requested due to automatic review settings February 25, 2026 20:55
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

Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.


💡 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/worker/execution.ts
Comment thread packages/openworkflow/worker/execution.ts
Comment thread packages/openworkflow/postgres/backend.ts
Comment thread packages/openworkflow/sqlite/backend.ts
Comment thread packages/openworkflow/core/workflow-run.test.ts
Comment thread openworkflow/hello-world-parent.ts
@jamescmartinez jamescmartinez merged commit 29d6222 into main Feb 25, 2026
15 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