Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLI
Assigneesadam

Relationships

#814 Resolve dynamic workflow task targets inside forEach

Opened by evrardjp · 6/25/2026· Shipped 6/25/2026

Problem

A capability planner can produce ordered waves of workflow invocations as Swamp data. A child workflow can iterate a wave with forEach and pass resolved item fields into task inputs, but the workflow task target itself is not resolved when it is expressed from the forEach item.

Example child workflow step:

- name: apply-${{ self.item.host }}-${{ self.item.capability }}
  forEach:
    item: item
    in: ${{ inputs.items }}
  task:
    type: workflow
    workflowIdOrName: ${{ self.item.implementation.workflowIdOrName }}
    inputs:
      host: ${{ self.item.host }}
      capability: ${{ self.item.capability }}
      vm: ${{ self.item.vm }}

The evaluator resolves task inputs such as host, capability, and vm, but leaves task.workflowIdOrName as the literal expression. It also partially resolves the step name (apply-bao-${{ self.item.capability }}), suggesting dynamic workflow task target/name expression handling is incomplete compared with dynamic model targeting.

Desired behavior

For workflow tasks in forEach, resolve workflowIdOrName from the current item the same way task inputs resolve. This enables a planner model to emit dependency waves whose items each select a workflow implementation.

Use case

A Swamp capability catalog/planner model emits data like:

{
  "waves": [
    {
      "name": "wave-0",
      "items": [
        {
          "host": "gitea",
          "capability": "ssh",
          "implementation": {
            "type": "workflow",
            "workflowIdOrName": "lab-capability-ssh"
          }
        }
      ]
    }
  ]
}

A parent workflow iterates waves sequentially and a child workflow iterates items in a wave in parallel. Without dynamic workflow target resolution, the workflow cannot execute planner-selected workflow implementations without hardcoding capability names.

Reproduction

  1. Create a workflow with the step above.
  2. Run swamp workflow evaluate <workflow> --input-file wave0.json --json.
  3. Observe that inputs resolve but task.workflowIdOrName remains ${{ self.item.implementation.workflowIdOrName }}.

Expected

The evaluated step should contain:

task:
  type: workflow
  workflowIdOrName: lab-capability-ssh

Environment

Observed with Swamp CLI version shown by auto-update logs: 20260624.192904.0-sha.e86b32ec.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 13 MOREREVIEW+ 3 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

6/25/2026, 7:32:50 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
adam assigned adam6/25/2026, 2:43:33 PM
Editable. Press Enter to edit.

adam commented 6/25/2026, 7:33:04 PM

Thanks @evrardjp for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.