Skip to content

fork with compete: false does not return branch outputs in declaration order #1867

Open

Description

@mathecruz

According to the specification (see open-workflow-specification/specification#1011 and open-workflow-specification/specification#1059), when compete is false the task "returns an array that includes the outputs from each branch, preserving the order in which the branches are declared".

The runtime instead wraps each output with the branch name and sorts the array by completion time.

document:
  dsl: '1.0.0'
  namespace: test
  name: fork-no-compete-declaration-order
  version: '0.1.0'
do:
  - callSomeone:
      fork:
        compete: false
        branches:
          - callNurse:
              do:
                - waitForNurse:
                    wait:
                      milliseconds: 200
                - nurseArrived:
                    set:
                      patientId: John
                      room: 1
          - callDoctor:
              set:
                patientId: Smith
                room: 2

Expected: [{"patientId":"John","room":1},{"patientId":"Smith","room":2}]

Actual: [{"callDoctor":{"patientId":"Smith","room":2}},{"callNurse":{"patientId":"John","room":1}}]

Activity

  1. added
    java
    on Nov 23, 2026
  2. fjtirado commented on Nov 24, 2026

    @fjtirado
    Collaborator

    @mathecruz @ricardozanini
    Well,the current implementation was aligned with the spec before the change mentioned in the PR description.
    I vaguely recalled that, since the spec was silent on the topic (probably because I was one of the fist to implement it), I discuss with Charles through slack and agree of returning an array including the branch name.
    We forgot to document this agreement (as many other things) and this was later changed by the current writing (kind of silently).
    But I would argue the writing is kind of ambiguous and is not illustrated with a real output example.
    And since I believe the current implementation is far less ambiguous and useful than relying on declaration order, I think the discussion should be reopened at the specification forum before changing the implementation.

  3. ricardozanini commented on Nov 24, 2026

    @ricardozanini
    Collaborator

    @fjtirado instead of saying it was "silently changed", please point to the commit where that happened, and reopen an issue so we can document it properly.

  4. fjtirado commented on Nov 24, 2026

    @fjtirado
    Collaborator

    @fjtirado instead of saying it was "silently changed", please point to the commit where that happened, and reopen an issue so we can document it properly.

    The issues that changed the test is already mentioned in the description. I said "kind of" and it was really kind of (description changes, but schema and examples remains the same). This kind of change I think requires a broader consensus and more details. And also Im not the code owner of the spec, either I scan all changes in the spec or I expect you to tell me this was changed. Also, understand that If I have discussed (longly) something and we we have reach an agreement, I expect that agreement to be recorded somewhere.

    Anyway, the important thing, what approach is better, the implemented or the one inferred by Matheus after reading the spec?

  5. ricardozanini commented on Nov 24, 2026

    @ricardozanini
    Collaborator

    As talked offline, we should update the spec to follow what we have implemented, which is the better take IMO. An author can pick a specific output if they need it for the next task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    java

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions