Skip to content

Support declarative parallel steps in workflow definitions #25

Description

@tbrandenburg

Problem

We want a simple way to express parallel execution in workflows without introducing a new execution engine. The generated artifacts must remain plain bash and keep the current vars / bash / agent model intact.

Proposed schema

Add one new step type: parallel. It is a wrapper step that contains ordinary child steps.

workflows:
  - id: wf_example
    name: Example
    steps:
      - type: parallel
        name: Fan out
        steps:
          - type: bash
            name: Build
            run: make build
          - type: bash
            name: Test
            run: make test
          - type: agent
            name: Review
            prompt: Review the build output.

Minimal constraints:

  • parallel.steps should accept the same step types supported today: vars, bash, agent.
  • Nested parallel can be deferred unless there is a strong need.
  • The wrapper is declarative only; no new workflow runtime beyond generated bash.

Minimal renderer change

Keep the current per-step function generation. For a parallel step:

  • Render each child step as a normal function, reusing the existing step renderer.
  • Generate a wrapper function that starts each child in the background with "$fn" &.
  • Capture PIDs with "$!", then wait for each PID.
  • Return nonzero if any child fails.

Example bash shape:

parallel_step() {
  child_a &
  pid_a=$!
  child_b &
  pid_b=$!

  status=0
  wait "$pid_a" || status=$?
  wait "$pid_b" || status=$?
  return "$status"
}

Known tradeoffs

  • Branches do not share mutable shell state.
  • vars inside one branch do not affect sibling branches or the parent.
  • Output from concurrent branches will interleave.
  • Failure handling stays simple: collect exit codes, do not attempt cancellation.

Acceptance criteria

  • Workflow YAML can declare a parallel wrapper step.
  • Generated harnesses remain plain bash.
  • Existing vars / bash / agent workflows continue to work unchanged.
  • The implementation stays minimal and readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions