Skip to content

feat(openworkflow): add auto-indexing for duplicate step names#344

Merged
jamescmartinez merged 1 commit into
mainfrom
auto-step-index
Feb 26, 2026
Merged

feat(openworkflow): add auto-indexing for duplicate step names#344
jamescmartinez merged 1 commit into
mainfrom
auto-step-index

Conversation

@jamescmartinez
Copy link
Copy Markdown
Contributor

@jamescmartinez jamescmartinez commented Feb 25, 2026

this PR adds automatic collision handling for duplicate step names.

table to demonstrate what it looks like:

# user-provided actual after collision handling
1 foo foo
2 foo:2 foo:2
3 foo foo:1
4 foo:1 foo:1:1
5 foo foo:3
6 foo:2 foo:2:1
7 foo foo:4
8 foo:1 foo:1:2
9 foo:3 foo:3:1
10 foo foo:5

Copilot AI review requested due to automatic review settings February 25, 2026 23:07
@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@344
npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/dashboard@344
npm i https://pkg.pr.new/openworkflowdev/openworkflow@344

commit: 2cf6f76

@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

Adds automatic collision handling for duplicate step names in OpenWorkflow by deterministically indexing repeated names (name, name:1, name:2, …) during a single workflow execution pass, updating tests and documentation to reflect the new behavior.

Changes:

  • Introduces step-name resolution logic in StepExecutor and applies it across step.run, step.sleep, and step.invokeWorkflow.
  • Updates worker/executor tests to assert distinct results and persisted step attempt names for duplicate base names (including cross-step-type collisions and parallel invokes).
  • Updates docs and architecture notes to describe auto-disambiguation of duplicate step names and dynamic-step guidance.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
packages/openworkflow/worker/worker.test.ts Updates worker-level test to assert duplicate step names are auto-indexed and both executions run.
packages/openworkflow/worker/execution.ts Implements deterministic step-name auto-indexing and refactors failure handling via a shared helper.
packages/openworkflow/worker/execution.test.ts Updates/adds tests covering duplicate naming across run/sleep/invoke, including parallel invoke scenarios.
packages/docs/docs/steps.mdx Revises step-naming guidance to describe auto-disambiguation behavior.
packages/docs/docs/dynamic-steps.mdx Updates dynamic-steps docs to rely on auto-indexing and adds guidance around stable IDs.
ARCHITECTURE.md Documents the new “durable key” collision/indexing behavior across step APIs.
Comments suppressed due to low confidence (1)

packages/openworkflow/worker/execution.test.ts:55

  • The new auto-indexing behavior has an important edge case when user-provided names already contain numeric suffixes (e.g., "foo:1"). It would be good to add a test covering a sequence like "foo", "foo:1", "foo" to ensure the resolver still produces unique durable names (and doesn’t collide/reuse cached state).
  test("auto-indexes duplicate step.run names", async () => {
    const backend = await createBackend();
    const client = new OpenWorkflow({ backend });

    let executionCount = 0;
    const workflow = client.defineWorkflow(
      { name: "executor-cached" },
      async ({ step }) => {

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

Comment thread packages/docs/docs/steps.mdx
Comment thread ARCHITECTURE.md
Comment thread packages/openworkflow/worker/execution.ts Outdated
Comment thread packages/openworkflow/worker/execution.test.ts Outdated
Comment thread packages/openworkflow/worker/execution.test.ts Outdated
Comment thread packages/docs/docs/steps.mdx
Comment thread packages/openworkflow/worker/worker.test.ts Outdated
Comment thread packages/openworkflow/worker/execution.test.ts Outdated
Comment thread packages/openworkflow/worker/execution.test.ts Outdated
Comment thread packages/docs/docs/dynamic-steps.mdx
Copilot AI review requested due to automatic review settings February 26, 2026 00:39
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 6 out of 6 changed files in this pull request and generated no new comments.


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

@jamescmartinez jamescmartinez merged commit 1ad7291 into main Feb 26, 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